code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
plik=open("nowy_zad_84.txt", "w") print(" Podaj 5 imion") for i in range(1,6): imie=input(f" Podaj imie nr {i} ") # plik.write(imie) # plik.write("\n") plik.write(f" {imie} \n") plik.close() plik=open("nowy_zad_84.txt", "a") for i in range(1,101): plik.write(str(i)) plik.w...
normal
{ "blob_id": "0ac99e2b33f676a99674c9a8e5d9d47c5bce084b", "index": 5820, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Podaj 5 imion')\nfor i in range(1, 6):\n imie = input(f' Podaj imie nr {i} ')\n plik.write(f' {imie} \\n')\nplik.close()\n<mask token>\nfor i in range(1, 101):\n plik.wri...
[ 0, 1, 2, 3 ]
import numpy as np import math import datetime def multi_strassen(A,B, check_ig = True, check_quad = True, check_pot = True, check_time = True): def Strassen(matriz_1,matriz_2): # Função do algoritmo de Strassen para multiplicação de matrizes do tipo 2x2 if (matriz_1.shape[0] != 2) or (matriz_1.shape[...
normal
{ "blob_id": "6707723b3d0b42271e49c08c639afc9103066dc7", "index": 4679, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef multi_strassen(A, B, check_ig=True, check_quad=True, check_pot=True,\n check_time=True):\n\n def Strassen(matriz_1, matriz_2):\n if matriz_1.shape[0] != 2 or matriz_1...
[ 0, 1, 2, 3 ]
from django import forms from django.forms import widgets # from product.models import PRODUCT_OTHER_CHOICE, PRODUCT_CATEGORY_CHOICES PRODUCT_OTHER_CHOICE = 'other' PRODUCT_CATEGORY_CHOICES = ( (PRODUCT_OTHER_CHOICE, 'Разное'), ('food', 'Еда'), ('drink', 'Вода'), ('cloth', 'Одежда'), ('electronics'...
normal
{ "blob_id": "e8a024796b6426e572571e46030678e90c537229", "index": 7549, "step-1": "<mask token>\n\n\nclass ProductForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass FindForm(forms.Form):\n name = forms.CharField(max_length=100, label='Наименов...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def test_burst_evolved(): """Test burst() in EvolvedCluster""" cluster = p22.EvolvedCluster('..#\n#..\n...') assert cluster.infected[p22.Position(0, 2)] == p22.State.Infected assert cluster.infected[p22.Position(1, 0)] == p22.State.Infected assert cluster.infected[p22....
flexible
{ "blob_id": "f0a3778e74d113a5de778fa17ec321c6680c56c2", "index": 1143, "step-1": "<mask token>\n\n\ndef test_burst_evolved():\n \"\"\"Test burst() in EvolvedCluster\"\"\"\n cluster = p22.EvolvedCluster('..#\\n#..\\n...')\n assert cluster.infected[p22.Position(0, 2)] == p22.State.Infected\n assert clu...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Publisher: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TopicPublisher(Publisher): def __init__(self, exchange_name, channel, routing_key=None): ...
flexible
{ "blob_id": "8205541dcdd4627a535b14c6775f04b80e7c0d15", "index": 3354, "step-1": "<mask token>\n\n\nclass Publisher:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TopicPublisher(Publisher):\n\n def __init__(self, exchange_name, channel, routing_key=None):...
[ 7, 9, 12, 13, 15 ]
def pin(): print('wqeqwwqe') <|reserved_special_token_0|> <|reserved_special_token_1|> def pin(): print('wqeqwwqe') <|reserved_special_token_0|> window.title('爱你吆') window.geometry('400x400+800+200') window.protocol('WM_DELETE_WINDOW') <|reserved_special_token_0|> label.grid(row=10, column=10) <|reserved...
flexible
{ "blob_id": "55c9fe8caf1983f22d5a752574f590fa129e8017", "index": 1443, "step-1": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\n", "step-2": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\nwindow.title('爱你吆')\nwindow.geometry('400x400+800+200')\nwindow.protocol('WM_DELETE_WINDOW')\n<mask token>\nl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> bot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN')) <|reserved_special_token_1|> import os import telebot bot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN'))
flexible
{ "blob_id": "ce7b7980d1e93f23e7e3ef048ddadc0c779ef9ce", "index": 7981, "step-1": "<mask token>\n", "step-2": "<mask token>\nbot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN'))\n", "step-3": "import os\nimport telebot\nbot = telebot.TeleBot(os.environ.get('TELEGRAM_ACCESS_TOCKEN', 'TOKEN'...
[ 0, 1, 2 ]
import pytest import numpy as np from GSPA_DMC import SymmetrizeWfn as symm def test_swap(): cds = np.load('h3o_data/ffinal_h3o.npy') dws = np.load('h3o_data/ffinal_h3o_dw.npy') cds = cds[:10] a = symm.swap_two_atoms(cds, dws, atm_1=1, atm_2=2) b = symm.swap_group(cds, dws, atm_list_1=[0, 1], atm_...
normal
{ "blob_id": "4ecd756b94b0cbab47a8072e9bccf26e2dd716d0", "index": 7833, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_swap():\n cds = np.load('h3o_data/ffinal_h3o.npy')\n dws = np.load('h3o_data/ffinal_h3o_dw.npy')\n cds = cds[:10]\n a = symm.swap_two_atoms(cds, dws, atm_1=1, atm...
[ 0, 1, 2 ]
#coding=utf-8 from __future__ import division import os def judgeReported(evi, content): for item in evi['reported']: flag = content.find(item) if flag > 0: return 'Y' for item in evi['properly']['neg']: flag = content.find(item) if flag > 0: return...
normal
{ "blob_id": "064f535b7ea0f1e4a09bdf830021f17d175beda7", "index": 4422, "step-1": "#coding=utf-8\n\nfrom __future__ import division\nimport os\n \ndef judgeReported(evi, content):\n for item in evi['reported']:\n flag = content.find(item)\n if flag > 0:\n return 'Y'\n for item i...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class __module_protocol__(typing.Protocol): cmdline: org.cogroo.gc.cmdline.__module_protocol__ <|reserved_special_token_1|> import org.cogroo.gc.cmdline import typing class __module_protocol__(typing.Protocol): cmdl...
flexible
{ "blob_id": "f615e7bbfa9179d0bfb321242cd8df4ae7b48993", "index": 3181, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass __module_protocol__(typing.Protocol):\n cmdline: org.cogroo.gc.cmdline.__module_protocol__\n", "step-3": "import org.cogroo.gc.cmdline\nimport typing\n\n\nclass __module_pr...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib.pyplot as plt def cos_Taylor2(x, n): s = 0 a = 1 for i in range(0, n+1): s = s+a a = -a*x**2 / ((2*i+1)*(2*i+2)) return s, abs(a) vcos = np.vectorize(cos_Taylor2) def cos_two_terms(x): s = 0 a = 1 s = s+a a = -a*x**2 / ((2*0+1)*(2*...
normal
{ "blob_id": "fb0dcb641dfb379751264dc0b18007f5d058d379", "index": 3520, "step-1": "<mask token>\n\n\ndef cos_two_terms(x):\n s = 0\n a = 1\n s = s + a\n a = -a * x ** 2 / ((2 * 0 + 1) * (2 * 0 + 2))\n s = s + a\n a = -a * x ** 2 / ((2 * 1 + 1) * (2 * 1 + 2))\n s = s + a\n a = -a * x ** 2 /...
[ 2, 4, 5, 6, 7 ]
str="mama" stringlength=len(str) slicedString=str[stringlength::-1] print (slicedString)
normal
{ "blob_id": "5c80561a3344c0240e59500e5dadc1f1ef7f380e", "index": 7687, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(slicedString)\n", "step-3": "str = 'mama'\nstringlength = len(str)\nslicedString = str[stringlength::-1]\nprint(slicedString)\n", "step-4": "str=\"mama\"\r\nstringlength=len(str...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Enter string:') <|reserved_special_token_0|> for i in a: if i in vowels: v += 1 elif i in consonants: c += 1 elif i in digits: d += 1 elif i in whitespace: ws += 1 print(v, c, d, ws) <|reserved_special_...
flexible
{ "blob_id": "088c77e090d444e7057a91cac606995fb523c8ef", "index": 3079, "step-1": "<mask token>\n", "step-2": "print('Enter string:')\n<mask token>\nfor i in a:\n if i in vowels:\n v += 1\n elif i in consonants:\n c += 1\n elif i in digits:\n d += 1\n elif i in whitespace:\n ...
[ 0, 1, 2, 3 ]
""" Program file: DataParser.py. This program parses and returns a dataset for a plotting program """ from sys import exit from csv import Sniffer, DictReader class DataParser: """ Summary: parses a data file, and returns list of the filtered data. Instances: 1. accepted_records 2. ignored_reco...
normal
{ "blob_id": "af609f1558276bab96477d3a2c61d813b9dd3d82", "index": 9660, "step-1": "<mask token>\n\n\nclass DataParser:\n <mask token>\n\n def __init__(self, csvfile, data_centers):\n \"\"\"DataParser constructor.\"\"\"\n self.accepted_records = []\n self.ignored_records = []\n wi...
[ 5, 6, 7, 8, 9 ]
import numpy as np from flask import Flask,request,render_template import pickle from werkzeug.serving import run_simple app=Flask(__name__,template_folder='template') model=pickle.load(open("model.pkl",'rb')) @app.route('/') def home(): return render_template('index.html') @app.route('/predict',me...
normal
{ "blob_id": "02b760b16cdcd42f8d8d7222b439da87fb8076a3", "index": 4959, "step-1": "<mask token>\n\n\n@app.route('/predict', methods=['POST'])\ndef predict():\n arr = [int(x) for x in request.form.values()]\n arr2 = [np.array(arr)]\n output = model.predict(arr2)\n return render_template('index.html', p...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate_parameters(seed): np.random.seed(seed) out = {} out['nfeatures'] = np.random.randint(3, 25) out['lr'] = float(loguniform.rvs(0.001, 0.01, size=1)) out['gamma'] = np.random.uniform(0.75, 0.05) ...
flexible
{ "blob_id": "7571e86be1077ae0f7ae542824cfcaaa2949dc83", "index": 8731, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_parameters(seed):\n np.random.seed(seed)\n out = {}\n out['nfeatures'] = np.random.randint(3, 25)\n out['lr'] = float(loguniform.rvs(0.001, 0.01, size=1))\n ...
[ 0, 1, 2, 3, 4 ]
class Solution: def toGoatLatin(self, S: str) -> str: def exchange(str2): if str2[0] in "aeiou": str2 = str2+"ma" else: str2 = str2[1:]+str2[0]+"ma" list2 = S.split(" ") for i in list2: res.append(exchange(i)) ...
normal
{ "blob_id": "398c28265e61831ba65b4ae2a785e57c0fa5b6d2", "index": 8311, "step-1": "\n\n\nclass Solution:\n def toGoatLatin(self, S: str) -> str:\n \n def exchange(str2):\n if str2[0] in \"aeiou\":\n str2 = str2+\"ma\"\n else:\n str2 = str2[1:]+s...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.config_from_object('task.config') if __name__ == '__main__': app.start() <|reserved_special_token_1|> <|reserved_special_token_0|> app = Celery('task', include=['task.tasks']) app.config_from_object('task.config') if __...
flexible
{ "blob_id": "68d9f77f91a13c73373c323ef0edbe18af9990a3", "index": 4321, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config_from_object('task.config')\nif __name__ == '__main__':\n app.start()\n", "step-3": "<mask token>\napp = Celery('task', include=['task.tasks'])\napp.config_from_object('tas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def call_func(some_func, argument): return some_func(argument) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def call_func(some_func, argument): return some_func(argument) def main(argument): """docstring""" return call_fun...
flexible
{ "blob_id": "2a3c3112122dee5574a1569155287ea3e5f8c7b2", "index": 6120, "step-1": "<mask token>\n\n\ndef call_func(some_func, argument):\n return some_func(argument)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef call_func(some_func, argument):\n return some_func(argument)\n\n\ndef main(argument):...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def tanh(x): return np.tanh(x) def tanh_deriv(x): return 1.0 - np.tanh(x) * np.tanh(x) <|reserved_special_token_0|> class NeuralNetwork: def __init__(self, layers, activation='tanh'): """ :param layers: A list containing the number of units in each layer...
flexible
{ "blob_id": "a6a5fddb8e1eda4cc8e9c79ad83019f55d149a80", "index": 2988, "step-1": "<mask token>\n\n\ndef tanh(x):\n return np.tanh(x)\n\n\ndef tanh_deriv(x):\n return 1.0 - np.tanh(x) * np.tanh(x)\n\n\n<mask token>\n\n\nclass NeuralNetwork:\n\n def __init__(self, layers, activation='tanh'):\n \"\"...
[ 6, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class Chunk_CleanSentences(Resource): <|reserved_special_token_0|> parser.add_argument('text', type=str, required=True, help= 'გთხოვთ შეიყვანოთ სწორი წინადადება') def get(self): data = Chunk_CleanSentences.parser.parse_args() text = data['text'] ...
flexible
{ "blob_id": "6d042a2035eab579193452e4dc44c425125d9515", "index": 9402, "step-1": "<mask token>\n\n\nclass Chunk_CleanSentences(Resource):\n <mask token>\n parser.add_argument('text', type=str, required=True, help=\n 'გთხოვთ შეიყვანოთ სწორი წინადადება')\n\n def get(self):\n data = Chunk_Cle...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> BASEDIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) DATA_DIR = os.path.join(BASEDIR, 'data') DATA_FILE = os.path.join(DATA_DIR, 'data.yaml') <|reserved_special_token_1|> import os BASEDIR = os.path.abspath(os....
flexible
{ "blob_id": "7a793c2081032745ae58f92a4572954333742dfd", "index": 3943, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASEDIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))\nDATA_DIR = os.path.join(BASEDIR, 'data')\nDATA_FILE = os.path.join(DATA_DIR, 'data.yaml')\n", "step-3": "import os...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Server(Socket): def __init__(self): super(Server, self).__init__() print('server listening') self.users = [] def set_up(self): self.bind(('192.168.0.109', 1337)) self.listen(0) self.accept_sockets() def send_data(self, d...
flexible
{ "blob_id": "2027904401e5be7b1c95eebec3a1e6a88c25660c", "index": 9338, "step-1": "<mask token>\n\n\nclass Server(Socket):\n\n def __init__(self):\n super(Server, self).__init__()\n print('server listening')\n self.users = []\n\n def set_up(self):\n self.bind(('192.168.0.109', 13...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def get_subset(A, k, n): a_list = [i for i in A] if len(a_list) == k: result.append(a_list) return s_num = max(a_list) + 1 if a_list else 1 for i in range(s_num, n + 1): a_list.append(i) get_subset(a_list, k, n) a_list.remove(i) <|...
flexible
{ "blob_id": "d48353caa07d3bfa003ea9354b411fe0c79591db", "index": 2725, "step-1": "<mask token>\n\n\ndef get_subset(A, k, n):\n a_list = [i for i in A]\n if len(a_list) == k:\n result.append(a_list)\n return\n s_num = max(a_list) + 1 if a_list else 1\n for i in range(s_num, n + 1):\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ciscoLwappClRoamMIB.setRevisions(('2010-01-29 00:00', '2006-04-11 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoLwappClRoamMIB.setRevisionsDescriptions(( '...
flexible
{ "blob_id": "76fbe055b53af9321cc0d57a210cfffe9188f800", "index": 6531, "step-1": "<mask token>\n", "step-2": "<mask token>\nciscoLwappClRoamMIB.setRevisions(('2010-01-29 00:00', '2006-04-11 00:00'))\nif getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):\n if mibBuilder.loadTexts:\n ciscoLwappClRo...
[ 0, 1, 2, 3 ]
#a list of functions/Classes to be inported when a user imports * from swarmpose __all__ = ['Swarmpose']
normal
{ "blob_id": "e375501e6b815530e61af9181d4cade83d4588ca", "index": 8762, "step-1": "<mask token>\n", "step-2": "__all__ = ['Swarmpose']\n", "step-3": "#a list of functions/Classes to be inported when a user imports * from swarmpose\n__all__ = ['Swarmpose']", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
# Generated by Django 3.1.2 on 2020-10-21 21:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('monitoring', '0002_auto_20201021_0027'), ] operations = [ migrations.AlterField( model_name='endpoint', name='freque...
normal
{ "blob_id": "20f56ff484321a7d623cead4315e5a6b3b0653a7", "index": 2720, "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 = [('monitoring'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def hello_world(): return '你好' @app.route('/test1/<name>') def test1(name): return '你好,%s' % name @app.route('/test2/<int:id>') def test2(id): return '你好,%d' % id <|reserved_special_token_0|> @app.route('/test/register') def register(): return rende...
flexible
{ "blob_id": "d68bd9c90a106a9eac767607ad77bdd84d0f18d2", "index": 1006, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello_world():\n return '你好'\n\n\n@app.route('/test1/<name>')\ndef test1(name):\n return '你好,%s' % name\n\n\n@app.route('/test2/<int:id>')\ndef test2(id):\n return '你好,%d' % id\n\n\n<...
[ 5, 6, 7, 9, 10 ]
import abc import hashlib import hmac from typing import Any, Dict from urllib.parse import urlencode class IceCubedClientABC(abc.ABC): @abc.abstractproperty def _has_auth_details(self) -> bool: pass @abc.abstractmethod def sign(self, params: Dict[str, Any]) -> str: pass class IceCu...
normal
{ "blob_id": "8bd918896fb72c89a622ba4e18666bb90755cafd", "index": 4545, "step-1": "<mask token>\n\n\nclass IceCubedClientBase(IceCubedClientABC):\n BASE_URI = 'https://ice3x.com/api/v1/'\n\n def __init__(self, api_key: str=None, secret: str=None) ->None:\n \"\"\"Instantiate the client\n\n Args...
[ 5, 6, 7, 9, 10 ]
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% [markdown] # ### Bài tập 1. # - <ins>Yêu cầu</ins>: Ý tưởng cơ bản của thuật toán ``Support Vector Machine`` (``SVM``) là gì? Ý tưởng của thuật toán biên mềm (``soft margin``) ``SVM``. Nêu ý nghĩa của siêu tham số ``C`` trong bà...
normal
{ "blob_id": "1b1b646a75fe2ff8d54e66d025b60bde0c9ed2d6", "index": 9361, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.pivot_table(index=['classes'], aggfunc='size')\n<mask token>\nfor n in np.arange(0.5, C_parameter, 0.5):\n clf = svm.SVC(C=n).fit(X_train, y_train)\n yhat = clf.predict(X_test)\n...
[ 0, 1, 2, 3, 4 ]
def maxProduct(self, A): size= len(A) if size==1: return A[0] Max=[A[0]] Min=[A[0]] for i in range(1,size): Max.append(max(max(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) Min.append(min(min(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) tmax=Max[0] ...
normal
{ "blob_id": "1fafbc1e415b5089afcd2976d4f0dc2aa1c5a144", "index": 1077, "step-1": " def maxProduct(self, A):\n size= len(A)\n if size==1:\n return A[0]\n Max=[A[0]]\n Min=[A[0]]\n for i in range(1,size):\n Max.append(max(max(Max[i-1]*A[i],Min[i-1]*A[i]),...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AlertMailModel(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "2872c86294037b4585158e7ff6db414ba7ab90cc", "index": 1814, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AlertMailModel(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test(data): actions.navigate(data.env.url + 'tabs/') actions.send_keys('#title', 'lorem ipsum') actions.click('#goButtonCustom') actions.assert_amount_of_windows(2) actions.close_window_by_partial_title('...
flexible
{ "blob_id": "8fe45332ce09195beabb24c8cbb56868c564ded4", "index": 2132, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test(data):\n actions.navigate(data.env.url + 'tabs/')\n actions.send_keys('#title', 'lorem ipsum')\n actions.click('#goButtonCustom')\n actions.assert_amount_of_windo...
[ 0, 1, 2, 3 ]
def koodrinate(kraj, kraji): for ime, x, y in kraji: if ime == kraj: return x, y kraji = { 'Brežice': (68.66, 7.04), 'Lenart': (85.20, 78.75), 'Rateče': (-65.04, 70.04), 'Ljutomer': (111.26, 71.82), 'Rogaška Slatina': (71.00, 42.00), 'Ribnica': (7.10, -10.50), 'Duto...
normal
{ "blob_id": "2cfc1bea6dd1571eff67c3f49b2a1899560c7ba7", "index": 3469, "step-1": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n return x, y\n\n\n<mask token>\n", "step-2": "def koodrinate(kraj, kraji):\n for ime, x, y in kraji:\n if ime == kraj:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def cnct_cb(): print('Connected: ') <|reserved_special_token_0|> def _funCb(ACT): result = instance.read() if result.is_valid(): strTemp = '%.2f' % result.temperature strHumi = '%.2f' % result.humidity oled.yell2('Temp=' + strTemp, 'Humi=' + strHumi...
flexible
{ "blob_id": "e95ebb2aa6526e3bf3789da17d144e71cdb49aca", "index": 2712, "step-1": "<mask token>\n\n\ndef cnct_cb():\n print('Connected: ')\n\n\n<mask token>\n\n\ndef _funCb(ACT):\n result = instance.read()\n if result.is_valid():\n strTemp = '%.2f' % result.temperature\n strHumi = '%.2f' % ...
[ 2, 3, 4, 5, 6 ]
import json import os from lib.create import create_server, create_user os.chdir(r'/home/niko/data/Marvin') def edit_user_stats(server_id: str, user_id: str, stat: str, datas): create_user(server_id, user_id) if os.path.isfile("Server/{}/user.json".format(server_id)): with open("Server/{}...
normal
{ "blob_id": "e6d506dd45e72ee7f0162a884981ee1156153d3d", "index": 8661, "step-1": "<mask token>\n\n\ndef edit_user_stats(server_id: str, user_id: str, stat: str, datas):\n create_user(server_id, user_id)\n if os.path.isfile('Server/{}/user.json'.format(server_id)):\n with open('Server/{}/user.json'.f...
[ 5, 6, 7, 8, 9 ]
class GameOfLife: @staticmethod def simulate(board): for row in range(len(board)): for col in range(len(board[0])): ones = GameOfLife.countOnes(board, row, col) if board[row][col] and (ones == 2 or ones == 3): board[row][col] |= 2 ...
normal
{ "blob_id": "862c5794a4da794678de419f053ae15b11bca6e7", "index": 7453, "step-1": "class GameOfLife:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class GameOfLife:\n\n @staticmethod\n def simulate(board):\n for row in range(len(board)):\n for col in range(len(boar...
[ 1, 2, 3, 4 ]
import json import os, django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dangjianyun.settings")# project_name 项目名称 django.setup() from dangjiansite.djfuncs import * import os import datetime import requests import time import urllib3 import base64 import csv import random from bs4 import Beautifu...
normal
{ "blob_id": "55a26eb2625acb201677f5ff50fde809402c9b93", "index": 2630, "step-1": "<mask token>\n\n\nclass Runner:\n\n def __init__(self, appid='TJZHDJ01', username='', password=''):\n urllib3.disable_warnings()\n self.currentTime = datetime.datetime.now().strftime('%H:%M:%S')\n self.usern...
[ 17, 19, 20, 21, 24 ]
"""GI on fast.""" import logging from mpf.core.utility_functions import Util from mpf.platforms.interfaces.gi_platform_interface import GIPlatformInterface class FASTGIString(GIPlatformInterface): """A FAST GI string in a WPC machine.""" def __init__(self, number, sender): """Initialise GI string. ...
normal
{ "blob_id": "91cf6d08be2ad86c08de4dd48b2f35dedc55b4bb", "index": 2177, "step-1": "<mask token>\n\n\nclass FASTGIString(GIPlatformInterface):\n <mask token>\n\n def __init__(self, number, sender):\n \"\"\"Initialise GI string.\n\n TODO: Need to implement the enable_relay and control which stri...
[ 3, 4, 5, 6, 7 ]
""" Exercise 3 from the Python tutorial Part 1 on: https://codeandwork.github.io/courses/prep/pythonTutorial1.html """ import math print("Give the length of each side in order to compute the area of a triangle.") lenA = float(input("Give the length of side A:")) lenB = float(input("Give the length of side B:")) len...
normal
{ "blob_id": "398cb05218a9772a0b62fdfbacc465b26427827d", "index": 2854, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Give the length of each side in order to compute the area of a triangle.')\n<mask token>\nprint('The triangle area is:', triangleArea)\n", "step-3": "<mask token>\nprint(\n...
[ 0, 1, 2, 3, 4 ]
import sys import os import numpy as np import math sys.path.append("../") from sir.improveagent import * import numpy as np import numpy.linalg as la import matplotlib.pyplot as plt #from sklearn.neighbors import BallTree from scipy.spatial import KDTree from scipy.spatial import cKDTree from scipy.spatial.distance im...
normal
{ "blob_id": "92317996f884befd646138cd3a3dc3f8345679f4", "index": 2122, "step-1": "<mask token>\n\n\ndef run_Simulation2(k, N=100, T=10, start=1, p=0.5, q=0.08, startcenter=\n False, startcorner=False):\n \"\"\"\n run the simulation for the pop\n \"\"\"\n recover = [0]\n infect = [start]\n su...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Admin.ui' # # Created by: PyQt5 UI code generator 5.12 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets from qtpandas.views.DataTableView import DataTableWidget from qtpandas.models.DataFra...
normal
{ "blob_id": "5e2a8e95af88a582b6e760a53dfd41f880d66963", "index": 2670, "step-1": "<mask token>\n\n\nclass Ui_Admin(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Admin(object):\n\n def setupUi(self, Admin):\n Admin.setObjectName('Admin')\n Admin.resize(6...
[ 1, 2, 3, 4, 5 ]
import random from datetime import timedelta from typing import Union, Type, Tuple, List, Dict from django import http from django.test import TestCase, Client from django.utils import timezone from exam_web import errors from exam_web.models import Student, AcademyGroup, uuid_str, ExamSession, \ UserSession, Que...
normal
{ "blob_id": "44e4151279884ce7c5d5a9e5c82916ce2d3ccbc2", "index": 9789, "step-1": "<mask token>\n\n\nclass TestGetExamTickets(ApiTestCase):\n get_exams: ApiClient\n session: ExamSession\n student_session: UserSession\n questions: List[Question]\n tickets: List[ExamTicket]\n ticket_map: Dict[str,...
[ 15, 34, 42, 44, 45 ]
<|reserved_special_token_0|> class ProbabilityNetwork: def __init__(self, n, edges, probs): self.nodes = list(range(n)) self.edges = edges self.probs = probs def parents(self, node): return [a for a, b in edges if b == node] def ancestralOrder(self): order = [] ...
flexible
{ "blob_id": "24fa41f916b54345e4647354f972bd22e130decf", "index": 4016, "step-1": "<mask token>\n\n\nclass ProbabilityNetwork:\n\n def __init__(self, n, edges, probs):\n self.nodes = list(range(n))\n self.edges = edges\n self.probs = probs\n\n def parents(self, node):\n return [a...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: from psycopg2 import connect except: pass <|reserved_special_token_1|> <|reserved_special_token_0|> import pgnumpy import cpgnumpy from pgnumpy import connect from pgnumpy import PgNumpy from pgnumpy import PgInput...
flexible
{ "blob_id": "7e5cf782692d9cfb2718b2efcc83efa2ecb815cd", "index": 1371, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from psycopg2 import connect\nexcept:\n pass\n", "step-3": "<mask token>\nimport pgnumpy\nimport cpgnumpy\nfrom pgnumpy import connect\nfrom pgnumpy import PgNumpy\nfrom pg...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import sys from argparse import ArgumentParser from arg_checks import IsFile, MinInt from visualisation import Visualisation parser = ArgumentParser(description="Visualises DS simulations") # The order of arguments in descending order of file frequency is: config, failures, log. # This should...
normal
{ "blob_id": "1f953b20ff0eb868c2fbff367fafa8b651617e64", "index": 6131, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('config', action=IsFile, help=\n 'configuration file used in simulation')\nparser.add_argument('log', action=IsFile, help=\n 'simulation log file to visualise')\...
[ 0, 1, 2, 3, 4 ]
a = [66.25, 333, 333, 1, 1234.5] a.index(333) print(a)
normal
{ "blob_id": "7aba77137b96071101078c38c1c9397bf837d92a", "index": 1378, "step-1": "<mask token>\n", "step-2": "<mask token>\na.index(333)\nprint(a)\n", "step-3": "a = [66.25, 333, 333, 1, 1234.5]\na.index(333)\nprint(a)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> def fall_asleep(record: WarcRecord): current_uri: str = record.target_uri start_time = str(datetime.now()) process_id = str(os.getpid()) print('@@1 falling asleep in process {} at {} processing {}'.format( process_id, start_time, current_uri)) time.sleep(5) ...
flexible
{ "blob_id": "fccdf75fe83ad8388c12a63555c4132181fd349a", "index": 1646, "step-1": "<mask token>\n\n\ndef fall_asleep(record: WarcRecord):\n current_uri: str = record.target_uri\n start_time = str(datetime.now())\n process_id = str(os.getpid())\n print('@@1 falling asleep in process {} at {} processing...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # ---------------------------------------------------------- # RJGlass Main Program version 0.2 8/1/07 # ---------------------------------------------------------- # Copyright 2007 Michael LaBrie # # This file is part of RJGlass. # # RJGlass is free software; you can redistribute it and/or ...
normal
{ "blob_id": "aafadcbf946db8ed85e3df48f5411967ec35c318", "index": 7333, "step-1": "#!/usr/bin/env python\n# ----------------------------------------------------------\n# RJGlass Main Program version 0.2 8/1/07\n# ----------------------------------------------------------\n# Copyright 2007 Michael LaBrie\n#\n# ...
[ 0 ]
<|reserved_special_token_0|> class TestCategory(TestCase): def test_str(self): category = Category(name='Test Category') self.assertEquals(str(category), 'Test Category') class TestTag(TestCase): def test_str(self): tag = Tag(name='Test Tag') self.assertEquals(str(tag), 'Te...
flexible
{ "blob_id": "825c9510b055c0fa570f577b1c9616e8bde9c98b", "index": 7653, "step-1": "<mask token>\n\n\nclass TestCategory(TestCase):\n\n def test_str(self):\n category = Category(name='Test Category')\n self.assertEquals(str(category), 'Test Category')\n\n\nclass TestTag(TestCase):\n\n def test_...
[ 4, 5, 6, 7, 8 ]
# project/tests/test_tmdb.py import unittest import json from project.server import db from project.server.models import Tmdb from project.tests.base import BaseTestCase class TestTmdb(BaseTestCase): """ Testing if we have the good responses from the api """ def test_discover(self): """ Tes...
normal
{ "blob_id": "9e9403ea1c128e07803d080b337003055759c5ae", "index": 4507, "step-1": "<mask token>\n\n\nclass TestTmdb(BaseTestCase):\n <mask token>\n\n def test_discover(self):\n \"\"\" Testing the TMDB API discover endpoint \"\"\"\n response = Tmdb.discover()\n self.assertTrue(int(respon...
[ 4, 5, 6, 7, 10 ]
for row in range(7): for col in range(5): if (col == 0) or (row % 3 == 0): print("*", end=" ") else: print(" ", end=" ") print()
normal
{ "blob_id": "634c826d30b22c6061531c514914e9ca62b21605", "index": 7158, "step-1": "<mask token>\n", "step-2": "for row in range(7):\n for col in range(5):\n if col == 0 or row % 3 == 0:\n print('*', end=' ')\n else:\n print(' ', end=' ')\n print()\n", "step-3": "for r...
[ 0, 1, 2 ]
""" Day 2 """ with open('input.txt', 'r') as f: lines = f.read() lines = lines.split('\n')[:-1] lines = [l.split(' ') for l in lines] valid = 0 new_valid = 0 for cur_pw in lines: letter = cur_pw[1].strip(':') amount = cur_pw[2].count(letter) rule = cur_pw[0].split('-') rule = [int(r) for r in ru...
normal
{ "blob_id": "46a3c3777d90976c7d39772d2e94430506d3acd7", "index": 8025, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('input.txt', 'r') as f:\n lines = f.read()\n<mask token>\nfor cur_pw in lines:\n letter = cur_pw[1].strip(':')\n amount = cur_pw[2].count(letter)\n rule = cur_pw[0]....
[ 0, 1, 2, 3 ]
""" Unpacks and preprocesses all of the data from the tarball of partial data, which includes the flats and dark frames. """ import tools.unpack import util.files import util.dark import util.flat def main(): tools.unpack.main() util.files.main() util.dark.main() util.flat.main() if __name__ == '__m...
normal
{ "blob_id": "3667651697ac1c093d48fe2c4baa4b4dbdf20f8a", "index": 6832, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n tools.unpack.main()\n util.files.main()\n util.dark.main()\n util.flat.main()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n tools.unp...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MoveActorsAction(Action): <|reserved_special_token_0|> def execute(self, cast): """Executes the action using the given actors. Args: cast (dict): The game actors {key: tag, value: list}. """ for group in cast.values(): ...
flexible
{ "blob_id": "3be7183b5c1d86ee0ebfdea89c6459efe89510f8", "index": 6103, "step-1": "<mask token>\n\n\nclass MoveActorsAction(Action):\n <mask token>\n\n def execute(self, cast):\n \"\"\"Executes the action using the given actors.\n\n Args:\n cast (dict): The game actors {key: tag, va...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- file1 = raw_input("Enter the path of your first file: ") file2 = raw_input("Enter the path of your second file: ") Basex = open(file1).read().split() Basey = open(file2).read().split() if Basex != Basey: print("The files are different!") else: print("The files are the same!")
normal
{ "blob_id": "661d82adc7d0746635fb57abf6d0e70ee615ada4", "index": 5974, "step-1": "<mask token>\n", "step-2": "<mask token>\nif Basex != Basey:\n print('The files are different!')\nelse:\n print('The files are the same!')\n", "step-3": "file1 = raw_input('Enter the path of your first file: ')\nfile2 = r...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url from django.contrib.auth.views import login, logout from django.contrib import admin from magmag_core.app import application from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf.urls.static import static from mag...
normal
{ "blob_id": "538e582df7bfcf281973a5296adc14ca067be0a5", "index": 2581, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\nurlpatterns += staticfiles_urlpatterns()\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n", "step-3": "<mask token>\na...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.get('https://www.facebook.com') <|reserved_special_token_0|> print(soup.prettify()) driver.close() <|reserved_special_token_1|> <|reserved_special_token_0|> driver = webdriver.Chrome('/Users/UserName/Downloads/chromedriv...
flexible
{ "blob_id": "03b2b722832eb46f3f81618f70fd0475f1f08c94", "index": 2997, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.facebook.com')\n<mask token>\nprint(soup.prettify())\ndriver.close()\n", "step-3": "<mask token>\ndriver = webdriver.Chrome('/Users/UserName/Downloads/chromedriv...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @override_settings(RETHINK_DB_DB=os.environ.get('RETHINK_DB_DB', 'django_rethinkci')) class APITests(TestCase): @classmethod def setUpClass(cls): super(APITests, cls).setUpClass() cls.conn = r.connect(host=settings.RETHINK_DB_HOST, port=settings. R...
flexible
{ "blob_id": "d5d12e2269b343dde78534eddf2cce06759eb264", "index": 9128, "step-1": "<mask token>\n\n\n@override_settings(RETHINK_DB_DB=os.environ.get('RETHINK_DB_DB',\n 'django_rethinkci'))\nclass APITests(TestCase):\n\n @classmethod\n def setUpClass(cls):\n super(APITests, cls).setUpClass()\n ...
[ 8, 12, 14, 18, 19 ]
#!/usr/bin/python import glob import pandas as pd import numpy as np manifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0]) mailTypes = pd.read_csv('./mail_types.csv', sep=',', names=['typeId','typeName'], skiprows=[0]) #----- mailTypes['typeId'] = pd.to_numeric(mailTypes['ty...
normal
{ "blob_id": "2ea33fd06be888db5cda86b345f535532d2a05b5", "index": 4268, "step-1": "#!/usr/bin/python \n\nimport glob\nimport pandas as pd\nimport numpy as np\n\nmanifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0])\nmailTypes = pd.read_csv('./mail_types.csv', sep=',', name...
[ 0 ]
from .base import Base class Files(Base): endpoint = "/files" def upload_file(self, channel_id, files): return self.client.post(self.endpoint, data={"channel_id": channel_id}, files=files) def get_file(self, file_id): return self.client.get( self.endpoint + "/" + file_id, ...
normal
{ "blob_id": "0686dec7f3dc23f01ffff41f611a1bb597bb5352", "index": 829, "step-1": "<mask token>\n\n\nclass Files(Base):\n <mask token>\n\n def upload_file(self, channel_id, files):\n return self.client.post(self.endpoint, data={'channel_id':\n channel_id}, files=files)\n\n def get_file(s...
[ 5, 6, 8, 9, 10 ]
from numpy import array, sum def comp_point_ref(self, is_set=False): """Compute the point ref of the Surface Parameters ---------- self : SurfLine A SurfLine object is_set: bool True to update the point_ref property Returns ------- point_ref : complex the refe...
normal
{ "blob_id": "b7721e95cfb509a7c0c6ccdffa3a8ca2c6bd6033", "index": 6713, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef comp_point_ref(self, is_set=False):\n \"\"\"Compute the point ref of the Surface\n\n Parameters\n ----------\n self : SurfLine\n A SurfLine object\n is_set: ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(rak * int(n)) <|reserved_special_token_1|> rak = 'hello\n' n = input() print(rak * int(n)) <|reserved_special_token_1|> rak="hello\n" n=input() print(rak * int(n))
flexible
{ "blob_id": "b0e4042ac4ed54cafedb9e53244c164527559e39", "index": 5406, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(rak * int(n))\n", "step-3": "rak = 'hello\\n'\nn = input()\nprint(rak * int(n))\n", "step-4": "rak=\"hello\\n\"\nn=input()\nprint(rak * int(n)) \n", "step-5": null, "step-i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Trophy(AnimatedSprite): def __init__(self, position, image_dict, hold_for_n_frames=3): super().__init__(position, image_dict, hold_for_n_frames) self.initial_position = position self.frames_alive = 0 <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "883cb1e3ea227bb5ac5aa3b4348336ab1a7fba70", "index": 3476, "step-1": "<mask token>\n\n\nclass Trophy(AnimatedSprite):\n\n def __init__(self, position, image_dict, hold_for_n_frames=3):\n super().__init__(position, image_dict, hold_for_n_frames)\n self.initial_position = position\n ...
[ 2, 3, 4, 5, 6 ]
import re from prometheus_client.core import GaugeMetricFamily class ArrayHardwareMetrics: def __init__(self, fa): self.fa = fa self.chassis_health = None self.controller_health = None self.component_health = None self.temperature = None self.temperature = None ...
normal
{ "blob_id": "527d514cbad0916fecfe0da68de04d3b130d94c7", "index": 5156, "step-1": "<mask token>\n\n\nclass ArrayHardwareMetrics:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ArrayHardwareMetrics:\n\n def __init__(self, fa):\n self.fa = fa\n self.c...
[ 1, 2, 3, 5, 6 ]
<|reserved_special_token_0|> class RemoteSubroutineRunner(ISubroutineRunner): <|reserved_special_token_0|> def execute_charge_subroutine(self, callback: CommandCallback) ->None: """ :raises BlockingIOError: command already running """ self._start_command(self._remote_service....
flexible
{ "blob_id": "75270fb4ed059f134b47b8937717cb7fe05d9499", "index": 8833, "step-1": "<mask token>\n\n\nclass RemoteSubroutineRunner(ISubroutineRunner):\n <mask token>\n\n def execute_charge_subroutine(self, callback: CommandCallback) ->None:\n \"\"\"\n\n :raises BlockingIOError: command already ...
[ 14, 15, 17, 19, 21 ]
import logging from exceptions.invalid_api_usage import InvalidAPIUsage from wgadget.endpoints.ep import EP class EPInfoLight(EP): NAME = 'info_light' URL = '/info' URL_ROUTE_PAR_PAYLOAD = '/' URL_ROUTE_PAR_URL = '/actuatorId/<actuatorId>' METHOD = 'GET' ATTR_ACTUATOR_ID = 'actuatorId' ...
normal
{ "blob_id": "e5abab3f718bbbd25dcfc49290383203d53248c3", "index": 9464, "step-1": "<mask token>\n\n\nclass EPInfoLight(EP):\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", "ste...
[ 1, 3, 4, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, len(a)): print('main') sorted = True for j in range(1, len(a) - i): if a[j] < a[j - 1]: a[j], a[j - 1] = a[j - 1], a[j] print('inner') print(a) ...
flexible
{ "blob_id": "30fbe52a5e3fb184a998fce43d716cffdaf0d2dc", "index": 1790, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, len(a)):\n print('main')\n sorted = True\n for j in range(1, len(a) - i):\n if a[j] < a[j - 1]:\n a[j], a[j - 1] = a[j - 1], a[j]\n ...
[ 0, 1, 2, 3 ]
from django.shortcuts import render from django.http import HttpResponse def view1(request): return HttpResponse(" Hey..,This is the first view using HttpResponce!") def view2(request): context={"tag_var":"tag_var"} return render(request,"new.html",context) # Create your views here.
normal
{ "blob_id": "c9b62328a463fd38f3dbd1e7b5e1990f7eec1dba", "index": 9793, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef view2(request):\n context = {'tag_var': 'tag_var'}\n return render(request, 'new.html', context)\n", "step-3": "<mask token>\n\n\ndef view1(request):\n return HttpRespo...
[ 0, 1, 2, 3, 4 ]
import pytest import app import urllib.parse @pytest.fixture def client(): app.app.config['TESTING'] = True with app.app.test_client() as client: yield client def test_query_missing_args(client): response = client.get('/data/query') assert 'errors' in response.json and '400' in response.sta...
normal
{ "blob_id": "a598da0a749fcc5a6719cec31ede0eb13fab228e", "index": 3171, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef client():\n app.app.config['TESTING'] = True\n with app.app.test_client() as client:\n yield client\n\n\ndef test_query_missing_args(client):\n response = client.get('/data/que...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: answer = zfile.read(nothing).decode('utf-8') comments += zfile.getinfo(nothing).comment.decode('utf-8') print(answer) findRet = re.findall(target, answer) if len(findRet) == 0: break not...
flexible
{ "blob_id": "b1fe7e318c361930c8ad00758bcb86597fd8f3bd", "index": 2567, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n answer = zfile.read(nothing).decode('utf-8')\n comments += zfile.getinfo(nothing).comment.decode('utf-8')\n print(answer)\n findRet = re.findall(target, answer)\...
[ 0, 1, 2, 3, 4 ]
""" Creating flask server that response with a json """ from flask import Flask from flask import jsonify micro_service = Flask(__name__) @micro_service.route('/') # http://mysite.com/ def home(): return jsonify({'message': 'Hello, world!'}) if __name__ == '__main__': micro_service.run()
normal
{ "blob_id": "4b14dee3625d5d0c703176ed2f0a28b2583fd84d", "index": 6519, "step-1": "<mask token>\n\n\n@micro_service.route('/')\ndef home():\n return jsonify({'message': 'Hello, world!'})\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@micro_service.route('/')\ndef home():\n return jsonify({'message': ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """MicroPython rotary encoder library.""" from machine import Pin ENC_STATES = (0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0) class Encoder(object): def __init__(self, pin_x='P4', pin_y='P5', pin_mode=Pin.PULL_UP, scale=1, min=0, max=100, reverse=False): s...
normal
{ "blob_id": "1406b2ab78b52823a8f455c8e2719f6bd84bd168", "index": 822, "step-1": "<mask token>\n\n\nclass Encoder(object):\n\n def __init__(self, pin_x='P4', pin_y='P5', pin_mode=Pin.PULL_UP, scale=\n 1, min=0, max=100, reverse=False):\n self.pin_x = pin_x if isinstance(pin_x, Pin) else Pin(pin_x...
[ 7, 9, 10, 11, 12 ]
# -*- coding=utf-8 -*- from mako.template import Template from xblock.fragment import Fragment from .lookup import TemplateLookup # xblock_ifmo.lookup from .utils import deep_update class FragmentMakoChain(Fragment): """ Класс, позволяющий последовательно оборачивать экземпляры Fragment друг в друга. ...
normal
{ "blob_id": "9d904225afd4f4d0cf338ae16f031f8ab41639ad", "index": 234, "step-1": "<mask token>\n\n\nclass FragmentMakoChain(Fragment):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, content=None, base=None, lookup_dirs=None):\n \"\"\"\n ...
[ 7, 8, 9, 11, 12 ]
class Circle: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Circle: def __init__(self, radius, color='white'): self.radius = radius self.color = color <|reserved_special_token_0|> <|reserved_special_token_1|> class Circle: def __init...
flexible
{ "blob_id": "6ce50552571594c7be77ac0bf3b5274f2f39e545", "index": 5086, "step-1": "class Circle:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Circle:\n\n def __init__(self, radius, color='white'):\n self.radius = radius\n self.color = color\n\n\n<mask token>\n", "step-3": "class C...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- scheme = 'http' hostname = 'localhost' port = 9000 routes = [ '/available/2', '/available/4' ]
normal
{ "blob_id": "d1402469232b5e3c3b09339849f6899e009fd74b", "index": 3323, "step-1": "<mask token>\n", "step-2": "scheme = 'http'\nhostname = 'localhost'\nport = 9000\nroutes = ['/available/2', '/available/4']\n", "step-3": "# -*- coding: utf-8 -*-\n\n\nscheme = 'http'\n\nhostname = 'localhost'\n\nport = 9000\n\...
[ 0, 1, 2 ]
import math import numpy as np # import tkinter import tensorflow as tf from matplotlib import axis import os from sklearn.base import BaseEstimator, TransformerMixin from sklearn.cluster import KMeans from sklearn.metrics import confusion_matrix class MD(BaseEstimator, TransformerMixin): def __init__(self, data,...
normal
{ "blob_id": "a9947884e805cc8fcb6bff010a5f6e0ff0bb01fe", "index": 8393, "step-1": "<mask token>\n\n\nclass MD(BaseEstimator, TransformerMixin):\n <mask token>\n\n def _init_graph(self):\n \"\"\"\n Init a tensorflow Graph containing: input data, variables, model, loss, optimizer\n \"\"\"...
[ 4, 8, 9, 11, 13 ]
import sys sys.path.append('.') import torch from torch.nn import functional as F import os import yaml from src.new_grad_cam import gc def test(conf): device = conf['device'] dataset = conf['test_dataset'] classes = conf['data']['classes'] weights_path = conf['weights_path'] results_dir = conf['r...
normal
{ "blob_id": "b57b6df1b7e551f64033a0c47e5a22eab9fd5fd4", "index": 7616, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test(conf):\n device = conf['device']\n dataset = conf['test_dataset']\n classes = conf['data']['classes']\n weights_path = conf['weights_path']\n results_dir = con...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.4 on 2021-03-27 19:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('electra', '0009_remove_response_img'), ] operations = [ migrations.AddField( model_name='response', name='date_time'...
normal
{ "blob_id": "049d83bc1a31ef170654fda47d1f58e024befb44", "index": 8220, "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 = [('electra', '...
[ 0, 1, 2, 3, 4 ]
from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() for name, hexcode in zip(cs.colornames, cs.colors): print('%s: %s' % (hexcode, name)) fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')
normal
{ "blob_id": "7106a8ddbec60ce4b7d9e8e5ce8d7df02e5f7222", "index": 6854, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor name, hexcode in zip(cs.colornames, cs.colors):\n print('%s: %s' % (hexcode, name))\n<mask token>\ncs.example_plot(ax)\nfig.savefig('latest.png', dpi=200, bbox_inches='tight')\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UserInfo(APIView): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UserInfo(APIView): @swagger_auto_schema(operation_description= 'Get information about th...
flexible
{ "blob_id": "c45ffe8cba8d152e346182252dbc43e22eaf83e2", "index": 3498, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserInfo(APIView):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass UserInfo(APIView):\n\n @swagger_auto_schema(operation_description=\n 'Get information abo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PersianConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PersianConfig(AppConfig): name = 'persian' <|reserved_special_token_1|> from django.app...
flexible
{ "blob_id": "6b0d1de4c77841f20670331db3332cf87be7ad84", "index": 3931, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PersianConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PersianConfig(AppConfig):\n name = 'persian'\n", "step-4": "from django.apps import App...
[ 0, 1, 2, 3 ]
from redstork import PageObject class AnnotController: def get_annotations(self, project, page_index): page = project.doc[page_index] yield from page.flat_iter()
normal
{ "blob_id": "6ca2a9040897e49c6407b9b0760240fec93b4df0", "index": 3067, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AnnotController:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AnnotController:\n\n def get_annotations(self, project, page_index):\n page = project.doc[p...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def func(): global data print('%s is acquire lock..\n' % threading.current_thread().getName()) if lock.acquire(): print('%s get lock ' % threading.current_thread().getName()) data += 1 time.sleep(2) print('%s release lock ' % threading.current_t...
flexible
{ "blob_id": "7aa426723f5311b5abec4a7ace9d3ec1e5e31d9a", "index": 5966, "step-1": "<mask token>\n\n\ndef func():\n global data\n print('%s is acquire lock..\\n' % threading.current_thread().getName())\n if lock.acquire():\n print('%s get lock ' % threading.current_thread().getName())\n data...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def areAlmostEqual(self, s1, s2): if not len(s1) == len(...
flexible
{ "blob_id": "5efb8151375d705f3591921654f847e45b6927c9", "index": 3614, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def areAlmostEqual(self, s1, s2):\n if not len(s1) == len(s2):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Music(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "2caea9e7bbef99b19ba917995513413385c7abdf", "index": 9808, "step-1": "<mask token>\n\n\nclass Music(object):\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 @staticmethod\n def ...
[ 12, 18, 21, 24, 25 ]
ba0563.pngMap = [ '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', '0000000000000000000000000000000000000...
normal
{ "blob_id": "dab1adcd185092fc425b5d87150f27e7b67bff6c", "index": 151, "step-1": "<mask token>\n", "step-2": "ba0563.pngMap = [\n '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\n ,\n '00000000000000000000000000000000000...
[ 0, 1, 2 ]
class Node: """ This class represent a node (vertex). """ def __init__(self, k: int = None, loc: tuple = None, **kwargs): """ Each node contain dew fields: key: node_id. location: node's position represent as 3DPoint. ni_out: a dictionary that holds all the "edge...
normal
{ "blob_id": "9c3f6c368c764918da5cce44da574b7c041fa414", "index": 1364, "step-1": "class Node:\n <mask token>\n\n def __init__(self, k: int=None, loc: tuple=None, **kwargs):\n \"\"\"\n Each node contain dew fields:\n key: node_id.\n location: node's position represent as 3DPoint....
[ 12, 13, 14, 15, 16 ]
# Generated by Django 2.2.16 on 2020-10-27 14:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('trades', '0001_initial'), ] operations = [ migrations.AddField( model_name='orderinfo', name='nonce_str', ...
normal
{ "blob_id": "4e04e748a97c59a26a394b049c15d96476b98517", "index": 9382, "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 = [('trades', '0...
[ 0, 1, 2, 3, 4 ]
import os from distutils.core import Extension REPROJECT_ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): libraries = [] sources = [] sources.append(os.path.join(REPROJECT_ROOT, "_overlap.c")) sources.append(os.path.join(REPROJECT_ROOT, "overlapArea.c")) sources.append(os...
normal
{ "blob_id": "ad079876476f6f291ad52aece8d0d5afdd5a8bcf", "index": 9892, "step-1": "<mask token>\n\n\ndef get_extensions():\n libraries = []\n sources = []\n sources.append(os.path.join(REPROJECT_ROOT, '_overlap.c'))\n sources.append(os.path.join(REPROJECT_ROOT, 'overlapArea.c'))\n sources.append(os...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 2.1.7 on 2019-03-14 07:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('training_area', '0002_event'), ] operations = [ migrations.AddField( model_name='event', ...
normal
{ "blob_id": "9555ed63b3906ec23c31839691a089aad9d96c63", "index": 9917, "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 = [('training_ar...
[ 0, 1, 2, 3, 4 ]
from ddt import ddt, data, unpack import sys sys.path.append("..") from pages.homepage import HomePage from base.basetestcase import BaseTestCase from helpers.filedatahelper import get_data @ddt class QuickSearchTest(BaseTestCase): testingdata = get_data('testdata/QuickSearchTestData.xlsx') @data(*testingdata...
normal
{ "blob_id": "4ba0f7e947830018695c8c9e68a96426f49b4b5b", "index": 3326, "step-1": "<mask token>\n\n\n@ddt\nclass QuickSearchTest(BaseTestCase):\n <mask token>\n\n @data(*testingdata)\n @unpack\n def test_QuickSearch(self, search_value, expected_result, notes):\n homepage = HomePage(self.driver)...
[ 2, 3, 4, 5, 6 ]
from django.core.exceptions import ValidationError from django.utils import timezone def year_validator(value): if value < 1 or value > timezone.now().year: raise ValidationError( ('%s is not a correct year!' % value) ) def raiting_validator(value): if value < 1 or value > 10: ...
normal
{ "blob_id": "7a6d5309580b673413f57047e631a08e61e837cf", "index": 4447, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef raiting_validator(value):\n if value < 1 or value > 10:\n raise ValidationError('%s is not a caorrect raiting!' % value)\n", "step-3": "<mask token>\n\n\ndef year_vali...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(weekdays[a]) <|reserved_special_token_1|> weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] i = input('Enter a day of the week and number of days: ').split() e = int(i[-1]) star...
flexible
{ "blob_id": "5f7d05c642339ce0ab02a65ca41f9ee89c2faf57", "index": 4240, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(weekdays[a])\n", "step-3": "weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',\n 'Saturday', 'Sunday']\ni = input('Enter a day of the week and number of days: ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Create(obj, targetColor, control, attr, offset): shape = obj.getShape() name = obj.name() if type(shape) == pm.Mesh: outVerts = [] verts = shape.vtx[:] for i, vert in enumerate(verts): ...
flexible
{ "blob_id": "9061db3bb3aa3178262af58e56126302b9effdff", "index": 6509, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Create(obj, targetColor, control, attr, offset):\n shape = obj.getShape()\n name = obj.name()\n if type(shape) == pm.Mesh:\n outVerts = []\n verts = shape.v...
[ 0, 1, 2, 3, 4 ]
from find import Solution array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] solution = Solution.Find(6, array)
normal
{ "blob_id": "d4361b169bf75d3af82eca3d26609961ccc2f27e", "index": 2405, "step-1": "<mask token>\n", "step-2": "<mask token>\narray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsolution = Solution.Find(6, array)\n", "step-3": "from find import Solution\narray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nsolution = Solution.Fi...
[ 0, 1, 2 ]
from .submit import * from .fck import *
normal
{ "blob_id": "9a5ba88a61f5c27c0bc7b980fa9d865b52cbbb20", "index": 7266, "step-1": "<mask token>\n", "step-2": "from .submit import *\nfrom .fck import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class VehiclePhoto: <|reserved_special_token_0|> def __repr__(self): return f'{self.VehiclePhotoID} {self.VIN} {self.UrlVdp}' <|reserved_special_token_1|> class Image: <|reserved_special_token_0|> <|reserved_special_token_0|> class VehiclePhoto: def __in...
flexible
{ "blob_id": "3dc4e10145ad42c0168fec3462da0f87c1e661a5", "index": 8701, "step-1": "<mask token>\n\n\nclass VehiclePhoto:\n <mask token>\n\n def __repr__(self):\n return f'{self.VehiclePhotoID} {self.VIN} {self.UrlVdp}'\n", "step-2": "class Image:\n <mask token>\n <mask token>\n\n\nclass Vehic...
[ 2, 4, 5, 6, 7 ]
__author__ = 'Joe' import sys sys.path.insert(0,'../src/') import grocery_functions import unittest class TestGroceryFuncs(unittest.TestCase): def test_getRecipeNames(self): recipe_names = grocery_functions.get_recipe_names("test-recipes") self.assertTrue(recipe_names[0] == "Cajun Chicken & Rice"...
normal
{ "blob_id": "c4fbf206482a04f3e2d2aa98a0dbf525a176c4e7", "index": 1087, "step-1": "<mask token>\n\n\nclass TestGroceryFuncs(unittest.TestCase):\n\n def test_getRecipeNames(self):\n recipe_names = grocery_functions.get_recipe_names('test-recipes')\n self.assertTrue(recipe_names[0] == 'Cajun Chicke...
[ 4, 8, 12, 14, 15 ]
<|reserved_special_token_0|> def obtain_confidence(sim=False): if sim: noise = np.random.normal(0, 0.6, size=1)[0] return noise filename = 'Confidence.txt' lines = open(filename).read().splitlines() try: confidence = float(lines[-1]) except ValueError: print('Failed...
flexible
{ "blob_id": "6defbe25fc17e53df2fc4d32886bba1cb141bdfd", "index": 7018, "step-1": "<mask token>\n\n\ndef obtain_confidence(sim=False):\n if sim:\n noise = np.random.normal(0, 0.6, size=1)[0]\n return noise\n filename = 'Confidence.txt'\n lines = open(filename).read().splitlines()\n try:\...
[ 2, 3, 4, 5, 6 ]