code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def avg_dissim_within_group_element(node, element_list): max_diameter = -np.inf sum_dissm = 0 for i in element_list: sum_dissm += dissimilarity_matrix[node][i] if dissimilarity_matrix[node][i] > max_diameter: max_diameter = dissimilarity_matrix[node...
flexible
{ "blob_id": "267695555e876dc2fe5820dc194490aad9e5e344", "index": 1361, "step-1": "<mask token>\n\n\ndef avg_dissim_within_group_element(node, element_list):\n max_diameter = -np.inf\n sum_dissm = 0\n for i in element_list:\n sum_dissm += dissimilarity_matrix[node][i]\n if dissimilarity_mat...
[ 4, 5, 6, 8, 9 ]
# Copyright 2023 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
normal
{ "blob_id": "86b24ddaae0d3477a3f82295224b7e84805eed91", "index": 1413, "step-1": "<mask token>\n\n\nclass AuthenticatorTest(absltest.TestCase):\n <mask token>\n\n def testGetGoogleSheetsServiceByCred_badFilePath_raisesFileNotFoundError(\n self):\n bad_file_path = './credential.json'\n ...
[ 2, 3, 4, 5, 6 ]
''' THROW with or without parameters Which of the following is true about the THROW statement? Answer the question 50XP Possible Answers - The THROW statement without parameters should be placed within a CATCH block. - The THROW statement with parameters can only be placed within a CATCH block. - The...
normal
{ "blob_id": "75023c7600fcceda0dc225992e7c433291b1a190", "index": 7254, "step-1": "<mask token>\n", "step-2": "'''\nTHROW with or without parameters\n\n\nWhich of the following is true about the THROW statement?\n\nAnswer the question\n50XP\n\nPossible Answers\n\n - The THROW statement without parameters sho...
[ 0, 1 ]
from django.db import models class Author(models.Model): author = models.CharField( "Author", max_length=30, blank=False, null=False ) biography = models.TextField( "About author", max_length=500, blank=True, null=True ) def __str__...
normal
{ "blob_id": "b34ad8d7fc8df0ab86c5930ab2b5aa1f86d13ae3", "index": 7580, "step-1": "<mask token>\n\n\nclass Series(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Genre(models.Model):\n genre = models.CharField('Genre', max_length=50, blank=False, null=False)\n description = m...
[ 7, 9, 11, 12, 14 ]
from flask import Flask, render_template , request import joblib # importing all the important libraires import numpy as np import pandas as pd import nltk import string from nltk.corpus import stopwords from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfV...
normal
{ "blob_id": "df92166378c8a8cc0ba02d0ba33d75bbd94510a7", "index": 4754, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return render_template('form.html')\n\n\n@app.route('/submit', methods=['POST'])\ndef form_data():\n user_data = request.form.get('user_data')\n user_data1 = [user_data]\n ...
[ 2, 3, 4, 5, 6 ]
''' def Sort(a): i=1 while i<len(a): j=i while j>0 and a[j-1] > a[j]: temp = a[j-1] a[j-1] = a[j] a[j] = temp j-=1 i+=1 return a ''' def Sort(a): i=1 n=len(a) while i<len(a): j=i print(i-1,'\t',i) whi...
normal
{ "blob_id": "3f8b8b8cfbe712f09734d0fb7302073187d65a73", "index": 982, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Sort(a):\n i = 1\n n = len(a)\n while i < len(a):\n j = i\n print(i - 1, '\\t', i)\n while a[j - 1] > a[j] and j >= 0:\n j -= 1\n pr...
[ 0, 1, 2 ]
import numpy as np, argparse, sys, itertools, os, errno, warnings from mpi4py import MPI from enlib import enmap as en, powspec, utils from enlib.degrees_of_freedom import DOF, Arg from enlib.cg import CG warnings.filterwarnings("ignore") #from matplotlib.pylab import * parser = argparse.ArgumentParser() parser.add_ar...
normal
{ "blob_id": "6a601d1c7c3c162c0902d03e6c39f8d75d4bcaf0", "index": 798, "step-1": "import numpy as np, argparse, sys, itertools, os, errno, warnings\nfrom mpi4py import MPI\nfrom enlib import enmap as en, powspec, utils\nfrom enlib.degrees_of_freedom import DOF, Arg\nfrom enlib.cg import CG\nwarnings.filterwarning...
[ 0 ]
# 나의 풀이 def solution(prices): # 초 단위로 기록된 주식가격이 담긴 배열 prices # 가격이 떨어지지 않은 기간을 리턴 answer = [0]*len(prices) for i in range(len(prices)-1): for j in range(i+1, len(prices)): answer[i] += 1 # 가격이 떨어졌을 경우 if prices[i] > prices[j]: break retur...
normal
{ "blob_id": "23b6d754adf1616bc6ea1f8c74984fbd8dade6dd", "index": 4238, "step-1": "<mask token>\n", "step-2": "def solution(prices):\n answer = [0] * len(prices)\n for i in range(len(prices) - 1):\n for j in range(i + 1, len(prices)):\n answer[i] += 1\n if prices[i] > prices[j...
[ 0, 1, 2 ]
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays from OpenGL.constant import Constant as _C # End users want this... from OpenGL.raw.GLES2 import _errors # Code generation uses this from OpenGL.raw.GLES2 import _types as _cs _EXTENSION_NAME = 'GLES2_NV_viewport_array' ...
normal
{ "blob_id": "9535973f9714926269490b8550a67c74d04d8f0a", "index": 834, "step-1": "<mask token>\n\n\n@_f\n@_p.types(None, _cs.GLuint, _cs.GLsizei, arrays.GLfloatArray)\ndef glDepthRangeArrayfvNV(first, count, v):\n pass\n\n\n@_f\n@_p.types(None, _cs.GLuint, _cs.GLfloat, _cs.GLfloat)\ndef glDepthRangeIndexedfNV(...
[ 11, 12, 13, 14, 16 ]
<|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": "68f3d3fce52d08381adc522ee032ef3181aec82a", "index": 400, "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 = [('beerFriends'...
[ 0, 1, 2, 3, 4 ]
from machine import Pin, PWM import time # externe LED zit op pin D1 (GPIO5) PinNum = 5 # pwm initialisatie pwm1 = PWM(Pin(PinNum)) pwm1.freq(60) pwm1.duty(0) step = 100 for i in range(10): # oplichten while step < 1000: pwm1.duty(step) time.sleep_ms(500) step+=100 # uitdoven ...
normal
{ "blob_id": "9f31694d80f2dcc50a76b32aa296871694d3644d", "index": 7838, "step-1": "<mask token>\n", "step-2": "<mask token>\npwm1.freq(60)\npwm1.duty(0)\n<mask token>\nfor i in range(10):\n while step < 1000:\n pwm1.duty(step)\n time.sleep_ms(500)\n step += 100\n while step > 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MongoDB: <|reserved_special_token_0|> def get_one(self, query): return self.table.find_one(query, property={'_id': False}) <|reserved_special_token_0|> def add(self, kv_dict): return self.table.insert_one(kv_dict) def delete(self, query): ...
flexible
{ "blob_id": "b5f88a6d119f2c3ce8fb77cf8c45b6c9252f5128", "index": 7619, "step-1": "<mask token>\n\n\nclass MongoDB:\n <mask token>\n\n def get_one(self, query):\n return self.table.find_one(query, property={'_id': False})\n <mask token>\n\n def add(self, kv_dict):\n return self.table.ins...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(s) <|reserved_special_token_1|> lista = [2, 3.2, 4, 52, 6.25] s = sum(lista) print(s)
flexible
{ "blob_id": "05aa8eac846154024d25d639da565135e41403c2", "index": 9611, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s)\n", "step-3": "lista = [2, 3.2, 4, 52, 6.25]\ns = sum(lista)\nprint(s)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# Generated by Django 3.2.5 on 2021-08-05 07:19 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('organization', '0010_aut...
normal
{ "blob_id": "f2c53efa4b7c2df592582e3093ff269b703be1e0", "index": 3054, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import urllib.request import urllib.parse import json def predict(input_text): URL = "http://127.0.0.1:8000/api/v1/predict/" values = { "format": "json", "input_text": input_text, } data = urllib.parse.urlencode({'input_text': i...
normal
{ "blob_id": "b7632cc7d8fc2f9096f7a6bb61c471dc61689f70", "index": 8342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef predict(input_text):\n URL = 'http://127.0.0.1:8000/api/v1/predict/'\n values = {'format': 'json', 'input_text': input_text}\n data = urllib.parse.urlencode({'input_text'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PolicyEstimator: <|reserved_special_token_0|> class ValueEstimator: def __init__(self, reuse=False, trainable=True): self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf. uint8, name='X') self.targets = tf.placeholder(shape=[None], dt...
flexible
{ "blob_id": "0fbf8efd39f583581c46fcd3f84c65a7787145cd", "index": 847, "step-1": "<mask token>\n\n\nclass PolicyEstimator:\n <mask token>\n\n\nclass ValueEstimator:\n\n def __init__(self, reuse=False, trainable=True):\n self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.\n uint...
[ 3, 4, 5, 6, 7 ]
import pandas as pd import numpy as np import json from pprint import pprint from shapely.geometry import shape, Point from geopy.geocoders import Nominatim from geopy.exc import GeocoderTimedOut from geopy.exc import GeocoderServiceError import collections from matplotlib import pyplot as plt import time import csv ...
normal
{ "blob_id": "c1bb2052b3f623c6787ba080dff2dc81f4d6f55e", "index": 1818, "step-1": "import pandas as pd\nimport numpy as np\nimport json\nfrom pprint import pprint\nfrom shapely.geometry import shape, Point\nfrom geopy.geocoders import Nominatim\nfrom geopy.exc import GeocoderTimedOut\nfrom geopy.exc import Geocod...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> consonant += consonant.upper() <|reserved_special_token_0|> for c in message: if c in vowel: vowel_count += 1 elif c in consonant: consonant_count += 1 print(vowel_count, consonant_count) <|reserved_speci...
flexible
{ "blob_id": "edf704d720abdb09d176937664c9ba98bcd253a5", "index": 8320, "step-1": "<mask token>\n", "step-2": "<mask token>\nconsonant += consonant.upper()\n<mask token>\nfor c in message:\n if c in vowel:\n vowel_count += 1\n elif c in consonant:\n consonant_count += 1\nprint(vowel_count, c...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def trigLSQ(data): noPoints = len(data['x']) order = int(noPoints / 2) if int(noPoints / 2) < noPoints / 2 else int( noPoints / 2) - 1 c = lambda a: np.array([np.cos(a * float(data['x'][i])) for i in range( ...
flexible
{ "blob_id": "98c2fdf0dfc9a660a3eb9a359aa9ca14d83c60ce", "index": 4588, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef trigLSQ(data):\n noPoints = len(data['x'])\n order = int(noPoints / 2) if int(noPoints / 2) < noPoints / 2 else int(\n noPoints / 2) - 1\n c = lambda a: np.array([...
[ 0, 1, 2, 3, 4 ]
a = [] for i in range((2 * int(input()))): a.append(int(input())) if 1 in a: c = a.index(max(a)) if a[c + 1] == 1: print(c) else: del a[c] s = a.index(max(a)) if a[s + 1] == 1: print(s) else: print('-1')
normal
{ "blob_id": "e3e50df47ef074f13382e249832c065ebdce18a6", "index": 8406, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2 * int(input())):\n a.append(int(input()))\nif 1 in a:\n c = a.index(max(a))\n if a[c + 1] == 1:\n print(c)\n else:\n del a[c]\n s = a.ind...
[ 0, 1, 2, 3 ]
from plone import api from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE from plone.app.testing import applyProfile from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting from plone.app.testing import PLONE_FIXTURE from plone.app.testing import PloneSandboxL...
normal
{ "blob_id": "eec2b818ea9d50161bad60e8bf83dcb7ce9bf9fa", "index": 7428, "step-1": "<mask token>\n\n\nclass OiRAFixture(PloneSandboxLayer):\n <mask token>\n\n def setUpZope(self, app, configurationContext):\n z2.installProduct(app, 'Products.membrane')\n z2.installProduct(app, 'Products.statusm...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def precision_recall_fscore(nodes, y_true, y_pred): df = pd.DataFrame({'true': y_true, 'pred': y_pred}, index=nodes) n_predicted_nodes = len(df[df['pred'] != 0]) n_corrects = len(df[df['pred'] == df['true']]) n_test = len(nodes) p = n_corrects / n_predicted_nodes r...
flexible
{ "blob_id": "79c7a2f2e5f0301c15efe1b26a7839a12098f793", "index": 6618, "step-1": "<mask token>\n\n\ndef precision_recall_fscore(nodes, y_true, y_pred):\n df = pd.DataFrame({'true': y_true, 'pred': y_pred}, index=nodes)\n n_predicted_nodes = len(df[df['pred'] != 0])\n n_corrects = len(df[df['pred'] == df...
[ 2, 3, 4, 5, 6 ]
import os import argparse import torch import model.model as module_arch from utils.util import remove_weight_norms from train import get_instance from librosa import load from librosa.output import write_wav from time import time def main(config, resume, infile, outfile, sigma, dur, half): # build model architec...
normal
{ "blob_id": "a2421a8673a524c32539555596711a71a8e00dbf", "index": 439, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(config, resume, infile, outfile, sigma, dur, half):\n model = get_instance(module_arch, 'arch', config)\n model.summary()\n checkpoint = torch.load(resume)\n state...
[ 0, 1, 2, 3, 4 ]
from valuate.predict import * def get_profit_rate(intent, popularity): """ 获取畅销系数 """ # 按畅销程度分级,各交易方式相比于标价的固定比例 profits = gl.PROFITS profit = profits[popularity] # 计算各交易方式的价格相比于标价的固定比例 if intent == 'sell': # 商家收购价相比加权平均价的比例 profit_rate = 1 - profit[0] - profit[1] el...
normal
{ "blob_id": "1f01989f10be5404d415d4abd1ef9ab6c8695aba", "index": 6069, "step-1": "<mask token>\n\n\ndef process_mile(price, use_time, mile):\n \"\"\"\n mile处理\n \"\"\"\n mile_per_month = mile / use_time\n if mile_per_month < gl.MILE_THRESHOLD_2_5:\n return price + 0.035 * (1 - mile_per_mont...
[ 12, 15, 16, 18, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def html_print(text, title=''): from IPython.core.display import display, HTML display(HTML('<h4>' + str(title) + '</h4>')) html = display(HTML('<font size=2 face=Verdana>' + text + '</font>')) return html <|reserved_special_token_1|> def h...
flexible
{ "blob_id": "84a63f60a45f1f8fc1efec8f30345a43c3c30c63", "index": 7332, "step-1": "<mask token>\n", "step-2": "def html_print(text, title=''):\n from IPython.core.display import display, HTML\n display(HTML('<h4>' + str(title) + '</h4>'))\n html = display(HTML('<font size=2 face=Verdana>' + text + '</f...
[ 0, 1, 2 ]
from django.contrib import admin from django.contrib.admin.sites import AdminSite from obp.models import * from django.utils.html import format_html from jet.admin import CompactInline #from django.utils.translation import ugettext_lazy as _ from jet.dashboard import modules from jet.dashboard.dashboard import Dashboa...
normal
{ "blob_id": "d301ffa790d6444519e354a2b6f8d65f67d380c0", "index": 1739, "step-1": "<mask token>\n\n\nclass Client_OrderInline(admin.TabularInline):\n <mask token>\n\n\nclass MyAdminSite(AdminSite):\n site_header = 'Pizza-Day'\n index_template = 'admin/index.html'\n\n\n@admin.register(Product)\nclass Prod...
[ 16, 17, 18, 24, 25 ]
club_info = {'club_url': 'https://www.futbin.com///18/leagues/Major%20League%20Soccer?page=1&club=101112' , 'club_logo': 'https://cdn.futbin.com/content/fifa18/img/clubs/101112.png', 'club_name': 'Vancouver Whitecaps FC'} players = {} players['Waston'] = {'player_url': 'https://www.futbin.com//18/pl...
normal
{ "blob_id": "35c4e26acbe99ca7f37b63b67f38d5c40fbf0ea4", "index": 2503, "step-1": "<mask token>\n", "step-2": "club_info = {'club_url':\n 'https://www.futbin.com///18/leagues/Major%20League%20Soccer?page=1&club=101112'\n , 'club_logo':\n 'https://cdn.futbin.com/content/fifa18/img/clubs/101112.png',\n ...
[ 0, 1 ]
def reorderAssetsByTypes(nodePath, colorNode=True, alignNode=True): node = hou.pwd() def getNaskCasting(): path = "E:/WIP/Work/casting-nask.csv" file = open(path, "r") fileText = file.readlines() file.close() fileText.pop(0) assetDic = {} for line ...
normal
{ "blob_id": "3073850890eb7a61fb5200c5ab87c802cafe50bb", "index": 7229, "step-1": "<mask token>\n", "step-2": "def reorderAssetsByTypes(nodePath, colorNode=True, alignNode=True):\n node = hou.pwd()\n\n def getNaskCasting():\n path = 'E:/WIP/Work/casting-nask.csv'\n file = open(path, 'r')\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestPool2D(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestPool2D(unittest.TestCase): @staticmethod def _build_model(input_shape, ...
flexible
{ "blob_id": "1af9fb91e69ea78709c47fca6b12e4f7a6fd17a8", "index": 7392, "step-1": "<mask token>\n\n\nclass TestPool2D(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestPool2D(unittest.TestCase):\n\n @staticmethod\n def _build_model(input_s...
[ 1, 3, 4, 5, 6 ]
import mmap; import random; def shuffle(): l_digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; random.shuffle(l_digits); return "".join(l_digits); with open("hello.txt", "r+") as f: map = mmap.mmap(f.fileno(), 1000); l_i = 0; for l_digit in shuffle(): map[l_i] = l_digit; ...
normal
{ "blob_id": "b0468e58c4d0387a92ba96e8fb8a876ece256c78", "index": 6507, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef shuffle():\n l_digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n random.shuffle(l_digits)\n return ''.join(l_digits)\n\n\n<mask token>\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
''' 8-6. 도시 이름 도시와 국가 이름을 받는 city_country() 함수를 만드세요. 이 함수는 다음과 같은 문자열을 반환해야 합니다. 'Santiago, Chile' - 최소한 세 개의 도시-국가 쌍으로 함수를 호출하고 반환값을 출력하세요. Output: santiago, chile ushuaia, argentina longyearbyen, svalbard '''
normal
{ "blob_id": "2d5abcd75dcbeb1baa3f387035bdcc3b7adbfe3f", "index": 7856, "step-1": "<mask token>\n", "step-2": "'''\n8-6. 도시 이름\n도시와 국가 이름을 받는 city_country() 함수를 만드세요. 이 함수는 다음과 같은 문자열을 반환해야 합니다.\n'Santiago, Chile'\n- 최소한 세 개의 도시-국가 쌍으로 함수를 호출하고 반환값을 출력하세요.\n\nOutput:\nsantiago, chile\nushuaia, argentina\nlongye...
[ 0, 1 ]
#!/usr/bin/env python3 import click @click.command() @click.option("--name", prompt = "Your name") def hello(name): print("hello", name) if __name__ == '__main__': hello()
normal
{ "blob_id": "19c1a50cf19f04a9e0d0163a9383cb900bca1d38", "index": 9862, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@click.command()\n@click.option('--name', prompt='Your name')\ndef hello(name):\n print('hello', name)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@click.command()\n@click...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UploaderThread(object): <|reserved_special_token_0|> def is_uploading_tourney(self, tourney): return tourney in self.uploading_tourneys <|reserved_special_token_0|> <|reserved_special_token_0|> def get_last_successful_upload_time(self, tourney_name): ...
flexible
{ "blob_id": "bd202e18cb98efc2b62ce4670fadcf70c35a33cb", "index": 2529, "step-1": "<mask token>\n\n\nclass UploaderThread(object):\n <mask token>\n\n def is_uploading_tourney(self, tourney):\n return tourney in self.uploading_tourneys\n <mask token>\n <mask token>\n\n def get_last_successful...
[ 19, 21, 26, 31, 34 ]
import pandas as pd import re import sqlite3 as lite import os from pybedtools import BedTool import django from checkprimers import CheckPrimers from pandas import ExcelWriter import datetime os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' django.setup() class GetPrimers(object): """Extracts data from e...
normal
{ "blob_id": "1d817ee09705301b574c421a9ff716748c146fdd", "index": 9591, "step-1": "import pandas as pd\nimport re\nimport sqlite3 as lite\nimport os\nfrom pybedtools import BedTool\nimport django\nfrom checkprimers import CheckPrimers\nfrom pandas import ExcelWriter\nimport datetime\nos.environ['DJANGO_SETTINGS_M...
[ 0 ]
"""@brief the routes for Flask application """ import hashlib import json import time import requests from flask import render_template, url_for from soco import SoCo from app import app app.config.from_pyfile("settings.py") sonos = SoCo(app.config["SPEAKER_IP"]) def gen_sig(): """@brief return the MD5 checksum...
normal
{ "blob_id": "86f33895e9ae0e026d7d6e40e611796b2dc2c713", "index": 8394, "step-1": "<mask token>\n\n\ndef gen_sig():\n \"\"\"@brief return the MD5 checksum \"\"\"\n return hashlib.md5((app.config['ROVI_API_KEY'] + app.config[\n 'ROVI_SHARED_SECRET'] + repr(int(time.time()))).encode('utf-8')\n )...
[ 16, 17, 18, 20, 23 ]
"""1) Написать бота-консультанта, который будет собирать информацию с пользователя (его ФИО, номер телефона, почта, адресс, пожелания). Записывать сформированную заявку в БД (по желанию SQl/NOSQL).).""" import telebot from .config import TOKEN from telebot.types import ReplyKeyboardMarkup, KeyboardButton, InlineKeybo...
normal
{ "blob_id": "dcb2351f9489815fbec8694b446d0a93972a6590", "index": 6388, "step-1": "<mask token>\n\n\nclass User(Document):\n surname = StringField(required=True)\n name = StringField(required=True)\n middle_name = StringField(required=True)\n phone = StringField(required=True)\n email = StringField...
[ 10, 12, 13, 14, 16 ]
# This handle the url for routing from django.urls import path from . import views # Defines views to pass dynamic data to listings page urlpatterns = [ path('', views.index, name='listings'), path('<int:listing_id>', views.listing, name='listing'), path('search', views.search, name='search') ]
normal
{ "blob_id": "be894830bb0dde6bacaea6be823391e0445603c3", "index": 1192, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='listings'), path(\n '<int:listing_id>', views.listing, name='listing'), path('search',\n views.search, name='search')]\n", "step-3": "fr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i_angle in np.arange(0, 360, 45): ri_filenames.append('r%di%d.csv' % (i_angle, i_angle)) ri_filenames.append('r%di%d.csv' % (i_angle + 45, i_angle)) ri_filenames.append('r360i360.csv') <|reserved_special_token_0|> for ...
flexible
{ "blob_id": "3d3b9956a98f11a170d66280abe7f193cef9ccfb", "index": 808, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i_angle in np.arange(0, 360, 45):\n ri_filenames.append('r%di%d.csv' % (i_angle, i_angle))\n ri_filenames.append('r%di%d.csv' % (i_angle + 45, i_angle))\nri_filenames.append('r36...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def root(): return 'Test!' @app.route('/federal/geographic') def federal_geographic(): pass <|reserved_special_token_0|> @app.route('/state/geographic') def state_geographic(): pass @app.route('/local/temporal') def local_temporal(): pass <|reserv...
flexible
{ "blob_id": "cc094f8aeff3b52bd9184f7b815320529ecb4550", "index": 9928, "step-1": "<mask token>\n\n\n@app.route('/')\ndef root():\n return 'Test!'\n\n\n@app.route('/federal/geographic')\ndef federal_geographic():\n pass\n\n\n<mask token>\n\n\n@app.route('/state/geographic')\ndef state_geographic():\n pas...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class TestValidate(unittest.TestCase): @db_session def setUp(self): db.execute('delete from Person') registry = getattr(core, '__warningregistry__', {}) for key in list(registry): if type(key) is not tuple: continue ...
flexible
{ "blob_id": "33c39b098cb9d3368b8f74a7433e0943fe252da5", "index": 5672, "step-1": "<mask token>\n\n\nclass TestValidate(unittest.TestCase):\n\n @db_session\n def setUp(self):\n db.execute('delete from Person')\n registry = getattr(core, '__warningregistry__', {})\n for key in list(regis...
[ 6, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ROOT_URL = 'https://api.twitter.com' UPLOAD_URL = 'https://upload.twitter.com' REQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token' AUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate' ACCESS_TOKEN_URL = f'{ROOT_URL}/oauth/access_...
flexible
{ "blob_id": "c907f6b954aa3eae21a54eba9d54c116576bd40a", "index": 5848, "step-1": "<mask token>\n", "step-2": "<mask token>\nROOT_URL = 'https://api.twitter.com'\nUPLOAD_URL = 'https://upload.twitter.com'\nREQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token'\nAUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate'...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> authors.append(text[start + length + len('<![CDATA['):end - len(']]>')]) while text.find('<wp:author_display_name>', start + 1) != -1: start = text.find('<wp:author_display_name>', start + 1) end = text.find('</wp:author_d...
flexible
{ "blob_id": "cf5062c999c6c29f103428c247d8d1a4550f9d75", "index": 8086, "step-1": "<mask token>\n", "step-2": "<mask token>\nauthors.append(text[start + length + len('<![CDATA['):end - len(']]>')])\nwhile text.find('<wp:author_display_name>', start + 1) != -1:\n start = text.find('<wp:author_display_name>', ...
[ 0, 1, 2, 3 ]
import krait from ctrl import ws krait.mvc.set_init_ctrl(ws.WsPageController())
normal
{ "blob_id": "da2b946238b429188fe3fa50286658d4b5cdbf41", "index": 5752, "step-1": "<mask token>\n", "step-2": "<mask token>\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n", "step-3": "import krait\nfrom ctrl import ws\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n", "step-4": null, "step-5": null, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class LogPlugin(Plugin): <|reserved_special_token_0|> <|reserved_special_token_0|> def search(self, message, query, *additional_queries): chat_history = read_lines_from_file('chatlog.log') chat_history.reverse() found_line = None for line in ch...
flexible
{ "blob_id": "d932ab84848c9a8ca8bb23a57424b8f6190b6260", "index": 2563, "step-1": "<mask token>\n\n\nclass LogPlugin(Plugin):\n <mask token>\n <mask token>\n\n def search(self, message, query, *additional_queries):\n chat_history = read_lines_from_file('chatlog.log')\n chat_history.reverse(...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Methylation(object): def __init__(self, table, data_type, name, called_sites): self.table = table self.data_type = data_type self.name = name self.called_sites = called_sites <|reserved_special_token_0|> def parse_nanopolish(filename, file_ty...
flexible
{ "blob_id": "d654aea3da3e36ccde8a5f4e03798a0dea5aad8a", "index": 510, "step-1": "<mask token>\n\n\nclass Methylation(object):\n\n def __init__(self, table, data_type, name, called_sites):\n self.table = table\n self.data_type = data_type\n self.name = name\n self.called_sites = cal...
[ 5, 8, 10, 11, 12 ]
# Title: K번째 수 # Link: https://www.acmicpc.net/problem/11004 import sys sys.setrecursionlimit(10 ** 6) def read_list_int(): return list(map(int, sys.stdin.readline().strip().split(' '))) def read_single_int(): return int(sys.stdin.readline().strip()) def selection_sort(nums, k): sor...
normal
{ "blob_id": "f4ab6df8efc334fa338ade7deecd36d8cd859e96", "index": 4174, "step-1": "<mask token>\n\n\ndef read_list_int():\n return list(map(int, sys.stdin.readline().strip().split(' ')))\n\n\n<mask token>\n\n\ndef selection_sort(nums, k):\n sorted_index = 0\n while True:\n minimum = 9999999999\n ...
[ 5, 6, 7, 8, 9 ]
"""Produce a multi-panel figure of each output lead time in a forecast """ import matplotlib.pyplot as plt import iris.plot as iplt from irise import convert from irise.plot.util import add_map from myscripts import plotdir from myscripts.models.um import case_studies columns = 3 def main(forecast, name, levels, *a...
normal
{ "blob_id": "310e6e693cdce6ff71d06eac86214a21bef236d4", "index": 7425, "step-1": "<mask token>\n\n\ndef main(forecast, name, levels, *args, **kwargs):\n nt = len(forecast)\n rows = nt / columns + 1\n fig = plt.figure(figsize=(18, 10 * float(rows) / columns))\n for n, cubes in enumerate(forecast):\n ...
[ 1, 2, 3, 4, 5 ]
import os, glob import numpy as np from ..algorithms.utils import get_file_manager from ..algorithms.clustered_writes import * from ..exp_utils import create_empty_dir def test_get_entity_sizes(): # in C order bytes_per_voxel = 1 R = (10,9,10) cs = (5,3,2) partition = (2,3,5) bs, brs, bss = g...
normal
{ "blob_id": "6dd11f71e514a46462bf0b97ddac9ea474e86ad0", "index": 366, "step-1": "<mask token>\n\n\ndef test_get_strategy():\n bytes_per_voxel = 1\n R = 20, 9, 10\n cs = 5, 3, 2\n partition = 4, 3, 5\n bs, brs, bss = get_entity_sizes(cs, bytes_per_voxel, partition)\n test_case = {(5 * 2 * 3): 0,...
[ 1, 3, 4, 5, 6 ]
from django.apps import AppConfig class DojoBookAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'dojo_book_app'
normal
{ "blob_id": "314f6cc97f53fa5bd8bf0ec0e1e305ca6384f1a2", "index": 1559, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DojoBookAppConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass DojoBookAppConfig(AppConfig):\n default_auto_field = 'django.db.mod...
[ 0, 1, 2, 3 ]
import numpy as np ''' 1. Create 0-D array, 1-D array, 2-D array, 3-D array with following value 0-D: [2] 1-D: [3, 4, 5, 6, 7] 2-D: [[8, 1, 3], [2, 3, 4], [6, 2, 5]] 3-D: [[[1, 2, 4], [3, 3, 2], [1, 9, 1]], [[6, 8, 7], [9, 1, 0], [8, 2, 3]], [[5, 4, 1], [5, 7, 2], [3, 5, 9]]] print them ''' D0 = np....
normal
{ "blob_id": "a868ecb6ea6a5c7a186ddd8fa4fb76d96efeb21d", "index": 4140, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('D0')\nprint(D0)\nprint('D1')\nprint(D1)\nprint('D2')\nprint(D2)\nprint('D3')\nprint(D3)\n<mask token>\nprint('D2')\nprint(D2)\n<mask token>\nprint('D3')\nprint(D3)\n<mask token>\np...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # encoding: utf-8 from rest_client import PY2 from tornado.testing import gen_test from tornado.web import Application, RequestHandler from .server import AsyncRESTTestCase class Handler(RequestHandler): if PY2: S = '\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82 \xd0\xbc\xd0\xb8\x...
normal
{ "blob_id": "4bbd97942023370e053ccf4b5c1496c7247c7bf2", "index": 9026, "step-1": "<mask token>\n\n\nclass TestCopy(AsyncRESTTestCase):\n <mask token>\n\n @gen_test\n def test_get(self):\n response = yield self.http_client.get(self.api_url.format('/'))\n assert response.body == Handler.S\n"...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> def loop_rec(n, m, mapCoords, dims, data, tple): if n >= m: for x in range(dims[m]): loop_rec(n, m + 1, mapCoords, dims, data, tple + (x,)) else: temp = loop_access(len(dims) - 1, 0, data, tple) print(temp) if temp in mapCoords: ...
flexible
{ "blob_id": "55b4448caa73bcb50a15eb46d07328934fce72c8", "index": 7029, "step-1": "<mask token>\n\n\ndef loop_rec(n, m, mapCoords, dims, data, tple):\n if n >= m:\n for x in range(dims[m]):\n loop_rec(n, m + 1, mapCoords, dims, data, tple + (x,))\n else:\n temp = loop_access(len(dim...
[ 1, 2, 3, 4, 5 ]
# link https://deeplizard.com/learn/video/QK_PP_2KgGE import gym import numpy as np import random import time from IPython.display import clear_output # setup the env env = gym.make("FrozenLake8x8-v0", is_slippery=False) observation = env.reset() # setup the q-table action_space_size = env.action_space.n state_space_...
normal
{ "blob_id": "b791afec1c9fb214d1f3b4ec0ec67f905d96aabf", "index": 3249, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor episode in range(num_episodes):\n state = env.reset()\n done = False\n rewards_current_episode = 0\n for step in range(steps_per_episodes):\n exploration_rate_thres...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pandas2ri.activate() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ts = robjects.r('ts') forecast = importr('forecast', lib_loc= 'C:/Users/sand9888/Documents/sand9888/R/win-library/3...
flexible
{ "blob_id": "e00cbe6e177ee841c6e64de842e5b8f95463b3a8", "index": 2169, "step-1": "<mask token>\n", "step-2": "<mask token>\npandas2ri.activate()\n<mask token>\n", "step-3": "<mask token>\nts = robjects.r('ts')\nforecast = importr('forecast', lib_loc=\n 'C:/Users/sand9888/Documents/sand9888/R/win-library/3...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Cell(object): def __init__(self, cellId, top_left_cell, top_right_cell, bottom_right_cell, bottom_left_cell): self.cellId = cellId self.top_left_cell = top_left_cell self.top_right_cell = top_right_cell self.bottom_right_cell = bottom_rig...
flexible
{ "blob_id": "01f0ad8746ed9a9941faa699b146625ad3a0b373", "index": 4289, "step-1": "<mask token>\n\n\nclass Cell(object):\n\n def __init__(self, cellId, top_left_cell, top_right_cell,\n bottom_right_cell, bottom_left_cell):\n self.cellId = cellId\n self.top_left_cell = top_left_cell\n ...
[ 6, 7, 8, 9, 11 ]
from django.core.validators import RegexValidator from django.db import models from .image import Image class AffiliatedStoreManager(models.Manager): def get_queryset(self): return super().get_queryset() \ .select_related('icon') \ .select_related('icon__image_type') def fin...
normal
{ "blob_id": "e2b439974b66e45a899605bc7234850783c3dfb0", "index": 2231, "step-1": "<mask token>\n\n\nclass AffiliatedStoreManager(models.Manager):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AffiliatedStore(models.Model):\n\n\n class Meta:\n db_table = 'affiliated_store'\n object...
[ 5, 6, 7, 9, 10 ]
# Percy's playground. from __future__ import print_function import sympy as sp import numpy as np import BorderBasis as BB np.set_printoptions(precision=3) from IPython.display import display, Markdown, Math sp.init_printing() R, x, y = sp.ring('x,y', sp.RR, order=sp.grevlex) I = [ x**2 + y**2 - 1.0, x + y ] R, x, y...
normal
{ "blob_id": "88af8b4eeb40ecf19622ecde1a5dea9a078bb66c", "index": 8817, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.set_printoptions(precision=3)\n<mask token>\nsp.init_printing()\n<mask token>\nI.extend([(v ** 2 - 1) for v in vs])\nprint('Generating')\n<mask token>\nprint('Done')\nprint('=== Genera...
[ 0, 1, 2, 3, 4 ]
import string fhand = open("romeo-full.txt") counts = dict() for line in fhand: line.tranc
normal
{ "blob_id": "5493887e32dbe7ae27eca79d28da8488183b37a3", "index": 8792, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in fhand:\n line.tranc\n", "step-3": "<mask token>\nfhand = open('romeo-full.txt')\ncounts = dict()\nfor line in fhand:\n line.tranc\n", "step-4": "import string\nfhand...
[ 0, 1, 2, 3, 4 ]
people = 20 cats = 30 dogs = 15 if people < cats: print("Too many cats") elif people > cats: print("Not many cats") else: print("we cannnot decide")
normal
{ "blob_id": "0465e33d65c2ce47ebffeec38db6908826bf4934", "index": 299, "step-1": "<mask token>\n", "step-2": "<mask token>\nif people < cats:\n print('Too many cats')\nelif people > cats:\n print('Not many cats')\nelse:\n print('we cannnot decide')\n", "step-3": "people = 20\ncats = 30\ndogs = 15\nif...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class IssuerWalletInMemory(IssuerWallet, WalletInMemory): def __init__(self, claimDefId, repo: PublicRepo): WalletInMemory.__init__(self, claimDefId, repo) self._sks = {} self._skRs = {} self...
flexible
{ "blob_id": "890841c8892e89375bb022f0d469fefc27414a2b", "index": 5823, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass IssuerWalletInMemory(IssuerWallet, WalletInMemory):\n\n def __init__(self, claimDefId, repo: PublicRepo):\n WalletInMemory.__init__(self, claimDefId, repo)\n se...
[ 0, 2, 4, 5, 6 ]
# ---------------------------------------------------------------------------- # Written by Khanh Nguyen Le # May 4th 2019 # Discord: https://discord.io/skyrst # ---------------------------------------------------------------------------- import operator def validInput(x): if x=="a": return True elif x=...
normal
{ "blob_id": "5209638ec97a666783c102bec7a2b00991c41a08", "index": 5438, "step-1": "<mask token>\n\n\ndef takeInput():\n x = input()\n while not validInput(x):\n print('Invalid input. Try another one:')\n x = input()\n return x\n\n\ndef main():\n stats = {'Council': 0, 'United': 0, 'Facel...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Locale(MainHandler): <|reserved_special_token_0|> <|reserved_special_token_0|> class MainPage(MainHandler): def get(self): self.render('home.html') def post(self): pw = self.request.get('pw') <|reserved_special_token_1|> <|reserved_special_toke...
flexible
{ "blob_id": "bdcbb946dadf168149342c651ad03eaf4b748401", "index": 6803, "step-1": "<mask token>\n\n\nclass Locale(MainHandler):\n <mask token>\n <mask token>\n\n\nclass MainPage(MainHandler):\n\n def get(self):\n self.render('home.html')\n\n def post(self):\n pw = self.request.get('pw')\...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def findNonPrefixes(prefix, array): result = [] prefixLength = len(prefix) for string in array: if string[0:prefixLength] != prefix: result.append(string) return result def run(): r = re...
flexible
{ "blob_id": "8419aee5dbc64b51f3c0f364716aad1630f00fe9", "index": 7173, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findNonPrefixes(prefix, array):\n result = []\n prefixLength = len(prefix)\n for string in array:\n if string[0:prefixLength] != prefix:\n result.append...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MovieRankings(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Movie(models.Model): """ 电影的数据库表格 """ movie_name = models.CharField(max_length=64, blank=True) douban_link = models.CharField(m...
flexible
{ "blob_id": "449ae193f8817d4ee2fe67eadf72d9c19b2c5e53", "index": 1319, "step-1": "<mask token>\n\n\nclass MovieRankings(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Movie(models.Model):\n \"\"\"\n 电影的数据库表格\n \"\"\"\n movie_name = models.CharField(max_length=64, blan...
[ 8, 10, 11, 12, 13 ]
# -*- coding: utf-8 -*- """ Created on Thu May 3 09:12:11 2018 @author: shen1994 """ import codecs import numpy as np def create_documents(): """ 按标点符号或是空格存储文件 """ documents_length = 0 chars,labels = [],[] chars_file = codecs.open("data/data.data", 'w', 'utf-8') labels_file = codecs.open("data/...
normal
{ "blob_id": "f22836fc4fed22d833755db0ff34502170260766", "index": 9260, "step-1": "<mask token>\n\n\ndef create_documents():\n \"\"\" 按标点符号或是空格存储文件 \"\"\"\n documents_length = 0\n chars, labels = [], []\n chars_file = codecs.open('data/data.data', 'w', 'utf-8')\n labels_file = codecs.open('data/lab...
[ 4, 7, 8, 10, 11 ]
from config import Config from flask import Flask from flask_cors import CORS from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) CORS(app) app.config.from_object(Config) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///ws.db' # app.config['SQLALCHEMY_DATABASE_URI'] = 'mys...
normal
{ "blob_id": "f494d8aeee8c72cce8fc14e44ca896bcf30c100a", "index": 5627, "step-1": "<mask token>\n", "step-2": "<mask token>\nCORS(app)\napp.config.from_object(Config)\n<mask token>\n", "step-3": "<mask token>\napp = Flask(__name__)\nCORS(app)\napp.config.from_object(Config)\napp.config['SQLALCHEMY_DATABASE_UR...
[ 0, 1, 2, 3, 4 ]
from ...routes import Route from .providers import SQSProvider from .message_translators import SQSMessageTranslator, SNSMessageTranslator class SQSRoute(Route): def __init__(self, provider_queue, provider_options=None, *args, **kwargs): provider_options = provider_options or {} provider = SQSPro...
normal
{ "blob_id": "041f1d7c482fe4f65e8cc5a508da62ee6ccf59ff", "index": 6686, "step-1": "<mask token>\n\n\nclass SNSQueueRoute(Route):\n\n def __init__(self, provider_queue, provider_options=None, *args, **kwargs):\n provider_options = provider_options or {}\n provider = SQSProvider(provider_queue, **p...
[ 2, 3, 4, 5 ]
''' sin(x) = x^1/1! - x^3/3! + x^5/5! - x^7/7! + ….. Input : x, n ( No. of terms I want in series ) Input : 3.14, 10 Output : sin(3.14) = sin(180) = 0 Radians vs Degrees ( 0, 30, 60, 90 ….) 2pi = 360 Pi = 180 Pseudo code : 1.Take input variables radians,num 2. sin = 0 3. Indices = 1 4. odd = 1 4...
normal
{ "blob_id": "a99426c0751885f17078e709fd523cf3a26f5286", "index": 5533, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef exponent(base, index):\n if index == 0 and base == 0:\n return -1\n elif index == 0:\n return 1\n elif base == 0:\n return 0\n else:\n prod...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CnnArticleItem(scrapy.Item): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class GoogleArticleItem(scrapy.Item): title = scrapy.Fi...
flexible
{ "blob_id": "cf0eb9685cdfc412871d3b36270ddab3e520bb8f", "index": 104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CnnArticleItem(scrapy.Item):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass GoogleArticleItem(scrapy.Item):\n title = scrapy.Field()\n d...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class BatchGenerator(object): def __init__(self, data, batch_size=1): self.inputs, self.labels = data self.batch_size = batch_size self.data_length = len(self.inputs) self.sequence_length = np.array([x.shape[0] for x in self.inputs]) def next_batc...
flexible
{ "blob_id": "912928cea0f96e601eecfcb6dba695ef26a3c6e2", "index": 9618, "step-1": "<mask token>\n\n\nclass BatchGenerator(object):\n\n def __init__(self, data, batch_size=1):\n self.inputs, self.labels = data\n self.batch_size = batch_size\n self.data_length = len(self.inputs)\n sel...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> fig.gca().plot(x, y, 'k.') <|reserved_special_token_0|> canvas.draw() <|reserved_special_token_0|> fig.gca().plot([bbox.x0, bbox.x1, bbox.x1, bbox.x0, bbox.x0], [bbox.y0, bbox.y0, bbox.y1, bbox.y1, bbox.y0], 'k:', transform=No...
flexible
{ "blob_id": "c87f9885e96abdd32df68f9fe1942b2782bd5b96", "index": 8149, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.gca().plot(x, y, 'k.')\n<mask token>\ncanvas.draw()\n<mask token>\nfig.gca().plot([bbox.x0, bbox.x1, bbox.x1, bbox.x0, bbox.x0], [bbox.y0,\n bbox.y0, bbox.y1, bbox.y1, bbox.y0], 'k...
[ 0, 1, 2, 3, 4 ]
from django.db import models # Create your models here. STATUS_CHOICES=( ('Pending','Pending'), ('Completed','Completed')) class Appointment(models.Model): first_name=models.CharField(max_length=100) last_name=models.CharField(max_length=100) phone_number=models.CharField(max_length=12,null=False...
normal
{ "blob_id": "3343844bf49cb3f4d655613475e44a140ac3106d", "index": 4505, "step-1": "<mask token>\n\n\nclass Appointment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.first_n...
[ 2, 3, 4, 5, 6 ]
import drawSvg import noise import random import math import numpy as np sizex = 950 sizey = 500 noisescale = 400 persistence = 0.5 lacunarity = 2 seed = random.randint(0, 100) actorsnum = 1000 stepsnum = 50 steplenght = 2 noisemap = np.zeros((sizex, sizey)) for i in range(sizex): for j in range(sizey): noi...
normal
{ "blob_id": "68c9944c788b9976660384e5d1cd0a736c4cd0e6", "index": 3826, "step-1": "<mask token>\n\n\nclass Actor:\n\n def __init__(self):\n self.x = random.random() * sizex\n self.y = random.random() * sizey\n self.xn = self.x\n self.yn = self.y\n\n def step(self):\n t = g...
[ 3, 4, 6, 7 ]
<|reserved_special_token_0|> def cos_dist(a, b): if len(a) != len(b): return None part_up = 0.0 a_sq = 0.0 b_sq = 0.0 for a1, b1 in zip(a, b): part_up += a1 * b1 a_sq += a1 ** 2 b_sq += b1 ** 2 part_down = math.sqrt(a_sq * b_sq) if part_down == 0.0: ...
flexible
{ "blob_id": "1a7e83fe9528b177246d6374ddaf2a76a0046e83", "index": 200, "step-1": "<mask token>\n\n\ndef cos_dist(a, b):\n if len(a) != len(b):\n return None\n part_up = 0.0\n a_sq = 0.0\n b_sq = 0.0\n for a1, b1 in zip(a, b):\n part_up += a1 * b1\n a_sq += a1 ** 2\n b_sq...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> #!/usr/bin/env python # -*- coding: utf-8 -*- """ Implements the webservice calls of the command like rest apis or other network related methods """
flexible
{ "blob_id": "48369e1ed826a9a50c0fd9f63b7cc10b8225ce2b", "index": 8760, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nImplements the webservice calls of the command\nlike rest apis or other network related methods\n\"\"\"", "step-3": null, "step-4": null, ...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while len(s) != 1: count += 1 a = 0 for i in range(len(s)): a += int(s[i]) s = str(a) print(count) <|reserved_special_token_1|> s = input() count = 0 while len(s) != 1: count += 1 a = 0 for i...
flexible
{ "blob_id": "638e21e1eb1e2e14244628260d9c7ac179983721", "index": 2541, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile len(s) != 1:\n count += 1\n a = 0\n for i in range(len(s)):\n a += int(s[i])\n s = str(a)\nprint(count)\n", "step-3": "s = input()\ncount = 0\nwhile len(s) != 1...
[ 0, 1, 2, 3 ]
#Copyright ReportLab Europe Ltd. 2000-2017 #see license.txt for license details __version__='3.3.0' __doc__=""" The Canvas object is the primary interface for creating PDF files. See doc/reportlab-userguide.pdf for copious examples. """ __all__ = ['Canvas'] ENABLE_TRACKING = 1 # turn this off to do profile testing w/...
normal
{ "blob_id": "7d6e8e6142184a1540daa29dac802fe75bd93d8e", "index": 4428, "step-1": "<mask token>\n", "step-2": "<mask token>\nc.translate(inch, inch)\nc.setFont('Helvetica', 80)\nc.setStrokeColorRGB(0.2, 0.5, 0.3)\nc.setFillColorRGB(1, 0, 1)\nc.rect(inch, inch, 6 * inch, 9 * inch, fill=1)\nc.rotate(90)\nc.setFil...
[ 0, 1, 2, 3, 4 ]
"""Test Spotify module""" from spoetify.spotify import Spotify from nose.tools import assert_equal def test_search_track(): sp = Spotify() t = sp.search_track("avocado") assert_equal(t.id, "1UyzA43l3OIcJ6jd3hh3ac")
normal
{ "blob_id": "337309da79ce9d90010fef5c171b6b344e6dc63f", "index": 5937, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_search_track():\n sp = Spotify()\n t = sp.search_track('avocado')\n assert_equal(t.id, '1UyzA43l3OIcJ6jd3hh3ac')\n", "step-3": "<mask token>\nfrom spoetify.spotify...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> log.fit(X_train, y_train) log.predict(sc.transform([[45, 87000]])) <|reserved_special_token_0|> np.set_printoptions(precision=2) np.concatenate((y_pred.reshape(len(y_pred), 1), y_test.reshape(len(y_test), 1)), 1) <|reserved_sp...
flexible
{ "blob_id": "149f8b453786ec54668a55ec349ac157d2b93b5d", "index": 2397, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.fit(X_train, y_train)\nlog.predict(sc.transform([[45, 87000]]))\n<mask token>\nnp.set_printoptions(precision=2)\nnp.concatenate((y_pred.reshape(len(y_pred), 1), y_test.reshape(len(y_t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def rows(**ro): print(ro) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(id(a)) <|reserved_special_token_0|> print('hello.....') print(type(a)) print(id(a)) <|reserved_special_token_0|> print(id(b)) b.append(10) print(id(b)) <|reserve...
flexible
{ "blob_id": "95b75395cafc6ba9f75ecf48157421e37ced2518", "index": 815, "step-1": "<mask token>\n\n\ndef rows(**ro):\n print(ro)\n\n\n<mask token>\n", "step-2": "<mask token>\nprint(id(a))\n<mask token>\nprint('hello.....')\nprint(type(a))\nprint(id(a))\n<mask token>\nprint(id(b))\nb.append(10)\nprint(id(b))\...
[ 1, 3, 4, 5, 6 ]
import json import struct import pymel.core as pmc import os.path def exportVSSD(path, camName, wantTris=False, renderdata=None): mainFileDict = {} mainFilePath = path mainFileStem = os.path.basename(path)[:-5] mainFileDir = os.path.dirname(path) resolution = pmc.ls('defaultResolution')[0] ren...
normal
{ "blob_id": "004a9cd0e459116bf3f88f3546ff4eded3dfb2a8", "index": 2512, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef exportVSSD(path, camName, wantTris=False, renderdata=None):\n mainFileDict = {}\n mainFilePath = path\n mainFileStem = os.path.basename(path)[:-5]\n mainFileDir = os.p...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class SpiderMain(object): <|reserved_special_token_0|> def craw(self, root_url): count = 1 self.urls.add_new_url(root_url) while self.urls.has_new_url(): try: new_url = self.urls.get_new_url() print('craw %d : %s...
flexible
{ "blob_id": "e99a81a5600aad6111bb2694cbda02021ccfd71c", "index": 2817, "step-1": "<mask token>\n\n\nclass SpiderMain(object):\n <mask token>\n\n def craw(self, root_url):\n count = 1\n self.urls.add_new_url(root_url)\n while self.urls.has_new_url():\n try:\n n...
[ 2, 3, 4, 5, 6 ]
line_numbers = input().split(", ") print("Positive:", ", ".join(list(filter((lambda x: int(x) > -1), line_numbers)))) print("Negative:", ", ".join((list(filter((lambda x: int(x) < 0), line_numbers))))) print("Even:", ", ".join((list(filter((lambda x: int(x) % 2 == 0), line_numbers))))) print("Odd:", ", ".join((list(fil...
normal
{ "blob_id": "e4845e5aa949ec523515efc4d7996d647fddabdb", "index": 7060, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Positive:', ', '.join(list(filter(lambda x: int(x) > -1, line_numbers)))\n )\nprint('Negative:', ', '.join(list(filter(lambda x: int(x) < 0, line_numbers))))\nprint('Even:', ', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def latex_formula(form): latex = form.simplify().to_latex(outer=True) if latex: display(Math(latex)) display(Markdown('<details><pre>$' + latex + '$</pre></details>')) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def...
flexible
{ "blob_id": "7f7bd2e9ec1932ccfd8aa900956ce85473ee8dbd", "index": 4668, "step-1": "<mask token>\n\n\ndef latex_formula(form):\n latex = form.simplify().to_latex(outer=True)\n if latex:\n display(Math(latex))\n display(Markdown('<details><pre>$' + latex + '$</pre></details>'))\n\n\n<mask token>...
[ 1, 5, 7, 9, 10 ]
import json import os from subprocess import PIPE, Popen as popen from unittest import TestCase from substra.commands import Config objective = [[{ 'descriptionStorageAddress': 'http://chunantes.substrabac:8001/objective/d5002e1cd50bd5de5341df8a7b7d11b6437154b3b08f531c9b8f93889855c66f/description/', 'key': 'd...
normal
{ "blob_id": "c55b768466309d2e655c9222e0674a6bc2a958b3", "index": 9899, "step-1": "<mask token>\n\n\nclass TestList(TestCase):\n <mask token>\n <mask token>\n\n def test_list_objective(self):\n output = popen(['substra', 'list', 'objective',\n '--config=/tmp/.substra_e2e'], stdout=PIPE)...
[ 4, 6, 8, 9, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class WebApiAppConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class WebApiAppConfig(AppConfig): name = 'WebApiApp' <|reserved_special_token_1|> from djan...
flexible
{ "blob_id": "cc97f70b9d41357f020ea9c59d8b149392a336cc", "index": 9656, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass WebApiAppConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass WebApiAppConfig(AppConfig):\n name = 'WebApiApp'\n", "step-4": "from django.apps impo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def check_version(ctx, _, value): """ Print current version, and check for latest version. Called via 'geocube --version' :param ctx: Application context object (click.Context) :param value: Passed in by Click :return None """ if not value or ctx.resilien...
flexible
{ "blob_id": "0964121d88fad2906311de7532eac52ff784fff6", "index": 8306, "step-1": "<mask token>\n\n\ndef check_version(ctx, _, value):\n \"\"\"\n Print current version, and check for latest version.\n\n Called via 'geocube --version'\n\n :param ctx: Application context object (click.Context)\n :par...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Test_PW_Functions(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_pw_long_enough_min(self): sample_pass = 'abcdadcaabc' expected_result = False result = validate_pw_long(sample_pass) self.assertEqual...
flexible
{ "blob_id": "dc7d75bf43f1ba55673a43f863dd08e99a1c0e0f", "index": 4820, "step-1": "<mask token>\n\n\nclass Test_PW_Functions(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_pw_long_enough_min(self):\n sample_pass = 'abcdadcaabc'\n expected_result = False\n result = val...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Communication(Module): <|reserved_special_token_0|> <|reserved_special_token_0|> def receive(self, length): if not isinstance(length, int): raise Exception('Receive length must be an integer.') return self.port.read(length) <|reserved_spe...
flexible
{ "blob_id": "eab5bf4776582349615ad56ee1ed93bc8f868565", "index": 768, "step-1": "<mask token>\n\n\nclass Communication(Module):\n <mask token>\n <mask token>\n\n def receive(self, length):\n if not isinstance(length, int):\n raise Exception('Receive length must be an integer.')\n ...
[ 3, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'The apporximate volume is {approxVolume:.2f} liters') <|reserved_special_token_1|> <|reserved_special_token_0|> width = float(input('Enter the width of the tire in mm (ex 205): ')) aspectRatio = float(input('Enter the a...
flexible
{ "blob_id": "65752c8ac50205df0fea105123935110e4a30aba", "index": 7913, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'The apporximate volume is {approxVolume:.2f} liters')\n", "step-3": "<mask token>\nwidth = float(input('Enter the width of the tire in mm (ex 205): '))\naspectRatio = float(inpu...
[ 0, 1, 2, 3, 4 ]
import glob import os import partition import pickle import matplotlib.pyplot as plt import numpy as np from Cluster import fishermans_algorithm import argparse parser = argparse.ArgumentParser() plt.ion() parser.add_argument("--fish", help="flag for using fisherman's algorithm") parser.add_argument("--heat", help="...
normal
{ "blob_id": "805bc144a4945b46b398853e79ded17370ada380", "index": 3940, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.ion()\nparser.add_argument('--fish', help=\"flag for using fisherman's algorithm\")\nparser.add_argument('--heat', help='flag for using heatmap')\nparser.add_argument('--object', help...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class MovingAverage(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class MovingAverage(object): def __init__(self, size): """ Initialize your data structure here. :type s...
flexible
{ "blob_id": "9e37b728d8045726aef7625fccc14111ecb0e1c8", "index": 5578, "step-1": "<mask token>\n", "step-2": "class MovingAverage(object):\n <mask token>\n <mask token>\n", "step-3": "class MovingAverage(object):\n\n def __init__(self, size):\n \"\"\"\n Initialize your data structure h...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while abs(t0 - time.time() < 60): pass <|reserved_special_token_1|> <|reserved_special_token_0|> t0 = time.time() while abs(t0 - time.time() < 60): pass <|reserved_special_token_1|> import time t0 = time.time() while...
flexible
{ "blob_id": "9a0e37aaa41f3b21ed7ad11096cd6c5dd0bb8564", "index": 5608, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile abs(t0 - time.time() < 60):\n pass\n", "step-3": "<mask token>\nt0 = time.time()\nwhile abs(t0 - time.time() < 60):\n pass\n", "step-4": "import time\nt0 = time.time()\nwh...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @pytest.mark.usefixtures('driver') class Test_001_ShedulePage: <|reserved_special_token_0|> <|reserved_special_token_0|> def test_001_elements_exists(self, driver): """тапнуть на фичерс, тапнуть на смотреть расписание, найти кнопку отмены, кнопку карты...
flexible
{ "blob_id": "c7c412fe4e2d53af1b4f2a55bd3453496767890d", "index": 975, "step-1": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass Test_001_ShedulePage:\n <mask token>\n <mask token>\n\n def test_001_elements_exists(self, driver):\n \"\"\"тапнуть на фичерс,\n тапнуть на смотреть ...
[ 4, 5, 6, 7 ]
from .models import Owner, Vehicle from rest_framework import viewsets, permissions from .serializers import OwnerSerializer, VehicleSerializer class OwnerViewSet(viewsets.ModelViewSet): queryset = Owner.objects.all().order_by('id') serializer_class = OwnerSerializer permission_classes = [permissions.IsAu...
normal
{ "blob_id": "9290294b5df081ef0cae5450a9ea3baef789c041", "index": 6421, "step-1": "<mask token>\n\n\nclass VehicleViewSet(viewsets.ModelViewSet):\n queryset = Vehicle.objects.all().order_by('id')\n serializer_class = VehicleSerializer\n permission_classes = [permissions.IsAuthenticated]\n", "step-2": "...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class DuplicatedBlockException(Exception): <|reserved_special_token_0|> <|reserved_special_token_1|> class DuplicatedBlockException(Exception): code = 'duplicated_block_exception'
flexible
{ "blob_id": "983e3b2902fe3bc701167da2f308fdaed612ae84", "index": 1784, "step-1": "<mask token>\n", "step-2": "class DuplicatedBlockException(Exception):\n <mask token>\n", "step-3": "class DuplicatedBlockException(Exception):\n code = 'duplicated_block_exception'\n", "step-4": null, "step-5": null,...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.asyncio async def test_ping_once(): async with pair_of_connected_hosts() as (host_a, host_b): stream = await host_b.new_stream(host_a.get_id(), (ID,)) some_ping = secrets.token_bytes(PING_LENGTH)...
flexible
{ "blob_id": "0233b46da3b9351f110ffc7f8622ca8f9ee9944d", "index": 3000, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.asyncio\nasync def test_ping_once():\n async with pair_of_connected_hosts() as (host_a, host_b):\n stream = await host_b.new_stream(host_a.get_id(), (ID,))\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': carpeta = Carpeta(settings.folder_sat) sentinela = SentinelSat(carpeta) sentinela.start_Monitoring() <|reserved_special_token_1|> from LibTools.filesystem import Carpeta from slaves import...
flexible
{ "blob_id": "9e3f4484542c2629d636fcb4166584ba52bebe21", "index": 2196, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n carpeta = Carpeta(settings.folder_sat)\n sentinela = SentinelSat(carpeta)\n sentinela.start_Monitoring()\n", "step-3": "from LibTools.filesystem im...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # @File : config.py # @Author: TT # @Email : tt.jiaqi@gmail.com # @Date : 2018/12/4 # @Desc : config file from utils.general import getchromdriver_version from chromedriver.path import path import os import sys chromedriver = os.path.abspath(os.path.dirname(__file__)) + "\\chromedriver\\"+ g...
normal
{ "blob_id": "5b4a196de60a3a30bc571c559fe5f211563b8999", "index": 5449, "step-1": "<mask token>\n", "step-2": "<mask token>\nchromedriver = os.path.abspath(os.path.dirname(__file__)\n ) + '\\\\chromedriver\\\\' + getchromdriver_version()\ndownload_path = os.path.abspath(os.path.dirname(__file__)) + '\\\\'\nS...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Window: def __init__(self, width, height, title='MyWindow', resizable=(False, False), icon='resources/feather.ico'): self.root = Tk() self.root.title(title) self.root.geometry('+600+300') if icon: self.root.iconbitmap(icon) ...
flexible
{ "blob_id": "02d4e1ddb0b4cf75c9902e13263c5a80417de01b", "index": 6530, "step-1": "<mask token>\n\n\nclass Window:\n\n def __init__(self, width, height, title='MyWindow', resizable=(False, \n False), icon='resources/feather.ico'):\n self.root = Tk()\n self.root.title(title)\n self.r...
[ 8, 9, 10, 12, 14 ]