code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# CIS 117 Python Programming - Lab 10 # Bryce DesBrisay def middle(string): characters = list(string) length = len(characters) middleNum = round((length + .5) / 2) if length % 2 == 0: return characters[middleNum - 1] + characters[middleNum] else: return characters[middleNum - 1] de...
normal
{ "blob_id": "d60690892eddda656c11470aacd1fdc9d07a721a", "index": 3563, "step-1": "<mask token>\n\n\ndef countVowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o', 'u', 'y']\n for vowel in vowels:\n count += string.count(vowel)\n return count\n\n\n<mask token>\n\n\ndef isPalindrome(string...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> PyInstaller.__main__.run(['--clean', '--onefile', '--workpath', workPath, '--distpath', outPath, '--hidden-import', 'win32timezone', os.path.join (srcPath, 'service.py'), os.path.join(srcPath, 'bridge.py')]) shutil.copy2(o...
flexible
{ "blob_id": "16a95573c4fccc10bdc5e37b307d0c85714b328c", "index": 3548, "step-1": "<mask token>\n", "step-2": "<mask token>\nPyInstaller.__main__.run(['--clean', '--onefile', '--workpath', workPath,\n '--distpath', outPath, '--hidden-import', 'win32timezone', os.path.join\n (srcPath, 'service.py'), os.pat...
[ 0, 1, 2, 3, 4 ]
n, k = raw_input().split() n = int(n) k = int(k) div = 0 for i in range(n): new = int(raw_input()) if (new % k) == 0: div += 1 print div
normal
{ "blob_id": "68e1e39f193537367d899c5fd01c1361ed93ef29", "index": 7668, "step-1": "n, k = raw_input().split()\nn = int(n)\nk = int(k)\n\ndiv = 0\n\nfor i in range(n):\n new = int(raw_input())\n if (new % k) == 0:\n div += 1\n\nprint div", "step-2": null, "step-3": null, "step-4": null, "step-...
[ 0 ]
<|reserved_special_token_0|> class EMPTY: <|reserved_special_token_0|> pass class Config: """ Configuration management entity. Args: name (str): Name of config environment. fallback (bool): Indicate if configuration should fallback to base. """ no_config_err = 'No such c...
flexible
{ "blob_id": "263d2fe43cf8747f20fd51897ba003c9c4cb4280", "index": 9907, "step-1": "<mask token>\n\n\nclass EMPTY:\n <mask token>\n pass\n\n\nclass Config:\n \"\"\"\n Configuration management entity.\n\n Args:\n name (str): Name of config environment.\n fallback (bool): Indicate if con...
[ 6, 7, 8, 9, 11 ]
import time import jax.numpy as jnp def tick(): return time.perf_counter() def tock(t0, dat=None): if dat is not None: try: _ = dat.block_until_ready() except AttributeError: _ = jnp.array(dat).block_until_ready() return time.perf_counter() - t0
normal
{ "blob_id": "e58dbb4f67c93abf3564dc0f38df8852313338f0", "index": 5520, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tock(t0, dat=None):\n if dat is not None:\n try:\n _ = dat.block_until_ready()\n except AttributeError:\n _ = jnp.array(dat).block_until_rea...
[ 0, 1, 2, 3 ]
#!flask/bin/python import os, json import requests SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None) FROM_EMAIL = os.environ.get('FROM_EMAIL', default=None) TO_EMAIL = os.environ.get('TO_EMAIL', default=None) if not SENDGRID_API_KEY: raise ValueError("Need to set Sendgrid API Key (SENDGRID_API_K...
normal
{ "blob_id": "cb29ee8687b469923896ceb7d5a6cd7f54b2c34e", "index": 6207, "step-1": "<mask token>\n\n\ndef build_request_body(email):\n from_email = email['email']\n name = email['name']\n subject = email['subject']\n body = email['body']\n if not from_email:\n from_email = FROM_EMAIL\n if ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class LocalizationTests(unittest.TestCase): def test_default(self): logging.info('*** default ***') localization = Localization() text = 'hello world' self.assertEqual(localization._(text), text) <|reserved_special_token_0|> def test_global(se...
flexible
{ "blob_id": "debd51b923a6fc3b278a5083478bfb271a5913a8", "index": 162, "step-1": "<mask token>\n\n\nclass LocalizationTests(unittest.TestCase):\n\n def test_default(self):\n logging.info('*** default ***')\n localization = Localization()\n text = 'hello world'\n self.assertEqual(loc...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def right_permutation(arr): if len(arr) == 1: return True for i in range(len(arr) - 1): if arr[i + 1] < arr[i]: break elif i == len(arr) - 2: return True return False def worstsort(arr): sort_arr = [] check = False ...
flexible
{ "blob_id": "7c82565a4184b2e779e2bb6ba70b497cc287af35", "index": 5285, "step-1": "<mask token>\n\n\ndef right_permutation(arr):\n if len(arr) == 1:\n return True\n for i in range(len(arr) - 1):\n if arr[i + 1] < arr[i]:\n break\n elif i == len(arr) - 2:\n return T...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Doggo) admin.site.register(Profile) <|reserved_special_token_1|> from django.contrib import admin from apap.models import * admin.site.register(Doggo) admin.site.register(Profile) <|reserved_special_token_...
flexible
{ "blob_id": "22504b466cdeb380b976e23e2708e94131722e11", "index": 8147, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Doggo)\nadmin.site.register(Profile)\n", "step-3": "from django.contrib import admin\nfrom apap.models import *\nadmin.site.register(Doggo)\nadmin.site.register(Prof...
[ 0, 1, 2, 3 ]
import time from numba import njit import scipy.sparse as sparse import scipy.sparse.linalg as sparse_alg L = 12 Nup = 6 Ndown = 6 t = -2.0 U = 10.0 hoppings = [(i, j, t) for i in range(L) for j in range(L) if abs(i - j) == 1] @njit def hammingWeight(n): res = 0 for i in range(32): if n & (1 << i): ...
normal
{ "blob_id": "325cc2fd82c44d0b7e291384159bd48d068e60f1", "index": 1428, "step-1": "<mask token>\n\n\n@njit\ndef hammingWeight(n):\n res = 0\n for i in range(32):\n if n & 1 << i:\n res += 1\n return res\n\n\n@njit\ndef getStates():\n spinUpStates = [i for i in range(1 << L) if hammin...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Post(models.Model): class Meta: db_table = 'bl_post' <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Content(mo...
flexible
{ "blob_id": "34a523b31e5567d2a8aec95c5820792d1ae80892", "index": 5335, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n\n\n class Meta:\n db_table = 'bl_post'\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Content(models.Mo...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 26 18:39:26 2020 @author: Fanny Fredriksson and Karen Marie Sandø Ambrosen """ import numpy as np import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm #count ffor loops import math from sklearn.model_selection import GridSearch...
normal
{ "blob_id": "69511933697905fb4f365c895264596f19dc1d8d", "index": 5021, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef leaveKout_CV(X, y, n_scz_te, rep, perms, classifiers, parameters, count,\n freq_bands, x_size, auc, nz_coef_idx, nz_coef_val, n_BAitaSig=None):\n \"\"\"\n Calculates the ...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def main(): if len(sys.argv) < 2: print('prosze podac plik') sys.exit() fileName = sys.argv[1] matrix = [] ReadFile(matrix, fileName) Prim(matrix, 0) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ReadF...
flexible
{ "blob_id": "56b8b9884b8500ff70f59058484c4a351b709311", "index": 3517, "step-1": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 2:\n print('prosze podac plik')\n sys.exit()\n fileName = sys.argv[1]\n matrix = []\n ReadFile(matrix, fileName)\n Prim(matrix, 0)\n\n\n<mask token>\n"...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/python import os import psycopg2 import datetime import time import json import decimal import requests import csv import asyncio from config import get_connection, get_db_sql, get_sql_record_count, CORP_TYPES_IN_SCOPE, corp_num_with_prefix, bare_corp_num from orgbook_data_load import ( get_orgbook_all...
normal
{ "blob_id": "cdb49af584ae7befcaebfd9bb303073c8229667e", "index": 3433, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def process_credential_queue():\n print(\"Get exported wallet id's from agent\", datetime.datetime.now())\n agent_wallet_ids = get_agent_wallet_ids()\n print(\"# wallet...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for l in list1: array = np.array(l) tolist = array.tolist() tolist.insert(0, 'ppp') tolist.append('lll') mysql_data.append(tolist) print(mysql_data) <|reserved_special_token_0|> print(get.text) <|reserved_spe...
flexible
{ "blob_id": "896d836ede533bad24f4077e5ba964105d96bf7a", "index": 9485, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor l in list1:\n array = np.array(l)\n tolist = array.tolist()\n tolist.insert(0, 'ppp')\n tolist.append('lll')\n mysql_data.append(tolist)\nprint(mysql_data)\n<mask token...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def LemNormalize(text): return nltk.word_tokenize(text.lower().translate(remove_punct_dict)) <|reserved_special_token_0|> def greeting(sentence): for word in sentence.split(): if word.lower() in GREETING_INPUTS: return random.choice(GREETING_RESPONSE) def...
flexible
{ "blob_id": "53b56cf9265a658d999388f0a1e03d7ceb186213", "index": 2836, "step-1": "<mask token>\n\n\ndef LemNormalize(text):\n return nltk.word_tokenize(text.lower().translate(remove_punct_dict))\n\n\n<mask token>\n\n\ndef greeting(sentence):\n for word in sentence.split():\n if word.lower() in GREET...
[ 3, 4, 5, 6, 7 ]
c_horas=int(input("Ingrese la cantidad de horas trabajadas:")) v_horas=int(input("Ingrese el valor de cada hora trabajada:")) sueldo=c_horas*v_horas print("Su sueldo mensual sera") print(sueldo)
normal
{ "blob_id": "2e4b47b8c3ac4f187b32f1013a34c3bea354b519", "index": 6817, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Su sueldo mensual sera')\nprint(sueldo)\n", "step-3": "c_horas = int(input('Ingrese la cantidad de horas trabajadas:'))\nv_horas = int(input('Ingrese el valor de cada hora trabaj...
[ 0, 1, 2, 3 ]
''' Created on Nov 1, 2013 @author: hanchensu ''' from numpy import * import numpy as np def smoSimple(dataMatIn, classLabels, C, toler, maxIter): dataMatrix = mat(dataMatIn); labelMat = mat(classLabels).transpose() b = 0; m,n = shape(dataMatrix) matrix = mat([[1,2],[3,4],[5,6]]) m,n= shape(matrix) matA = mat...
normal
{ "blob_id": "9bf8834b12bcace0f6daf64adae1babe78bb04fa", "index": 5553, "step-1": "'''\nCreated on Nov 1, 2013\n\n@author: hanchensu\n'''\nfrom numpy import *\nimport numpy as np\n\ndef smoSimple(dataMatIn, classLabels, C, toler, maxIter):\n dataMatrix = mat(dataMatIn); labelMat = mat(classLabels).transpose()\n ...
[ 0 ]
# encoding = utf-8 import hmac import time from hashlib import sha1 def get_signature(now_): # 签名由clientId,grantType,source,timestamp四个参数生成 h = hmac.new( key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'), digestmod=sha1) grant_type = 'password' client_id = 'c3cef7c66a1843f8b3a9e6a...
normal
{ "blob_id": "757a69f9ceaa3434c6d9f8b1fcdbadd991190f29", "index": 9315, "step-1": "<mask token>\n\n\ndef get_signature(now_):\n h = hmac.new(key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'),\n digestmod=sha1)\n grant_type = 'password'\n client_id = 'c3cef7c66a1843f8b3a9e6a1e3160e20'\n sou...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MemoryCache: def __init__(self, store_key_getter=None, limit=0): self.store_key_getter = store_key_getter self.limit = limit self._cache = {} self.hashing = get_optimized_hashing() @property def store(self): if self.store_key_get...
flexible
{ "blob_id": "ef5c51a5c706387b62ef3f40c7cadf7dbef6d082", "index": 8671, "step-1": "<mask token>\n\n\nclass MemoryCache:\n\n def __init__(self, store_key_getter=None, limit=0):\n self.store_key_getter = store_key_getter\n self.limit = limit\n self._cache = {}\n self.hashing = get_opt...
[ 6, 7, 8, 9, 10 ]
''' 多线程更新UI数据(在两个线程中传递数据) ''' from PyQt5.QtCore import QThread , pyqtSignal, QDateTime from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit import time import sys class BackendThread(QThread): update_date = pyqtSignal(str) def run(self): while True: data = QDateTime.current...
normal
{ "blob_id": "ec625bf57388281b3cbd464459fc3ad1c60b7db9", "index": 3305, "step-1": "<mask token>\n\n\nclass BackendThread(QThread):\n <mask token>\n\n def run(self):\n while True:\n data = QDateTime.currentDateTime()\n currentTime = data.toString('yyyy-MM-dd hh:mm:ss')\n ...
[ 6, 7, 8, 9, 10 ]
#!/usr/bin/python import socket import threading import signal import sys class Proxy: #initialise server socket def __init__(self): self.serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1...
normal
{ "blob_id": "2dcf0466c84c952c60dcfce86498f063f43726f3", "index": 2298, "step-1": "#!/usr/bin/python\n\nimport socket\nimport threading\nimport signal\nimport sys\n \nclass Proxy:\n #initialise server socket\n def __init__(self): \n self.serverSocket = socket.socket(socket.AF_INET, socket.SOCK...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from ..translators.translator import Translator
flexible
{ "blob_id": "ab844143ceddf32982682f5092762af0c97db577", "index": 391, "step-1": "<mask token>\n", "step-2": "from ..translators.translator import Translator\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
#Print table using while loop tablenumber = int(input("Enter a number: ")) upperlimit = int(input("Enter a upper limit: ")) lowerlimit = int(input("Enter a lower limit: ")) i = upperlimit while (i <= lowerlimit): print (i,"*",tablenumber,"=",i*tablenumber) i=i+1 print("========================================...
normal
{ "blob_id": "e2c69191d81724cac44bebba3111a773e408b7c8", "index": 639, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i <= lowerlimit:\n print(i, '*', tablenumber, '=', i * tablenumber)\n i = i + 1\nprint('=======================================================')\n<mask token>\nfor foreachnumb...
[ 0, 1, 2, 3 ]
import streamlit as st import tensorflow.keras from PIL import Image, ImageOps import numpy as np st.set_option('deprecation.showfileUploaderEncoding', False) np.set_printoptions(suppress=True) model = tensorflow.keras.models.load_model('keras_model.h5') data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32) st.ti...
normal
{ "blob_id": "746e0895f0fb971156e778cbff20317cc88441f1", "index": 2059, "step-1": "<mask token>\n", "step-2": "<mask token>\nst.set_option('deprecation.showfileUploaderEncoding', False)\nnp.set_printoptions(suppress=True)\n<mask token>\nst.title('Leaf Disease Detection Using Machine Learning')\n<mask token>\nif...
[ 0, 1, 2, 3, 4 ]
""" Supreme bot???? """ import os import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait import selenium.webdriver.support.expected_conditions as EC from selenium.common.exceptions import TimeoutException from selenium.webdriver.ch...
normal
{ "blob_id": "8fed95cf809afca7b6008d5abcdcf697367a33c2", "index": 2929, "step-1": "\"\"\"\nSupreme bot????\n\n\"\"\"\nimport os\nimport time\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nimport selenium.webdriver.support.expe...
[ 0 ]
from __future__ import annotations import logging import os import sys from argparse import Namespace from pathlib import Path from uuid import uuid4 import pytest from virtualenv.discovery.builtin import Builtin, get_interpreter from virtualenv.discovery.py_info import PythonInfo from virtualenv.info import fs_supp...
normal
{ "blob_id": "55d4f4bba2b72ec93cb883527d2a9c2ebe8ec337", "index": 4910, "step-1": "<mask token>\n\n\ndef test_relative_path(session_app_data, monkeypatch):\n sys_executable = Path(PythonInfo.current_system(app_data=\n session_app_data).system_executable)\n cwd = sys_executable.parents[1]\n monkeyp...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SaisonCulturelle(Saison): def __unicode__(self): return self.nom class Festival(Saison): saison_culture = models.ForeignKey(SaisonCulturelle) def __unicode__(self): return self.nom class TypeEvenement(models.Model): nom = models.CharField(max_le...
flexible
{ "blob_id": "596fe474ae60dd6a06123df6fe246f7e947b3482", "index": 1760, "step-1": "<mask token>\n\n\nclass SaisonCulturelle(Saison):\n\n def __unicode__(self):\n return self.nom\n\n\nclass Festival(Saison):\n saison_culture = models.ForeignKey(SaisonCulturelle)\n\n def __unicode__(self):\n ...
[ 30, 33, 34, 36, 39 ]
<|reserved_special_token_0|> class TestRedisIntervalIADD(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestRedisIntervalIADD(object): <|reserved_special_token_0|> @classmethod ...
flexible
{ "blob_id": "0e7732ffcada864fb83b59625c5b9abb01150aaa", "index": 1702, "step-1": "<mask token>\n\n\nclass TestRedisIntervalIADD(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestRedisIntervalIADD(object):\n <mask token>\n\n @classmethod\n def set...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def show(a): for i in range(len(a)): for j in range(len(a[i])): print(a[i][j], end=' ') print() def askUserZero(): while True: inputX = input('Введите номер строки нолика') inputY = input('Введите номер столбца нолика') if inpu...
flexible
{ "blob_id": "3f22bf954a8c4608ec4bd4a28bea3679a664a99a", "index": 2364, "step-1": "<mask token>\n\n\ndef show(a):\n for i in range(len(a)):\n for j in range(len(a[i])):\n print(a[i][j], end=' ')\n print()\n\n\ndef askUserZero():\n while True:\n inputX = input('Введите номер с...
[ 3, 4, 5, 6, 7 ]
import wx from six import print_ import os FONTSIZE = 10 class TextDocPrintout(wx.Printout): """ A printout class that is able to print simple text documents. Does not handle page numbers or titles, and it assumes that no lines are longer than what will fit within the page width. Those features a...
normal
{ "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 ]
from flask import ( Flask, render_template, request ) import requests app = Flask(__name__) base_url = "https://api.github.com/users/" @app.route("/", methods = ["GET", "POST"]) def index(): if request.method == "POST": githubName = request.form.get("githubname") responseUser = request...
normal
{ "blob_id": "62094d036596f39e7cf936fe7a91e67d53ee055e", "index": 9557, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef index():\n if request.method == 'POST':\n githubName = request.form.get('githubname')\n responseUser = requests.get('{}{...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestAccountsViews(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_logout_view(self): response = self.client.get(reverse('accounts:logout')) self.assertEqual(response.status_code, 302) <|reserved_special_token_0|> de...
flexible
{ "blob_id": "888a5847beca2470f4063da474da1f05079abca9", "index": 5579, "step-1": "<mask token>\n\n\nclass TestAccountsViews(TestCase):\n <mask token>\n <mask token>\n\n def test_logout_view(self):\n response = self.client.get(reverse('accounts:logout'))\n self.assertEqual(response.status_c...
[ 9, 10, 11, 12, 16 ]
import sys def is_huge(A, B): return (A[0] > B[0]) and (A[1] > B[1]) if __name__ == '__main__': bulks = [] num = int(sys.stdin.readline()) for i in range(num): bulks.append(list(map(int, sys.stdin.readline().split()))) for i in range(len(bulks)): count = 0 for j in range...
normal
{ "blob_id": "5dc8f420e16ee14ecfdc61413f10a783e819ec32", "index": 506, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\nif __nam...
[ 0, 1, 2, 3, 4 ]
from django.db import models from django.utils.text import slugify import misaka from django.urls import reverse from django.contrib.auth import get_user_model from django import template register=template.Library() User=get_user_model() #call things out of users current session # Create your models here. class G...
normal
{ "blob_id": "51563f52e700a286451663a6e837d56e104c2c72", "index": 2849, "step-1": "<mask token>\n\n\nclass Group(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name\n <mask token>\n <mask token>\n\n\ncla...
[ 5, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> settings.configure(DEBUG=True, SECRET_KEY= 'ki==706e99f0ps9w5s*!kx%1^=5jq_k1c&4r@#e&ng9=xlm5_', ROOT_URLCONF= 'sitebuilder.urls', MIDDLEWARE_CLASSES=(), INSTALLED_APPS=( 'django.contrib.staticfiles', 'django.contrib.we...
flexible
{ "blob_id": "d30e5e24dd06a4846fdde3c9fcac0a5dac55ad0d", "index": 5916, "step-1": "<mask token>\n", "step-2": "<mask token>\nsettings.configure(DEBUG=True, SECRET_KEY=\n 'ki==706e99f0ps9w5s*!kx%1^=5jq_k1c&4r@#e&ng9=xlm5_', ROOT_URLCONF=\n 'sitebuilder.urls', MIDDLEWARE_CLASSES=(), INSTALLED_APPS=(\n 'd...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import io import urllib.request from pymarc import MARCReader class Item: """ Represents an item from our Library catalogue (https://www-lib.soton.ac.uk) Usage: #>>> import findbooks #>>> item = findbooks.Item('12345678') #>>> item.getMarcFields() ...
normal
{ "blob_id": "abfff0901e5f825a473119c93f53cba206609428", "index": 7482, "step-1": "<mask token>\n\n\nclass Item:\n <mask token>\n <mask token>\n\n def __init__(self, barcode):\n self.barcode = barcode\n self.marc = None\n self.record = None\n self.title = None\n self.au...
[ 6, 7, 8, 11, 12 ]
# -*- coding: utf-8 -*- import re import argparse import utils # Les arguments à fournir en ligne de commande parser = argparse.ArgumentParser(description="""Génère le graph des articles""") parser.add_argument('corpus', type=str, help="Le nom du corpus (sans l'extension .tsv')") parser.add_argument('-v', '--verbose...
normal
{ "blob_id": "a2593d5b89b9a35d91b0e1011f5b2a23a5a2062e", "index": 2792, "step-1": "# -*- coding: utf-8 -*-\n\nimport re\nimport argparse\n\nimport utils\n\n# Les arguments à fournir en ligne de commande\nparser = argparse.ArgumentParser(description=\"\"\"Génère le graph des articles\"\"\")\nparser.add_argument('c...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> f.close() print(cl.classify('Where to travel in bangalore ?')) print(cl.classify('Name a golf course in Myrtle beach .')) print(cl.classify('What body of water does the Danube River flow into ?')) print(time.time() - start) <|re...
flexible
{ "blob_id": "82a3fca0261b4bde43f7bf258bb22e5b2ea8c28d", "index": 5370, "step-1": "<mask token>\n", "step-2": "<mask token>\nf.close()\nprint(cl.classify('Where to travel in bangalore ?'))\nprint(cl.classify('Name a golf course in Myrtle beach .'))\nprint(cl.classify('What body of water does the Danube River fl...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def getLinks(url): links = [] document = BeautifulSoup(response, 'html.parser') for element in document.findAll('a', href=re.compile('.pdf$')): links.append(element.get('href')) return links <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_...
flexible
{ "blob_id": "dbb007af79b2da2b5474281759c2bcce2a836fb5", "index": 1254, "step-1": "<mask token>\n\n\ndef getLinks(url):\n links = []\n document = BeautifulSoup(response, 'html.parser')\n for element in document.findAll('a', href=re.compile('.pdf$')):\n links.append(element.get('href'))\n return...
[ 1, 2, 3, 4, 5 ]
""" r - reading fike w - writing to file a - append to file / add to the end of the file - always at the end r+ - read and write to file (writing based on python cursor position) -> by default at the beginning of file -> won't insert and shift things over, will overwrite the contents. -> r+ can only be used with alread...
normal
{ "blob_id": "cde2454c68a0d6a0c86b7d647e41a86d3aa97a0d", "index": 8267, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('haiku.txt', 'w') as file:\n file.write('This is the line 1 of the haiku\\n')\n file.write('Following the line 2 of the haiku\\n')\n file.write('Finishing off with the ...
[ 0, 1, 2 ]
""" SteinNS: BayesianLogisticRegression_KSD.py Created on 10/9/18 6:25 PM @author: Hanxi Sun """ import tensorflow as tf import numpy as np import scipy.io from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt ########################################################################...
normal
{ "blob_id": "a0a9527268fb5f8ea24de700f7700b874fbf4a6b", "index": 4838, "step-1": "<mask token>\n\n\ndef S_q(theta, a0=1, b0=0.01):\n w = theta[:, :-1]\n s = tf.reshape(theta[:, -1], shape=[-1, 1])\n y_hat = 1.0 / (1.0 + tf.exp(-tf.matmul(Xs, tf.transpose(w))))\n y = tf.reshape((ys + 1.0) / 2.0, shape...
[ 4, 5, 7, 8, 11 ]
<|reserved_special_token_0|> def leerNumero(): numer = int(input('Escribe un numero ==> ')) primo(numer) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def leerNumero(): numer = int(input('Escribe un numero ==> ')) primo(numer) def main(): leerNumer...
flexible
{ "blob_id": "29eb1a1642d38160c138733e269bb3ba0c5d4bba", "index": 9834, "step-1": "<mask token>\n\n\ndef leerNumero():\n numer = int(input('Escribe un numero ==> '))\n primo(numer)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef leerNumero():\n numer = int(input('Escribe un numero ==> '))\n p...
[ 1, 2, 3, 4, 5 ]
"""" articulo cliente venta ventadet """ class Articulo: def __init__(self,cod,des,pre,stoc): self.codigo=cod self.descripcion = des self.precio=pre self.stock=stoc class ventaDetalle: def __init__(self,pro,pre,cant): self.producto=pro sel...
normal
{ "blob_id": "f70f66926b9e2bf8b387d481263493d7f4c65397", "index": 516, "step-1": "<mask token>\n\n\nclass ventaDetalle:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ventaDetalle:\n\n def __init__(self, pro, pre, cant):\n self.producto = pro\n self.precio = pre\n self.cantidad...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class invites(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_...
flexible
{ "blob_id": "192e789129a51aa646a925fc4f8c3f8f4e14d478", "index": 7988, "step-1": "<mask token>\n\n\nclass invites(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 ...
[ 13, 16, 18, 22, 24 ]
#!/usr/bin/env python # coding:utf-8 import time from SocketServer import (TCPServer as TCP, StreamRequestHandler as SRH) HOST = '127.0.0.1' PORT = 8888 BUFSIZE = 1024 ADDR = (HOST, PORT) class MyRequestHandler(SRH): def handle(self): print '...connected from :', self.client_addr...
normal
{ "blob_id": "377143635939cf113e4188b5c4f55cec068a17b1", "index": 4171, "step-1": "#!/usr/bin/env python\n# coding:utf-8\nimport time\nfrom SocketServer import (TCPServer as TCP,\n StreamRequestHandler as SRH)\n\nHOST = '127.0.0.1'\nPORT = 8888\nBUFSIZE = 1024\nADDR = (HOST, PORT)\n\nclas...
[ 0 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 11 14:55:12 2019 @author: Furankyyy """ import numpy as np import matplotlib.pyplot as plt import timeit ###worst sort function### #define the function that checks whether the list is in ascending order def right_permutation(arr): if len(arr)=...
normal
{ "blob_id": "7c82565a4184b2e779e2bb6ba70b497cc287af35", "index": 5285, "step-1": "<mask token>\n\n\ndef right_permutation(arr):\n if len(arr) == 1:\n return True\n for i in range(len(arr) - 1):\n if arr[i + 1] < arr[i]:\n break\n elif i == len(arr) - 2:\n return T...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class WeatherToMusicConverter: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "c846c33ef13795d51c6d23ffa5a6b564b66e6a3c", "index": 3438, "step-1": "<mask token>\n\n\nclass WeatherToMusicConverter:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass WeatherToMusicConverter:\n <ma...
[ 1, 4, 5, 6, 7 ]
<|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": "c382b298cce8d7045d6ce8a84f90b3800dba7717", "index": 297, "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', '...
[ 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": "d45ca839a24093266c48e5f97164b160190b154d", "index": 2133, "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 = [('django_otp'...
[ 0, 1, 2, 3, 4 ]
def ex7(*siruri, x=1, flag=True): res = () for sir in siruri: chars = [] for char in sir: if ord(char) % x == (not flag): chars.append(char) res += (chars,) return res print(ex7("test", "hello", "lab002", x=2, flag=False))
normal
{ "blob_id": "90a402cccf383ed6a12b70ecdc3de623e6e223f9", "index": 8365, "step-1": "<mask token>\n", "step-2": "def ex7(*siruri, x=1, flag=True):\n res = ()\n for sir in siruri:\n chars = []\n for char in sir:\n if ord(char) % x == (not flag):\n chars.append(char)\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TaobaoSpider(Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class...
flexible
{ "blob_id": "8f709af924820c77290f97731d9f96258c3db095", "index": 2533, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TaobaoSpider(Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TaobaoSpider(Spider):\n <mask token>\n ...
[ 0, 1, 2, 3, 4 ]
"""Usage: sharedprint.py INPUT [--output=out.mrc] sharedprint.py INPUT [--csv=greenglass.csv] Process Koha MARC export for SCELC Shared Print. The two uses above either 1) create a subset of the MARC input that's limited to circulating items only or 2) performs a comparison between what's in the catalog and w...
normal
{ "blob_id": "c6cce2edafd7683af766b932d90ca170359e648a", "index": 679, "step-1": "<mask token>\n\n\ndef main():\n total_count = 0\n valid_count = 0\n with open(options['INPUT'], 'rb') as fh:\n reader = MARCReader(fh, to_unicode=True, force_utf8=True)\n if not options['--csv']:\n ...
[ 1, 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': sentence_url = 'http://www.manythings.org/anki/deu-eng.zip' r = requests.get(sentence_url) z = ZipFile(io.BytesIO(r.content)) file = z.read('deu.txt') eng_ger_data = file.decode() ...
flexible
{ "blob_id": "559c665e5544dd864d2f020c967ac8a8665af134", "index": 6805, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n sentence_url = 'http://www.manythings.org/anki/deu-eng.zip'\n r = requests.get(sentence_url)\n z = ZipFile(io.BytesIO(r.content))\n file = z.read(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ID = '113' TITLE = 'Path Sum II' DIFFICULTY = 'Medium' URL = 'https://oj.leetcode.com/problems/path-sum-ii/' BOOK = False PROBLEM = """Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given...
flexible
{ "blob_id": "9a62a57f6d9af7ef09c8ed6e78a100df7978da6e", "index": 8631, "step-1": "<mask token>\n", "step-2": "ID = '113'\nTITLE = 'Path Sum II'\nDIFFICULTY = 'Medium'\nURL = 'https://oj.leetcode.com/problems/path-sum-ii/'\nBOOK = False\nPROBLEM = \"\"\"Given a binary tree and a sum, find all root-to-leaf paths...
[ 0, 1, 2 ]
import numpy as np import cv2 print("read imafe from file" ) img = cv2.imread("panda.jpg") print("create a window holder for the image") cv2.namedWindow("Image",cv2.WINDOW_NORMAL) print ('display the image ') cv2.imshow("Image",img) print ('press a key inside the image to make a copy') cv2.waitKey(0)
normal
{ "blob_id": "7cf6a4b8057280b38572dd92693013724751c47f", "index": 9502, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('read imafe from file')\n<mask token>\nprint('create a window holder for the image')\ncv2.namedWindow('Image', cv2.WINDOW_NORMAL)\nprint('display the image ')\ncv2.imshow('Image', i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def hello(): return render_template('index.html') @app.route('/', methods=['POST']) def func(): st = request.form['review'] if st == '': return render_template('index.html') english = spacy.load('en_core_web_sm') result = english(st) sente...
flexible
{ "blob_id": "2d7f7cb66480ecb8335949687854554679026959", "index": 9988, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return render_template('index.html')\n\n\n@app.route('/', methods=['POST'])\ndef func():\n st = request.form['review']\n if st == '':\n return render_template('index...
[ 4, 5, 6, 7, 8 ]
import json import os from flask import Flask, request, url_for from flask_cors import CORS from werkzeug.utils import secure_filename from service.Binarizacion import Binarizacion UPLOAD_FOLDER = './public/files' app = Flask(__name__) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER CORS(app) @app.route('/') def hell...
normal
{ "blob_id": "b9c8689dbdf451e6a981f1abdae55771266fe231", "index": 9129, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return 'Hello word'\n\n\n@app.route('/analyze', methods=['POST'])\ndef analyze():\n if request.method == 'POST':\n image_file = request.files['image']\n file_nam...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- import numpy as np import pickle import os import feature_extraction #import topic file1 = open('vecdict_all.p', 'r') file2 = open('classif_all.p','r') vec = pickle.load(file1) classifier = pickle.load(file2) file1.close() file2.close() #sentence = "I never miss the lecture of Dan Moldovan...
normal
{ "blob_id": "1d1576825f80c3b65ce1b7f8d1daccbbf8543d7d", "index": 8294, "step-1": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nimport pickle\nimport os\nimport feature_extraction\n#import topic\n\n\nfile1 = open('vecdict_all.p', 'r')\nfile2 = open('classif_all.p','r')\n\nvec = pickle.load(file1)\nclassifier = ...
[ 0 ]
<|reserved_special_token_0|> class SGD(BasicOptimizer): <|reserved_special_token_0|> def __init__(self, iterations: int, circuit: BasicCircuit, learning_rate: float): """The constructor of the SGD class Args: iterations (int): Number of iterations circuit (Bas...
flexible
{ "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|> def cut_frames(data): pass <|reserved_special_token_1|> <|reserved_special_token_0|> def mfcc(data): pass def cut_frames(data): pass <|reserved_special_token_1|> import numpy as np import tensorflow as tf ...
flexible
{ "blob_id": "8411acf6b27425357d212f5e220314daa019e023", "index": 9669, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cut_frames(data):\n pass\n", "step-3": "<mask token>\n\n\ndef mfcc(data):\n pass\n\n\ndef cut_frames(data):\n pass\n", "step-4": "import numpy as np\nimport tensorflo...
[ 0, 1, 2, 3 ]
from numpy import* a=int(input('numero: ')) b='*' c='o' for i in range(a): d=(b*(a-i))+(c*(a-(a-i)))+(c*(a-(a-i)))+(b*(a-i)) print(d)
normal
{ "blob_id": "155b243ad7d93bcf2b74cd5b2bd3409ab7ec7473", "index": 8488, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(a):\n d = b * (a - i) + c * (a - (a - i)) + c * (a - (a - i)) + b * (a - i)\n print(d)\n", "step-3": "<mask token>\na = int(input('numero: '))\nb = '*'\nc = 'o'\nfo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if 1 in string: string.remove(1) <|reserved_special_token_0|> string.remove(string[0]) <|reserved_special_token_0|> while string != []: tar = 0 length = len(string) i = 0 while i < len(string): cout = 0...
flexible
{ "blob_id": "6a8cab1fceffa0d70441cc600137417a8b81d7b1", "index": 6897, "step-1": "<mask token>\n", "step-2": "<mask token>\nif 1 in string:\n string.remove(1)\n<mask token>\nstring.remove(string[0])\n<mask token>\nwhile string != []:\n tar = 0\n length = len(string)\n i = 0\n while i < len(strin...
[ 0, 1, 2, 3 ]
import random import string import datetime from app import db from dateutil.parser import parse as date_parse from flask_security import UserMixin, RoleMixin roles_users = db.Table('roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('users.id')), db.Column('role_id', db.Integer(), db.Forei...
normal
{ "blob_id": "06b07045fcfafd174bb78ff5c3a36bed11e36e54", "index": 9616, "step-1": "<mask token>\n\n\nclass Studies(db.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\n d...
[ 42, 44, 53, 54, 60 ]
# -*- coding: utf-8 -*- import json import re import scrapy from scrapy import Request class PageInfoAjaxSpider(scrapy.Spider): name = 'page_info_ajax' allowed_domains = ['bilibili.com'] # start_urls = ['http://bilibili.com/'] headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x6...
normal
{ "blob_id": "cdcb2710291e9897b874f63840193470ed58be49", "index": 825, "step-1": "<mask token>\n\n\nclass PageInfoAjaxSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://s.search.bilibili.com/cate/search?callback=jque...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> @pytest.fixture def client(): os.environ['FLASK_ENV'] = 'testing' yield get_client() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_client(): from apiserver import app, is_caching_enabled app.config['TESTING'] = True ...
flexible
{ "blob_id": "c0b5a0605bdfcb7cb84211d3ad0d24f78f838cdf", "index": 5421, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef client():\n os.environ['FLASK_ENV'] = 'testing'\n yield get_client()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_client():\n from apiserver import app, is_caching_ena...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('python.jpg', 'rb') as f: data = f.read() <|reserved_special_token_0|> print(r.data.decode()) <|reserved_special_token_1|> <|reserved_special_token_0|> with open('python.jpg', 'rb') as f: data = f.read() http ...
flexible
{ "blob_id": "98dbc6c3bdc3efb4310a2dbb7b1cc1c89eb4582b", "index": 7354, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('python.jpg', 'rb') as f:\n data = f.read()\n<mask token>\nprint(r.data.decode())\n", "step-3": "<mask token>\nwith open('python.jpg', 'rb') as f:\n data = f.read()\nhtt...
[ 0, 1, 2, 3 ]
''' Module for handling configurable portions of tools ''' from json import load default_file_loc = 'config.json' config = None def loadConfiguration(fileloc): '''Loads configuration from file location''' global config with open(fileloc, 'r') as file_: conf = load(file_) if config is None: ...
normal
{ "blob_id": "5261ae90a67e2df8dd1c679a8046ee3e0cbc6221", "index": 3264, "step-1": "<mask token>\n\n\ndef loadConfiguration(fileloc):\n \"\"\"Loads configuration from file location\"\"\"\n global config\n with open(fileloc, 'r') as file_:\n conf = load(file_)\n if config is None:\n config...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': idf = Identifier() while raw_input('Hello!, to start listening press enter, to exit press q\n' ) != 'q': idf.guess() <|reserved_special_token_1|> from application.identifier im...
flexible
{ "blob_id": "d8da01433b2e6adb403fdadc713d4ee30e92c787", "index": 4829, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n idf = Identifier()\n while raw_input('Hello!, to start listening press enter, to exit press q\\n'\n ) != 'q':\n idf.guess()\n", "step-3"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @admin.route('/', methods=['GET']) @login_required def index(): headers = {'Content-Type': 'text/html'} return make_response(render_template('index.html'), headers) <|reserved_special_token_0|> @admin.route('/roles/<role_id>', methods=['GET']) @admin.route('/roles/new', method...
flexible
{ "blob_id": "f5f1a4db33cea8421cb4236606dfb288efee7621", "index": 2142, "step-1": "<mask token>\n\n\n@admin.route('/', methods=['GET'])\n@login_required\ndef index():\n headers = {'Content-Type': 'text/html'}\n return make_response(render_template('index.html'), headers)\n\n\n<mask token>\n\n\n@admin.route(...
[ 2, 3, 4, 5, 6 ]
#!/home/porosya/.local/share/virtualenvs/checkio-VEsvC6M1/bin/checkio --domain=py run inside-block # https://py.checkio.org/mission/inside-block/ # When it comes to city planning it's import to understand the borders of various city structures. Parks, lakes or living blocks can be represented as closed polygon and...
normal
{ "blob_id": "548c4dbfc1456fead75c22927ae7c6224fafeace", "index": 7893, "step-1": "<mask token>\n", "step-2": "def is_inside(polygon, point):\n return True or False\n\n\n<mask token>\n", "step-3": "def is_inside(polygon, point):\n return True or False\n\n\nif __name__ == '__main__':\n assert is_insid...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Window(tk.Tk): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def Get_Current_Player(self) ->str: return self.Handler.Get_Current_Player() <|reserved_special_token_0|> class Pregame(tk.Frame): FrameName = 'Pr...
flexible
{ "blob_id": "9b8f3962172d4a867a3a070b6139bb302fd7e2f5", "index": 9934, "step-1": "<mask token>\n\n\nclass Window(tk.Tk):\n <mask token>\n <mask token>\n <mask token>\n\n def Get_Current_Player(self) ->str:\n return self.Handler.Get_Current_Player()\n <mask token>\n\n\nclass Pregame(tk.Frame...
[ 39, 40, 41, 52, 59 ]
<|reserved_special_token_0|> class FunctionPygameCircle(FunctionExample): def __init__(self, data_len, width=500, height=500, dot_size=5): self.angle = 2 * math.pi / data_len self.width = width self.height = height self.dot_size = dot_size <|reserved_special_token_0|> <|re...
flexible
{ "blob_id": "2faf39f8d12197e20948b2bf4288b7ee406f5b86", "index": 2025, "step-1": "<mask token>\n\n\nclass FunctionPygameCircle(FunctionExample):\n\n def __init__(self, data_len, width=500, height=500, dot_size=5):\n self.angle = 2 * math.pi / data_len\n self.width = width\n self.height = ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def chang_name(name): global school school = 'Mage Linux' print('Before change:', name, school) name = 'Stack Cong' age = 33 print('After change:', name) <|reserved_special_token_0|> <|reserved_specia...
flexible
{ "blob_id": "a9531fb020428e573d189c377652692e301ea4d3", "index": 3026, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef chang_name(name):\n global school\n school = 'Mage Linux'\n print('Before change:', name, school)\n name = 'Stack Cong'\n age = 33\n print('After change:', name)...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(os.path.join(os.path.dirname(__file__), 'storage/robot_list.csv'), 'w') as file: writer = csv.writer(file, delimiter=',') headers = [cell.value for cell in sheet.row(0)] writer.writerow(headers) for i...
flexible
{ "blob_id": "1ef9df43725196904ec6c0c881f4a1204174b176", "index": 375, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(os.path.join(os.path.dirname(__file__), 'storage/robot_list.csv'),\n 'w') as file:\n writer = csv.writer(file, delimiter=',')\n headers = [cell.value for cell in sheet.r...
[ 0, 1, 2, 3, 4 ]
#-*- coding: utf8 -*- #credits to https://github.com/pytorch/examples/blob/master/imagenet/main.py import shutil, time, logging import torch import torch.optim import numpy as np import visdom, copy from datetime import datetime from collections import defaultdict from generic_models.yellowfin import YFOptimizer logg...
normal
{ "blob_id": "be90dcb4bbb69053e9451479990e030cd4841e4a", "index": 1620, "step-1": "#-*- coding: utf8 -*-\n#credits to https://github.com/pytorch/examples/blob/master/imagenet/main.py\nimport shutil, time, logging\nimport torch\nimport torch.optim\nimport numpy as np\nimport visdom, copy\nfrom datetime import date...
[ 0 ]
from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager import time import csv options = Options() # options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Chrome(ChromeDriverManager().install(), ...
normal
{ "blob_id": "8c5815c1dd71b2ae887b1c9b1968176dfceea4f9", "index": 6182, "step-1": "from selenium import webdriver\nfrom selenium.webdriver.chrome.options import Options\nfrom webdriver_manager.chrome import ChromeDriverManager\nimport time\nimport csv\n\noptions = Options()\n# options.add_argument('--headless')\n...
[ 0 ]
import media import fresh_tomatoes toy_story = media.Movie("Toy Story", "A story of a boy and his toys that come to life", '<p><a href="https://en.wikipedia.org/wiki/File:Toy_Story.jpg#/media/File:Toy_Story.jpg"><img src="https://upload.wikimedia.org/wikipedia/en/1/13/To...
normal
{ "blob_id": "e2f6e6e872f95471ebbc8b25bde08247fe8f7e61", "index": 8829, "step-1": "<mask token>\n", "step-2": "<mask token>\nfresh_tomatoes.open_movies_page(movies)\n", "step-3": "<mask token>\ntoy_story = media.Movie('Toy Story',\n 'A story of a boy and his toys that come to life',\n '<p><a href=\"http...
[ 0, 1, 2, 3, 4 ]
from gpiozero import Motor class Car: def __init__(self, speed: float=1): self.speed = speed self.forward_right_motor = Motor(forward=12, backward=16) self.backward_right_motor = Motor(forward=21, backward=20) self.forward_left_motor = Motor(forward=23, backward=18) self.b...
normal
{ "blob_id": "6bf1a0fbf65895eac9baa71bc5e04e861f0a3ed5", "index": 4190, "step-1": "<mask token>\n\n\nclass Car:\n\n def __init__(self, speed: float=1):\n self.speed = speed\n self.forward_right_motor = Motor(forward=12, backward=16)\n self.backward_right_motor = Motor(forward=21, backward=...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> channel_routing = [route('slack.rtm.message', message_consumer)] <|reserved_special_token_1|> from channels.routing import route from .consumers import message_consumer channel_routing = [route('slack.rtm.message', message_cons...
flexible
{ "blob_id": "8439972b4458ba66d98f6a80a82a35576df472a4", "index": 8096, "step-1": "<mask token>\n", "step-2": "<mask token>\nchannel_routing = [route('slack.rtm.message', message_consumer)]\n", "step-3": "from channels.routing import route\nfrom .consumers import message_consumer\nchannel_routing = [route('sl...
[ 0, 1, 2, 3 ]
import bcrypt as bcrypt from config.configuration import Configuration class Usuario(Configuration.db.Model): __tablename__ = "usuario" id = Configuration.db.Column(Configuration.db.BIGINT, primary_key=True, autoincrement=True) code = Configuration.db.Column(Configuration.db.String(80), unique=True, nul...
normal
{ "blob_id": "598a0771dd1447034f2db95c67dd0dcf968f43a7", "index": 8229, "step-1": "<mask token>\n\n\nclass Usuario(Configuration.db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<Usuario %r>' % self.i...
[ 8, 10, 12, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> seconds_per_unit_time = 0.01 pars_spont = {'tau_p': 2.5, 'tau_d': 5.0, 'amp_p': 0.08, 'amp_d': -0.0533, 'rho': 0.0015, 'N': 50, 'w_max': 0.05, 'mu': 0.07, 'seed': None, 'tend': 50000000, 'r_in': 0.04, 'w_in': 0.05, 'init_W': 'random', 'init_scale': 0....
flexible
{ "blob_id": "8f17c1ed0cb273a88b986cd7fe7a45439211d536", "index": 8641, "step-1": "<mask token>\n", "step-2": "seconds_per_unit_time = 0.01\npars_spont = {'tau_p': 2.5, 'tau_d': 5.0, 'amp_p': 0.08, 'amp_d': -0.0533,\n 'rho': 0.0015, 'N': 50, 'w_max': 0.05, 'mu': 0.07, 'seed': None, 'tend':\n 50000000, 'r_...
[ 0, 1, 2 ]
<|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": "4aefabf064cdef963f9c62bd5c93892207c301d3", "index": 3076, "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 = [('historiasCl...
[ 0, 1, 2, 3, 4 ]
import plotly.figure_factory as ff import pandas as pd import csv df=pd.read_csv("phone.csv") fig=ff.create_distplot([df["Avg Rating"].tolist()],["Samsung"],show_hist=False) fig.show()
normal
{ "blob_id": "5ae4f489da7b4f0913c9b16c86cc60537cc51234", "index": 9858, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.show()\n", "step-3": "<mask token>\ndf = pd.read_csv('phone.csv')\nfig = ff.create_distplot([df['Avg Rating'].tolist()], ['Samsung'],\n show_hist=False)\nfig.show()\n", "step-4...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def ridge_orient(im, gradientsigma, blocksigma, orientsmoothsigma): sze = np.fix(6 * gradientsigma) if np.remainder(sze, 2) == 0: sze = sze + 1 gauss = cv2.getGaussianKernel(np.int(sze), gradientsigma) f = gauss * gauss.T fy, fx = np.gradient(f) Gx = signal...
flexible
{ "blob_id": "9447d0d0481df3d0ee4273256d02977bc8044e4e", "index": 8603, "step-1": "<mask token>\n\n\ndef ridge_orient(im, gradientsigma, blocksigma, orientsmoothsigma):\n sze = np.fix(6 * gradientsigma)\n if np.remainder(sze, 2) == 0:\n sze = sze + 1\n gauss = cv2.getGaussianKernel(np.int(sze), gr...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('START') <|reserved_special_token_0|> print(' - Imports data and formats the data') <|reserved_special_token_0|> timeseries_to_supervised(df_train, n_past, n_future) <|reserved_special_token_0|> if with_without == 'with trai...
flexible
{ "blob_id": "ec6067cc86b6ac702123d13911cc4ab97be6a857", "index": 4077, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('START')\n<mask token>\nprint(' - Imports data and formats the data')\n<mask token>\ntimeseries_to_supervised(df_train, n_past, n_future)\n<mask token>\nif with_without == 'with tra...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NFO: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self) ->str: return '<{c} {attrs}>'.format(c=self.__class__.__name__, attrs=' '. ...
flexible
{ "blob_id": "e434d5519e3ba4255ed928769070de391cb0955b", "index": 3462, "step-1": "<mask token>\n\n\nclass NFO:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self) ->str:\n return '<{c} {attrs}>'.format(c=self.__class__.__name__, attrs=' '.\n ...
[ 14, 16, 18, 19, 22 ]
import typing from rest_framework.exceptions import ValidationError from rest_framework.request import Request def extract_organization_id_from_request_query(request): return request.query_params.get('organization') or request.query_params.get('organization_id') def extract_organization_id_from_request_data(re...
normal
{ "blob_id": "0b7523035fdad74454e51dc9da9fc4e9bea2f6bf", "index": 6904, "step-1": "<mask token>\n\n\ndef extract_field_from_request(request: Request, field_name: str\n ) ->typing.Optional[int]:\n \"\"\"\n Extracts attribte from request\n if attribute is present in data it has precedence over query par...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dol_001.set_description('dolen do mivkata') dol_001.rendModul() <|reserved_special_token_0|> dol_002.set_description('долен втори с 2 врати') dol_002.rendModul() <|reserved_special_token_1|> <|reserved_special_token_0|> st = Pe...
flexible
{ "blob_id": "3d10f8810594303beb0ccabce3497de86149b2e5", "index": 6666, "step-1": "<mask token>\n", "step-2": "<mask token>\ndol_001.set_description('dolen do mivkata')\ndol_001.rendModul()\n<mask token>\ndol_002.set_description('долен втори с 2 врати')\ndol_002.rendModul()\n", "step-3": "<mask token>\nst = P...
[ 0, 1, 2, 3, 4 ]
import webbrowser as wb points = 0 import time as t import pyautogui as pg name = pg.prompt("What is your name? ").title() pg.alert(name) if name == "Caroline": pg.alert ("Hi " + name) points += 5 t.sleep(1) wb.open ("https://www.textgiraffe.com/Caroline/Page2/") elif name == "Bob": ...
normal
{ "blob_id": "16e10db90a0a0d8ee7ca5b0c7f86cc81432d87d1", "index": 4391, "step-1": "<mask token>\n", "step-2": "<mask token>\npg.alert(name)\nif name == 'Caroline':\n pg.alert('Hi ' + name)\n points += 5\n t.sleep(1)\n wb.open('https://www.textgiraffe.com/Caroline/Page2/')\nelif name == 'Bob':\n p...
[ 0, 1, 2, 3, 4 ]
# 파이썬 딕셔너리 # 범용적으로 가장 많이 사용되는 타입 # key와 value의 대용관계 type # 순서 X, key 중복 X, 수정 O, 삭제 O # {} # class란 실세계(오브젝트)의 명사,동사적인 특징들을 추상화시키는 것, 즉 프로그램 내 인스턴트(객체)를 추출하는 템플릿이다 # class는 틀이고 인스턴스는 틀에의해 만들어지는 결과물.하여 instance.class()로 표현 #temp = {} #print(type(temp)) dic01 = {'name' : 'seop', 'age' : 48, ...
normal
{ "blob_id": "d1077107a5cd3a9f489f74b030a698b0521841f3", "index": 7721, "step-1": "<mask token>\n", "step-2": "dic01 = {'name': 'seop', 'age': 48, 'address': 'seoul', 'birth': '730919',\n 'gender': True}\ndic02 = dict([('name', 'seop'), ('age', 48), ('address', 'seoul'), ('birth',\n '730919'), ('gender', ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def load(): with open(filename.get()) as file: contents.delete('1.0', END) contents.insert(INSERT, file.read()) def save(): with open(filename.get(), 'w') as file: file.write(contents.get('1.0', END)) <|reserved_special_token_0|> <|reserved_special_to...
flexible
{ "blob_id": "fcf4cb5c47e4aa51d97b633ecdfec65246e82bd8", "index": 9011, "step-1": "<mask token>\n\n\ndef load():\n with open(filename.get()) as file:\n contents.delete('1.0', END)\n contents.insert(INSERT, file.read())\n\n\ndef save():\n with open(filename.get(), 'w') as file:\n file.wr...
[ 2, 3, 4, 5, 6 ]
quotes = [ "Today you are you! That is truer than true! There is no one alive who is you-er than you!", "Don't cry because it's over. Smile because it happened.", "You have brains in your head. You have feet in your shoes. You can steer yourself in any direction you choose. You're on your own, and you know what you kno...
normal
{ "blob_id": "f9ba944724b262afb39f2859b5726b961536cdf0", "index": 2092, "step-1": "<mask token>\n", "step-2": "quotes = [\n 'Today you are you! That is truer than true! There is no one alive who is you-er than you!'\n , \"Don't cry because it's over. Smile because it happened.\",\n \"You have brains in...
[ 0, 1, 2 ]
import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify, render_template, abort #creating engine to connect with hawaii sqlite database...
normal
{ "blob_id": "c295d769b85943a6ca89f9d213e79b78129a6ce9", "index": 2031, "step-1": "<mask token>\n\n\n@app.route('/api/v1.0/stations')\ndef stations():\n \"\"\"return a json list of stations from the dataset.\"\"\"\n stationquery = session.query(Station.station).all()\n stationlist = list(np.ravel(station...
[ 3, 8, 9, 10, 12 ]
""" 实战练习: 1.打开网页 https://www.runoob.com/try/try.php?filename=jqueryui-api-droppable 2.操作窗口右侧页面,将元素1拖拽到元素2 3.这时候会有一个alert弹框,点击弹框中的‘确定’ 3.然后再按’点击运行’ 4.关闭网页 """ import pytest from selenium import webdriver from time import sleep from selenium.webdriver import ActionChains class TestFrame: def setup(self): self...
normal
{ "blob_id": "74843dea00a88513c3a9237eb024e1e14e8b1ff8", "index": 3088, "step-1": "<mask token>\n\n\nclass TestFrame:\n <mask token>\n\n def teardown(self):\n self.driver.quit()\n\n def test_frame(self):\n self.driver.switch_to.frame('iframeResult')\n action = ActionChains(self.drive...
[ 3, 4, 5, 6, 7 ]
from snake.snake import Snake # Start application if __name__ == '__main__': s = Snake() s.run()
normal
{ "blob_id": "efed5c113e085e5b41d9169901c18c06111b9077", "index": 8894, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n s = Snake()\n s.run()\n", "step-3": "from snake.snake import Snake\nif __name__ == '__main__':\n s = Snake()\n s.run()\n", "step-4": "from sna...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 处理与合约名字有关的变量 """ import re # 上期所 PRODUCTS_SHFE = {'cu', 'al', 'zn', 'pb', 'ni', 'sn', 'au', 'ag', 'rb', 'wr', 'hc', 'fu', 'bu', 'ru'} # 中金所 PRODUCTS_CFFEX = {'IF', 'IC', 'IH', 'T', 'TF'} # 郑商所 PRODUCTS_CZCE = {'SR', 'CF', 'ZC', 'FG', 'TA', 'WH', 'PM', 'RI', 'LR', 'JR',...
normal
{ "blob_id": "8bb39149a5b7f4f4b1d3d62a002ab97421905ea1", "index": 551, "step-1": "<mask token>\n\n\ndef get_product(symbol):\n \"\"\"\n 从合约名中提取产品名\n :param symbol:\n :return:\n \"\"\"\n pattern = re.compile('(\\\\D{1,2})(\\\\d{0,1})(\\\\d{3})')\n match = pattern.match(symbol)\n if match:\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def countOfZeros(num): cnt = 0 while num != 0: cnt += 1 num = num & num - 1 return 32 - cnt <|reserved_special_token_0|> <|reserved_special_token_1|> def countOfZeros(num): cnt = 0 while num != 0: cnt += 1 ...
flexible
{ "blob_id": "7affd79fb0bb47283bbd9a7fbcaa0ba43aa8e6a6", "index": 106, "step-1": "<mask token>\n", "step-2": "def countOfZeros(num):\n cnt = 0\n while num != 0:\n cnt += 1\n num = num & num - 1\n return 32 - cnt\n\n\n<mask token>\n", "step-3": "def countOfZeros(num):\n cnt = 0\n w...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MMU: <|reserved_special_token_0|> def dma(self, val: int) ->None: dest = 65024 offset = val * 256 for n in range(160): self.mem[dest + n] = self.mem[n + offset] <|reserved_special_token_0|> def __setitem__(self, key: int, val: in...
flexible
{ "blob_id": "1a7363736076620b7704d7264b2f0bb24514165c", "index": 9816, "step-1": "<mask token>\n\n\nclass MMU:\n <mask token>\n\n def dma(self, val: int) ->None:\n dest = 65024\n offset = val * 256\n for n in range(160):\n self.mem[dest + n] = self.mem[n + offset]\n <mask...
[ 4, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-19 15:25 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='OpenHu...
normal
{ "blob_id": "28854823b1edc7df6cf025175811c1858efd2c42", "index": 862, "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 = Tr...
[ 0, 1, 2, 3, 4 ]