code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fairCandySwap(A, B): sumA, sumB = sum(A), sum(B) setA, setB = set(A), set(B) delta = (sumA - sumB) // 2 for j in setB: if j + delta in setA: return j + delta, j <|reserved_special_token_...
flexible
{ "blob_id": "9abc5f18e2eb07afe6bc31d6bd27298350707d1d", "index": 962, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fairCandySwap(A, B):\n sumA, sumB = sum(A), sum(B)\n setA, setB = set(A), set(B)\n delta = (sumA - sumB) // 2\n for j in setB:\n if j + delta in setA:\n ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-26 16:51 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('api', '0002_auto_20170308_1949'), ] operations = [ migrations.AlterField( ...
normal
{ "blob_id": "bf3b529f8f06619c94d2dfca283df086466af4ea", "index": 5027, "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 = [('api', '0002...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def quartiles(values): n = len(values) values.sort() Q2 = median(values) Q1 = median(values[:int(n / 2)]) if n % 2 == 0: Q3 = median(values[int(n / 2):]) else: Q3 = median(values[int(n / 2 + 1):]) return Q1, Q2, Q3 <|reserved_special_token_0|>...
flexible
{ "blob_id": "9d6b5baa8462b2996e4518dd39b5bb1efde1fd9d", "index": 894, "step-1": "<mask token>\n\n\ndef quartiles(values):\n n = len(values)\n values.sort()\n Q2 = median(values)\n Q1 = median(values[:int(n / 2)])\n if n % 2 == 0:\n Q3 = median(values[int(n / 2):])\n else:\n Q3 = m...
[ 1, 2, 3, 4, 5 ]
# This is a module class MyMath: def isEven(num): if(num%2==0): return True return False def isOdd(num): if(num%2==0): return False return True def isPrime(num): for i in range(2,num): if num%i==0: return ...
normal
{ "blob_id": "20d363f5d02cc0b1069aa8951999c0cb22b85613", "index": 7578, "step-1": "class MyMath:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Calsi:\n\n def add(num1, num2):\n return num1 + num2\n\n def sub(num1, num2):\n return num1 - num2\n\n def mul(num1, num2):\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def test_lasso(): test = pd.read_csv('./data/test.csv') building_metadata = pd.read_csv('./data/building_metadata.csv') weather_test = pd.read_csv('./data/weather_test.csv') test.sort_values(by=['building_id', 'timestamp'], inplace=True) test = test.merge(building_meta...
flexible
{ "blob_id": "6028b46eab422dea02af24e9cf724fe0d8b3ecc4", "index": 9531, "step-1": "<mask token>\n\n\ndef test_lasso():\n test = pd.read_csv('./data/test.csv')\n building_metadata = pd.read_csv('./data/building_metadata.csv')\n weather_test = pd.read_csv('./data/weather_test.csv')\n test.sort_values(by...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def parse(num): strnum = str(num) words = [] for item in range(len(strnum) - 1, -1, -1): words.append(strnum[item]) hundred = words[:3] thousand = words[3:6] million = words[6:len(words)] hundred = hundred[::-1] thousan...
flexible
{ "blob_id": "843901b65a556e57470f73be2657e9fd3c0facc6", "index": 9721, "step-1": "<mask token>\n", "step-2": "def parse(num):\n strnum = str(num)\n words = []\n for item in range(len(strnum) - 1, -1, -1):\n words.append(strnum[item])\n hundred = words[:3]\n thousand = words[3:6]\n mill...
[ 0, 1, 2, 3 ]
''' Model package should containt all data types for the database engine, which means that projects like PyCIM can be included within '''
normal
{ "blob_id": "ce3c1a7210632d0a8475fe886d514eb91d3c75ac", "index": 7700, "step-1": "<mask token>\n", "step-2": "''' Model package should containt all data types for the database engine, \nwhich means that projects like PyCIM can be included within '''", "step-3": null, "step-4": null, "step-5": null, "st...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(datetime.now().date() + timedelta(days=dd - nn)) <|reserved_special_token_1|> <|reserved_special_token_0|> dd = int(input('enter number day: ')) nn = int(datetime.now().strftime('%w')) + 1 print(datetime.now().date() + ti...
flexible
{ "blob_id": "d3342507cb1966e14380ff28ae12b5c334abd20a", "index": 5430, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(datetime.now().date() + timedelta(days=dd - nn))\n", "step-3": "<mask token>\ndd = int(input('enter number day: '))\nnn = int(datetime.now().strftime('%w')) + 1\nprint(datetime.no...
[ 0, 1, 2, 3, 4 ]
# Print list of files and directories import os def file_list(dir): subdir_list = [] for item in os.listdir(dir): fullpath = os.path.join(dir,item) if os.path.isdir(fullpath): subdir_list.append(fullpath) else: print(fullpath) for d in subdir_list: f...
normal
{ "blob_id": "051544f41cc3c7d78210076cb9720866924ea2a1", "index": 2942, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef file_list(dir):\n subdir_list = []\n for item in os.listdir(dir):\n fullpath = os.path.join(dir, item)\n if os.path.isdir(fullpath):\n subdir_list.a...
[ 0, 1, 2, 3, 4 ]
# Copyright The Linux Foundation and each contributor to CommunityBridge. # SPDX-License-Identifier: MIT """ Holds the AWS SNS email service that can be used to send emails. """ import boto3 import os import cla import uuid import json import datetime from cla.models import email_service_interface region = os.enviro...
normal
{ "blob_id": "16dd73f2c85eff8d62cf0e605489d0db1616e36e", "index": 8650, "step-1": "<mask token>\n\n\nclass SNS(email_service_interface.EmailService):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MockSNS(SNS):\n \"\"\"\n...
[ 6, 12, 14, 15, 16 ]
<|reserved_special_token_0|> def dataset_cat_description(path, cmap=None): desc = yaml.load(open(path, 'r'), Loader=yaml.FullLoader) colors = {} names = [] for i, cat in enumerate(desc): names.append(cat['name']) if 'color' in cat: colors[cat['id']] = torch.tensor(cat['colo...
flexible
{ "blob_id": "6c641ace8f1e5e8c42fa776bd7604daf243f9a41", "index": 2113, "step-1": "<mask token>\n\n\ndef dataset_cat_description(path, cmap=None):\n desc = yaml.load(open(path, 'r'), Loader=yaml.FullLoader)\n colors = {}\n names = []\n for i, cat in enumerate(desc):\n names.append(cat['name'])\...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'module_spec': {'module_name': 'Spec1'}} <|reserved_special_token_1|> { "module_spec": { "module_name": "Spec1" } }
flexible
{ "blob_id": "1cfb0690ebe1d7c6ab93fa6a4bc959b90b991bc8", "index": 7016, "step-1": "<mask token>\n", "step-2": "{'module_spec': {'module_name': 'Spec1'}}\n", "step-3": "{\n \"module_spec\": {\n \"module_name\": \"Spec1\"\n }\n}\n\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, msg_count): msg = {'id': i + 20, 'payload': 'Here is test message {}'.format(i + 20)} sent = producer.send('test-topic2', bytes(json.dumps(msg), 'utf-8')) <|reserved_special_token_1|> <|reserved_specia...
flexible
{ "blob_id": "d763485e417900044d7ce3a63ef7ec2def115f05", "index": 7263, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, msg_count):\n msg = {'id': i + 20, 'payload': 'Here is test message {}'.format(i + 20)}\n sent = producer.send('test-topic2', bytes(json.dumps(msg), 'utf-8'))\n", ...
[ 0, 1, 2, 3 ]
import os def get_os_env_value(key): return os.getenv(key) def get_mysql_uri(user, password, host, database): return f'mysql+pymysql://{user}:{password}@{host}/{database}' MASTER_MYSQL_DATABASE_USER = get_os_env_value('MASTER_MYSQL_DATABASE_USER') MASTER_MYSQL_DATABASE_PASSWORD = get_os_env_value('MASTER_...
normal
{ "blob_id": "8247b045a5aed4d0f3db6bc2c0edd985f2c4ba30", "index": 5305, "step-1": "<mask token>\n\n\ndef get_mysql_uri(user, password, host, database):\n return f'mysql+pymysql://{user}:{password}@{host}/{database}'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_os_env_value(key):\n return os....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PasswordChangeForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PasswordChangeForm(forms.Form): password = forms.CharField(min_length=8, label='New ...
flexible
{ "blob_id": "85fff1f6e1f69dd0e2e9b5acc90db31d27329c7c", "index": 3352, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n password = forms.CharField(min_length=8, label='N...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StaticTemplateList(TemplateList): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StaticTemplateList(TemplateList): def __init__(self, viewMode=None): ...
flexible
{ "blob_id": "7de3c0ab2e7c8ac00d37f1dfb5948027cfa7806c", "index": 5084, "step-1": "<mask token>\n\n\nclass StaticTemplateList(TemplateList):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StaticTemplateList(TemplateList):\n\n def __init__(self, viewMode=None):\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def gamblerProblem(): """ Description: This function Simulates a gambler who start with stake and place fair 1 bets until he/she goes broke (i.e. has no money) or reach $goal. Keeps track of the number of...
flexible
{ "blob_id": "68904be892968d4a1d82a59a31b95a8133a30832", "index": 8790, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef gamblerProblem():\n \"\"\"\n Description:\n This function Simulates a gambler who start with stake and place fair 1 bets until\n he/she goes broke (i.e. has no...
[ 0, 1, 2, 3, 4 ]
import logging from django.contrib.auth import get_user_model from django.db import models from rest_framework import serializers from rest_framework.test import APITestCase from ..autodocs.docs import ApiDocumentation from .utils import Deferred log = logging.getLogger(__name__) def get_serializer(endpoint, met...
normal
{ "blob_id": "04822e735c9c27f0e0fcc9727bcc38d2da84dee6", "index": 7831, "step-1": "<mask token>\n\n\nclass AutoTestCase(APITestCase):\n <mask token>\n\n @classmethod\n def setUpClass(cls):\n \"\"\"\n Создание пользователя для всех тестов, который цепляется через `settings.AUTH_USER_PK`\n\n ...
[ 6, 11, 12, 14, 16 ]
import database import nltk def pop(i): # pupulate the words table loc = i sentencesTrial = [] File = open('words.txt') lines = File.read() sentences = nltk.sent_tokenize(lines) locations = ["Castle","Beach","Beach","Ghost Town","Ghost Town","Haunted House","Jungle","Carnival", "Ghost Town", "Hi...
normal
{ "blob_id": "e7ac5c1010330aec81ce505fd7f52ccdeddb76de", "index": 8923, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef pop(i):\n loc = i\n sentencesTrial = []\n File = open('words.txt')\n lines = File.read()\n sentences = nltk.sent_tokenize(lines)\n locations = ['Castle', 'Beach'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ImageClassifierMockup(ImageClassifier): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ImageClassifierMockup(ImageClassifier): <|reserved_special_token_0|> def classify_image(self, image...
flexible
{ "blob_id": "71fb9dc9f9ac8b1cdbc6af8a859dbc211512b4d1", "index": 1675, "step-1": "<mask token>\n\n\nclass ImageClassifierMockup(ImageClassifier):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ImageClassifierMockup(ImageClassifier):\n <mask token>\n\n def classify_image(self, ...
[ 1, 2, 3, 4, 5 ]
import mysql.connector # config = { # "user":"root", # "password":"Sm13481353", # "host":"3" # } mydb = mysql.connector.connect( user="seyed", password="Sm13481353", host="localhost", database="telegram_bot", auth_plugin="mysql_native_password" ) mycursor = mydb.cursor() query = "i...
normal
{ "blob_id": "a29a904290cb733ac7b526a75e0c218b952e2266", "index": 4630, "step-1": "<mask token>\n", "step-2": "<mask token>\nmycursor.execute('select * from question')\n<mask token>\nfor user in users:\n print(user)\n", "step-3": "<mask token>\nmydb = mysql.connector.connect(user='seyed', password='Sm13481...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "ea414835554ea3dcac2017036692cf178526f91b", "index": 5641, "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 = [('play', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def grayCode(self, n: int) ->List[int]: res = [0] * 2 ** n exp = 0 l = ...
flexible
{ "blob_id": "dc600763b12edda05820721098e7e5bc80f74c89", "index": 4798, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def grayCode(self, n: int) ->List[int]:\n res = [0] * 2 ** n\n exp = 0\n ...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt w1 = [(1, 2, 7), (1, 8, 1), (1, 7, 5), (1, 6, 3), (1, 7, 8), (1, 5, 9), (1, 4, 5)] w2 = [(-1, -4, -2), (-1, 1, 1), (-1, -1, -3), (-1, -3, 2), (-1, -5, -3.25), (-1, -2, -4), (-1, -7, -1)] dataset = [(1, 2, 7), (1, 8, 1), (1, 7, 5), (1, 6, 3)...
normal
{ "blob_id": "15105e22b3c1860735f282a2247ab41b138d75cf", "index": 3452, "step-1": "import matplotlib.pyplot as plt\n\nw1 = [(1, 2, 7), (1, 8, 1),\n (1, 7, 5), (1, 6, 3),\n (1, 7, 8), (1, 5, 9),\n (1, 4, 5)]\nw2 = [(-1, -4, -2), (-1, 1, 1),\n (-1, -1, -3), (-1, -3, 2),\n (-1, -5, -3.25), (...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> layout = html.Div([html.Div([html.Div([html.H6('Répartition des biens'), dcc.Graph(id='pieGraph', figure={'data': [{'values': [2878001, 2342181, 1773296, 521395], 'labels': ['Maison', 'Appartement', 'Dependance', 'loca...
flexible
{ "blob_id": "83c3193ea40c9328d16fb91774762a76352d8e09", "index": 8417, "step-1": "<mask token>\n", "step-2": "<mask token>\nlayout = html.Div([html.Div([html.Div([html.H6('Répartition des biens'),\n dcc.Graph(id='pieGraph', figure={'data': [{'values': [2878001, 2342181,\n 1773296, 521395], 'labels': ['Ma...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): con = serial.Serial('/dev/tty****', 9600) print('connected.') while 1: str = con.readline() print(str.strip().decode('utf-8')) <|reserved_special_token_0|> <|reserved_special_token_1|>...
flexible
{ "blob_id": "108c8bbb4d3dbc6b7f32e084b13009296b3c5a80", "index": 8016, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n con = serial.Serial('/dev/tty****', 9600)\n print('connected.')\n while 1:\n str = con.readline()\n print(str.strip().decode('utf-8'))\n\n\n<mask ...
[ 0, 1, 2, 3, 4 ]
import sys from pypsi.pipes import ThreadLocalStream from pypsi.shell import Shell from pypsi.core import pypsi_print from nose.tools import * class PypsiTestShell(Shell): pass class TestShellBootstrap(object): def setUp(self): self.real_stdout = sys.stdout self.real_stderr = sys.stderr ...
normal
{ "blob_id": "1983340b3ce7ba8b631ba090871bea1ef7044943", "index": 9333, "step-1": "<mask token>\n\n\nclass TestShellBootstrap(object):\n <mask token>\n\n def tearDown(self):\n self.shell.restore()\n <mask token>\n\n def _test_bootstrap_stream_type(self, attr):\n assert_is_instance(getatt...
[ 7, 10, 12, 13 ]
import scrapy import datetime from tzscrape.items import CitizenItem class CitizenSpider(scrapy.Spider): name = 'citizen' allowed_domains = ['thecitizen.co.tz'] start_urls = ['http://www.thecitizen.co.tz/'] def parse(self, response): # headlines for href in response.xpath('//*[@itempro...
normal
{ "blob_id": "d307c3479e34a12971f62a765aca2ba0850d80d1", "index": 5660, "step-1": "<mask token>\n\n\nclass CitizenSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CitizenSpider(scrapy.Spider):\n <mask token...
[ 1, 3, 4, 5, 6 ]
from peewee import BlobField class BytesField(BlobField): """This is a BlobField adapted to our needs Default BlobField returns memoryview when getting data from the db. We want bytes. """ def adapt(self, value): if value and isinstance(value, memoryview): return value.tobytes() ...
normal
{ "blob_id": "b11869076c2c8d6207df861cd1d0b0434b3f9477", "index": 9836, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BytesField(BlobField):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BytesField(BlobField):\n <mask token>\n\n def adapt(self, value):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AdminReqNoDetails(Resource): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AdminReqNoDetails(Resource): @jwt_required def get(self): parser = reqpars...
flexible
{ "blob_id": "d436362468b847e427bc14ca221cf0fe4b2623e3", "index": 4408, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AdminReqNoDetails(Resource):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AdminReqNoDetails(Resource):\n\n @jwt_required\n def get(self):\n parser = r...
[ 0, 1, 2, 3, 4 ]
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str ...
normal
{ "blob_id": "006e1088e72201fab7eebd1409c025b5dba69403", "index": 5938, "step-1": "<mask token>\n", "step-2": "class Codec:\n <mask token>\n <mask token>\n", "step-3": "class Codec:\n <mask token>\n\n def deserialize(self, data):\n \"\"\"Decodes your encoded data to tree.\n \n ...
[ 0, 1, 2, 3, 4 ]
def get_all_lefts(word,substring): if len(substring) == 0: yield ((len(word),word),) else: if substring[0] not in word: yield (-1,) else: for i in range(len(word)): if word[i] == substring[0]: for sub_sequance in get_all_lefts(w...
normal
{ "blob_id": "8c0377b70b902e6e61351869a4378b4c2c50a3a7", "index": 2478, "step-1": "<mask token>\n", "step-2": "def get_all_lefts(word, substring):\n if len(substring) == 0:\n yield (len(word), word),\n elif substring[0] not in word:\n yield -1,\n else:\n for i in range(len(word)):\...
[ 0, 1, 2, 3 ]
from processing.DLDataEngineering import DLDataEngineering from sklearn.preprocessing import OneHotEncoder import pandas as pd import numpy as np import h5py import os from scipy.ndimage import gaussian_filter #Deep learning packages import tensorflow as tf #from tensorflow import keras from tensorflow.keras...
normal
{ "blob_id": "a0a6bd5de39a7599f7872639cdf3a59b8cda5498", "index": 5230, "step-1": "<mask token>\n\n\nclass DLModeler(object):\n\n def __init__(self, model_path, hf_path, num_examples, class_percentages,\n predictors, model_args, model_type):\n self.model_path = model_path\n self.hf_path = ...
[ 8, 9, 10, 12, 13 ]
<|reserved_special_token_0|> def checkStringLine(ip, host, pagel, objects, title): onlyIp = ip.split(':')[0] connection = siteLines() with connection.cursor() as cursor: sql = f"SELECT `IP` FROM `sites` WHERE `IP`='{onlyIp}'" cursor.execute(sql) result = cursor.fetchone() i...
flexible
{ "blob_id": "6c5c07dadbe7ec70a210ee42e756be0d710c0993", "index": 5272, "step-1": "<mask token>\n\n\ndef checkStringLine(ip, host, pagel, objects, title):\n onlyIp = ip.split(':')[0]\n connection = siteLines()\n with connection.cursor() as cursor:\n sql = f\"SELECT `IP` FROM `sites` WHERE `IP`='{o...
[ 1, 2, 4, 5, 6 ]
""" Mount /sys/fs/cgroup Option """ from typing import Callable import click def cgroup_mount_option(command: Callable[..., None]) -> Callable[..., None]: """ Option for choosing to mount `/sys/fs/cgroup` into the container. """ function = click.option( '--mount-sys-fs-cgroup/--no-mount-sys-...
normal
{ "blob_id": "237f5e2e37187e26b5628032e37d3a525ef72b9a", "index": 7261, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cgroup_mount_option(command: Callable[..., None]) ->Callable[..., None]:\n \"\"\"\n Option for choosing to mount `/sys/fs/cgroup` into the container.\n \"\"\"\n functi...
[ 0, 1, 2, 3 ]
pairs = ['usdt', 'btc'] warn_msg = '** WARN ** ' info_msg = '** INFO **'
normal
{ "blob_id": "26289d88ac51ee359faa81ca70b01879d2b1f840", "index": 9460, "step-1": "<mask token>\n", "step-2": "pairs = ['usdt', 'btc']\nwarn_msg = '** WARN ** '\ninfo_msg = '** INFO **'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Partition(Enum): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class RandomClassData(Dataset): """Standard normal distributed features and uniformly sampled discrete targets""" def __ini...
flexible
{ "blob_id": "4c0c88f46c2d4607d9ac00755bf122e847ea2f6a", "index": 6221, "step-1": "<mask token>\n\n\nclass Partition(Enum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass RandomClassData(Dataset):\n \"\"\"Standard normal distributed features and uniformly sampled discrete ta...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.ion() <|reserved_special_token_0|> print('Visualizing example dataset for outlier detection.') <|reserved_special_token_0|> plt.figure() plt.scatter(X[:, 0], X[:, 1], c='b', marker='x', s=15, linewidth=1) plt.axis([0, 30, 0, 3...
flexible
{ "blob_id": "de6b9961e0572338c87802314e7ae3cded5168b4", "index": 487, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.ion()\n<mask token>\nprint('Visualizing example dataset for outlier detection.')\n<mask token>\nplt.figure()\nplt.scatter(X[:, 0], X[:, 1], c='b', marker='x', s=15, linewidth=1)\nplt.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DonationAnonymizer(Anonymizer): model = Donation attributes = [('id', 'SKIP'), ('profile_id', 'SKIP'), ('amount', 'integer'), ('date', 'date'), ('description', 'varchar'), ('notes', 'lorem')] class AddressAnonymizer(Anonymizer): model = Address attr...
flexible
{ "blob_id": "63182a8708729606f96794cddb163f707252ba61", "index": 3205, "step-1": "<mask token>\n\n\nclass DonationAnonymizer(Anonymizer):\n model = Donation\n attributes = [('id', 'SKIP'), ('profile_id', 'SKIP'), ('amount',\n 'integer'), ('date', 'date'), ('description', 'varchar'), ('notes',\n ...
[ 16, 18, 28, 29, 30 ]
<|reserved_special_token_0|> class FoodpandastoreInfo2Pipeline: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FoodpandastoreInfo2Pipeline: def __init__(self): engine = db_connect() create_tables(engine) ...
flexible
{ "blob_id": "f66306908f1fdd5c662804e73596b445c66dc176", "index": 9521, "step-1": "<mask token>\n\n\nclass FoodpandastoreInfo2Pipeline:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FoodpandastoreInfo2Pipeline:\n\n def __init__(self):\n engine = db_connect()\n creat...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @click.command() @click.argument('input_folder', type=click.Path(exists=True), default=path_in) @click.argument('output_folder', type=click.Path(), default=path_out) @click.argument('bounding_boxes_file', type=click.Path(), default=path_bb) @click.option('--cores', type=click.INT, default...
flexible
{ "blob_id": "3479276d4769518aa60dcd4e1bb41a8a1a7d6517", "index": 315, "step-1": "<mask token>\n\n\n@click.command()\n@click.argument('input_folder', type=click.Path(exists=True), default=path_in)\n@click.argument('output_folder', type=click.Path(), default=path_out)\n@click.argument('bounding_boxes_file', type=c...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2017 Maarten Los # See LICENSE.rst for details. class Defaults(object): INBUS_VERSION = 2 LOCALHOST = "127.0.0.1" PORT = 7222 INBUS_ADDRESS = (LOCALHOST, PORT) BUFFER_SIZE = 65536
normal
{ "blob_id": "bc087482e901ce1831cef56aa9c7aef0c8f2d15a", "index": 1793, "step-1": "<mask token>\n", "step-2": "class Defaults(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "class Defaults(object):\n INBUS_VERSION = 2\n LOCALHOST = '127.0...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class HackerNews(object): <|reserved_special_token_0|> def _get(self, url): """Internal method used for GET requests Args: url (string): URL to send GET. Returns: requests' response object Raises: HTTPError: If ...
flexible
{ "blob_id": "e14c7eb11c06d6de5c2f9f8adfb8b742fcb432e1", "index": 8073, "step-1": "<mask token>\n\n\nclass HackerNews(object):\n <mask token>\n\n def _get(self, url):\n \"\"\"Internal method used for GET requests\n\n Args:\n url (string): URL to send GET.\n\n Returns:\n ...
[ 11, 16, 17, 20, 29 ]
import webapp2 class RedirectToSiteRootHandler(webapp2.RequestHandler): def get(self): self.response.set_status(301) self.response.headers['Location'] = '/' class AppendTrailingSlashHandler(webapp2.RequestHandler): def get(self, uri): self.response.set_status(301) redirect_uri = uri + ...
normal
{ "blob_id": "064792a6aba96a679bec606a85b19d4925861f7d", "index": 2493, "step-1": "<mask token>\n\n\nclass AppendTrailingSlashHandler(webapp2.RequestHandler):\n\n def get(self, uri):\n self.response.set_status(301)\n redirect_uri = uri + '/'\n self.response.headers['Location'] = redirect_u...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> class Memoized(object): def __init__(self, func): self.func = func self.results = {} <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Memoized(object):...
flexible
{ "blob_id": "8c055816def1c0a19e672ab4386f9b9a345b6323", "index": 7837, "step-1": "<mask token>\n\n\nclass Memoized(object):\n\n def __init__(self, func):\n self.func = func\n self.results = {}\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Memoized...
[ 2, 4, 7, 8, 9 ]
<|reserved_special_token_0|> class Character: def __init__(self, screen, side_length, border_width, valid_points, start_point, end_point, current_position, a_colour, na_colour, keys =None, k_colour=None): self.screen = screen self.side_length = side_length self.border_widt...
flexible
{ "blob_id": "f7f96b19bdc20f732566709a7801002fe49d49eb", "index": 3214, "step-1": "<mask token>\n\n\nclass Character:\n\n def __init__(self, screen, side_length, border_width, valid_points,\n start_point, end_point, current_position, a_colour, na_colour, keys\n =None, k_colour=None):\n sel...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class DiceWrongFacesItemsTypeError(Exception): def __init__(self): super().__init__('Dice "faces_items" argsument need to be iterable.') class DiceWrongFacesItemsCountError(Exception): def __init__(self, min_count): super().__init__( f'Dice "faces_i...
flexible
{ "blob_id": "5750fd4b59f75ea63b4214ee66b23602ed4d314d", "index": 8909, "step-1": "<mask token>\n\n\nclass DiceWrongFacesItemsTypeError(Exception):\n\n def __init__(self):\n super().__init__('Dice \"faces_items\" argsument need to be iterable.')\n\n\nclass DiceWrongFacesItemsCountError(Exception):\n\n ...
[ 6, 7, 9, 12, 13 ]
# Generated by Django 2.2.6 on 2020-04-06 16:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='User', fie...
normal
{ "blob_id": "1b71789ba7c2191b433a405723fe6c985c926610", "index": 8620, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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": "547935a67fb079e551534126534234ceb96ed0dd", "index": 7648, "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 = [('projects', ...
[ 0, 1, 2, 3, 4 ]
"""Functions for parsing various strings to RGB tuples.""" import json import re from pathlib import Path import importlib.resources as resources from pilutils.basic import hex_to_rgb __all__ = [ "parse_hex6", "parse_hex3", "parse_rgbfunc_int", "parse_rgbfunc_float", "parse_rgbfunc_percent", "...
normal
{ "blob_id": "978f3979aee1c4361483fd61b54352e7fff8d3b3", "index": 697, "step-1": "<mask token>\n\n\ndef parse_hex3(hex3):\n \"\"\"Example: #a3d\"\"\"\n if (m := re.match('^#?([0-9A-Fa-f]{3})$', hex3.strip())):\n h3 = m.group(1)\n return tuple(int(c * 2, 16) for c in h3)\n raise ValueError(f...
[ 7, 10, 12, 13, 14 ]
<|reserved_special_token_0|> class GANLoss(nn.Module): <|reserved_special_token_0|> def __init__(self, loss_mode, which_net, which_D, target_real_label=1.0, target_fake_label=0.0, CUDA=False): """ Initialize the GAN's Discriminator Loss class. Parameters: loss_mode (str) ...
flexible
{ "blob_id": "9cea998d7d5cad3ddc00f667ca06151a938d48a1", "index": 9424, "step-1": "<mask token>\n\n\nclass GANLoss(nn.Module):\n <mask token>\n\n def __init__(self, loss_mode, which_net, which_D, target_real_label=1.0,\n target_fake_label=0.0, CUDA=False):\n \"\"\" Initialize the GAN's Discrim...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def get(path): return reduce(lambda view, part: view[part], path.split('.'), config).get() <|reserved_special_token_1|> <|reserved_special_token_0|> config.set_file('config.yaml') def get(path): return reduce(lambda view, part: view[part], path.split('.'), config).get() <|r...
flexible
{ "blob_id": "16879598a8b1a0b23c5ea6de18f8fb0b0b77201c", "index": 1360, "step-1": "<mask token>\n\n\ndef get(path):\n return reduce(lambda view, part: view[part], path.split('.'), config).get()\n", "step-2": "<mask token>\nconfig.set_file('config.yaml')\n\n\ndef get(path):\n return reduce(lambda view, par...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ZooAnnouncer(ZooAnnouncerInterface): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ZooAnnouncer(ZooAnnouncerInterface): def updateZoo(self, annoucement): ...
flexible
{ "blob_id": "be9c21ee04a612f711a1e6a82ea9478c77b62a82", "index": 8112, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n\n def updateZoo(self, annoucement):\n ...
[ 0, 1, 2, 3, 4 ]
x = 25 y = 43 print(x & y) print(x >> y) print(x ^ y) print(x | y)
normal
{ "blob_id": "34d011727c93bb4c8ccf64017e7185717ef98667", "index": 2603, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x & y)\nprint(x >> y)\nprint(x ^ y)\nprint(x | y)\n", "step-3": "x = 25\ny = 43\nprint(x & y)\nprint(x >> y)\nprint(x ^ y)\nprint(x | y)\n", "step-4": null, "step-5": null, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('') print('Lesson #2') print('Program start:') for i in a: if i < 9: print(i) print('End') <|reserved_special_token_1|> a = [3, 4, 2, 3, 5, 8, 23, 32, 35, 34, 4, 6, 9] print('') print('Lesson #2') print('Progr...
flexible
{ "blob_id": "58f7810e2731721562e3459f92684589dc66862c", "index": 881, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('')\nprint('Lesson #2')\nprint('Program start:')\nfor i in a:\n if i < 9:\n print(i)\nprint('End')\n", "step-3": "a = [3, 4, 2, 3, 5, 8, 23, 32, 35, 34, 4, 6, 9]\nprint('...
[ 0, 1, 2, 3 ]
myfavoritenumber = 5 print(myfavoritenumber) x = 5 x = x + 1 print(x) x, y, z = 1, 2, 3 print(x, y, z)
normal
{ "blob_id": "e6c7b15e5b42cfe6c5dec2eaf397b67afd716ebd", "index": 3858, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(myfavoritenumber)\n<mask token>\nprint(x)\n<mask token>\nprint(x, y, z)\n", "step-3": "myfavoritenumber = 5\nprint(myfavoritenumber)\nx = 5\nx = x + 1\nprint(x)\nx, y, z = 1, 2, 3...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': url = 'https://jsonplaceholder.typicode.com' if len(sys.argv) > 1: user_id = sys.argv[1] name = requests.get('{}/users/{}'.format(url, user_id)).json().get( 'name') ...
flexible
{ "blob_id": "e1a2b33a1ec7aca21a157895d8c7c5b5f29ff49c", "index": 5047, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url = 'https://jsonplaceholder.typicode.com'\n if len(sys.argv) > 1:\n user_id = sys.argv[1]\n name = requests.get('{}/users/{}'.format(ur...
[ 0, 1, 2, 3 ]
short_train <- read.csv('short_train.csv', header=TRUE) #delete unnecessary columns short_train[1] <- NULL #remove ngrams containing @user_ regexp <- "@[a-zA-Z0-9_]*" gsubtry <- gsub(pattern = regexp, replacement = "", x = short_train$Tweet) #merge gsubtry back into short_train, rename as Tweet short_train_clean <- ...
normal
{ "blob_id": "48a970b35aa7fd677828f5d7bd5f1dcf24511b01", "index": 9098, "step-1": "short_train <- read.csv('short_train.csv', header=TRUE)\n\n#delete unnecessary columns\nshort_train[1] <- NULL\n\n#remove ngrams containing @user_\nregexp <- \"@[a-zA-Z0-9_]*\"\ngsubtry <- gsub(pattern = regexp, replacement = \"\",...
[ 0 ]
from oil_prices import * with_without = 'without training' show_plot = 'yes' print('START') # Defining the past and future sequences for the LSTM training n_past = 8 n_future = 1 target_date = '2018-11-16' past = ['t']+['t-'+str(i) for i in range(1,n_past)] future = ['t+'+str(i) for i in range(1,n_future+1)] # Imp...
normal
{ "blob_id": "ec6067cc86b6ac702123d13911cc4ab97be6a857", "index": 4077, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('START')\n<mask token>\nprint(' - Imports data and formats the data')\n<mask token>\ntimeseries_to_supervised(df_train, n_past, n_future)\n<mask token>\nif with_without == 'with tra...
[ 0, 1, 2, 3, 4 ]
# -coding: UTF-8 -*- # @Time : 2020/06/24 20:01 # @Author: Liangping_Chen # @E-mail: chenliangping_2018@foxmail.com import requests def http_request(url,data,token=None,method='post'): header = {'X-Lemonban-Media-Type': 'lemonban.v2', 'Authorization':token} #判断是get请求还是post请求 if method=='ge...
normal
{ "blob_id": "dd7c7fa6493a43988e1c8079797f6ff9b4d239dd", "index": 4672, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef http_request(url, data, token=None, method='post'):\n header = {'X-Lemonban-Media-Type': 'lemonban.v2', 'Authorization': token}\n if method == 'get':\n result = reque...
[ 0, 1, 2, 3, 4 ]
# pylint: disable=W0621,C0114,C0116,W0212,W0613 import io import textwrap from typing import cast, Any, Dict import toml import pytest from dae.testing import convert_to_tab_separated from dae.configuration.gpf_config_parser import GPFConfigParser from dae.configuration.schemas.person_sets import person_set_collectio...
normal
{ "blob_id": "6c8f690e1b43d459535238e24cccc8aa118e2d57", "index": 3038, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef families_fixture():\n ped_content = io.StringIO(convert_to_tab_separated(\n \"\"\"\n familyId personId dadId\t momId\tsex status role\n f1 mom1 0 ...
[ 7, 8, 10, 11, 13 ]
# Evolutionary Trees contains algorithms and methods used in determining phylogenetic inheritance of various species. # Main algos UPGMA and CLUSTALW from dataclasses import dataclass import FormattingET @dataclass class Node: age: int num: int label: str alignment: [] def __init__(self, child1=Non...
normal
{ "blob_id": "53cf2dfe3319c39ca6f1dc890eea578fae654b5b", "index": 8847, "step-1": "<mask token>\n\n\n@dataclass\nclass Node:\n age: int\n num: int\n label: str\n alignment: []\n\n def __init__(self, child1=None, child2=None):\n self.child1 = child1\n self.child2 = child2\n\n\n<mask to...
[ 9, 12, 16, 17, 21 ]
# -*- coding: utf-8 -*- """Test(s) for static files :copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function import pytest import os _TEST_ID = '__NO_SUCH_STRING_IN_PAGE__' def s...
normal
{ "blob_id": "65b5db0bc6f23c342138060b7a006ff61e2dcf45", "index": 3761, "step-1": "<mask token>\n\n\ndef test_injection(fc):\n from pykern import pkcompat, pkunit\n from pykern.pkdebug import pkdc, pkdp, pkdlog\n from pykern.pkunit import pkeq, pkok, pkre\n import re\n r = fc.get('myapp')\n pkok...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class UserInfoAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "15134d7e4036c102bc9d2ba4d321fadd0467100f", "index": 6637, "step-1": "<mask token>\n\n\nclass UserInfoAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass UserInf...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sty.use('seaborn') <|reserved_special_token_0|> rospy.init_node('graph_poses_extract') for f in replayFiles: print('new SLiding Graph') inlierData = [] rmsData = [] inlierRatio = [] inFile = inNet + '/' + f + '...
flexible
{ "blob_id": "4b3de2d817aa6f8b92d513bcdba612362becefdc", "index": 9070, "step-1": "<mask token>\n", "step-2": "<mask token>\nsty.use('seaborn')\n<mask token>\nrospy.init_node('graph_poses_extract')\nfor f in replayFiles:\n print('new SLiding Graph')\n inlierData = []\n rmsData = []\n inlierRatio = [...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals import urllib def normalize_mac_address(address): return address.lower().replace("-", ":") def urlencode(s): return urllib.quote(s.encode("utf-8"), "") def urlencode_plus(s): return urllib.quote_plus(s.encode("...
normal
{ "blob_id": "33b8baf2ca819315eaa5f16c7986390acb4d6efd", "index": 878, "step-1": "<mask token>\n\n\ndef normalize_mac_address(address):\n return address.lower().replace('-', ':')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef normalize_mac_address(address):\n return address.lower().replace('-', ':...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MsecDebugger(DebuggerBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def debugger_app(self): """ Returns the name of the debugger applicat...
flexible
{ "blob_id": "706f8d83bc9b4fab6f6d365c047c33913daece61", "index": 5014, "step-1": "<mask token>\n\n\nclass MsecDebugger(DebuggerBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def debugger_app(self):\n \"\"\"\n Returns the name of the debugger ...
[ 8, 9, 12, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def display(request, id): context = {'job': Job.objects.get(id=int(id))} return render(request, 'handy_helper_exam/display.html', context) <|reserved_special_token_1|> from django.shortcuts import render, HttpResponse...
flexible
{ "blob_id": "f1fdba1c07a29aa22ee8d0dcbd6f902aa2e8b4c2", "index": 9342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef display(request, id):\n context = {'job': Job.objects.get(id=int(id))}\n return render(request, 'handy_helper_exam/display.html', context)\n", "step-3": "from django.short...
[ 0, 1, 2 ]
import tempfile import unittest from unittest.mock import mock_open, patch, MagicMock, call import compare_apple_music_and_spotify as music_compare class get_apple_music_data(unittest.TestCase): def test_open_file(self): with patch("builtins.open", mock_open(read_data="data")) as mock_file: a...
normal
{ "blob_id": "eec08b3fdd4beb7d88ac0dc6d2e8776cf54fda35", "index": 2727, "step-1": "<mask token>\n\n\nclass spotify_data_parser(unittest.TestCase):\n\n def test_open_file_and_return_formated_data_split_by_coma(self):\n with patch('builtins.open', mock_open(read_data='split,by,')):\n result = m...
[ 20, 23, 27, 28, 29 ]
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Jul 8 18:04:13 2018 @author: zhangchi """ class Solution(object): def transpose(self, A): """ :type A: List[List[int]] :rtype: List[List[int]] """ row = len(A[0]) result = [[] for _ in range(row)] ...
normal
{ "blob_id": "3882aaf94b19967a1d1eff23fa4862ea71de3b38", "index": 7014, "step-1": "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Jul 8 18:04:13 2018\n\n@author: zhangchi\n\"\"\"\n\nclass Solution(object):\n def transpose(self, A):\n \"\"\"\n :type A: List[List[int]]\n ...
[ 0 ]
import requests from bs4 import BeautifulSoup import codecs url = "https://en.wikipedia.org/wiki/Pennsylvania_State_University" response = requests.get(url) soup = BeautifulSoup(response.content, 'html.parser') infoBox = soup.find("table", class_="infobox vcard") webScrape = {"Univeristy": "The Pennsylvania State U...
normal
{ "blob_id": "f45ca4e75de7df542fbc65253bb9cc44a868522a", "index": 6398, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor tr in infoBox.find_all('tr'):\n if len(tr.findChildren('th', recursive=False)) > 0 and len(tr.\n findChildren('td', recursive=False)) > 0:\n header = tr.findChildren(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def addstudent(request): context = {} return render(request, 'add_student.html', context) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): student_objects = Student.objects.all() context = {'students': studen...
flexible
{ "blob_id": "00e8e0b5aeccd2a67f6cfdad63012a0d8b066e6f", "index": 9551, "step-1": "<mask token>\n\n\ndef addstudent(request):\n context = {}\n return render(request, 'add_student.html', context)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n student_objects = Student.objects.a...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @api_view(['POST']) @authenticated def fetchCurriculum(request): university = request.DATA['user'].university.shortname if university == 'Unknown': ret = produceRetCode('fail', 'university not supported') return Response(ret, status=status.HTTP_202_ACCEPTED) tr...
flexible
{ "blob_id": "a33ddb999f7bb50688b33946046ba460cbbbd172", "index": 9181, "step-1": "<mask token>\n\n\n@api_view(['POST'])\n@authenticated\ndef fetchCurriculum(request):\n university = request.DATA['user'].university.shortname\n if university == 'Unknown':\n ret = produceRetCode('fail', 'university not...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.parametrize(('num_of_elements', 'middle_idx', 'window_size', 'expected_indices'), [(100, 0, 10, (0, 10)), (100, 1, 10, (0, 10)), ( 100, 50, 10, (45, 55)), (271, 270, 10, (261, 271)), (314, 314, 10, (304, ...
flexible
{ "blob_id": "b7d7b6c070f237f9ab59f3367417ecf2672fbaaf", "index": 6437, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize(('num_of_elements', 'middle_idx', 'window_size',\n 'expected_indices'), [(100, 0, 10, (0, 10)), (100, 1, 10, (0, 10)), (\n 100, 50, 10, (45, 55)), (271,...
[ 0, 2, 3, 4, 5 ]
import pytest import json import os.path import importlib import jsonpickle from fixture.application import Application fixture = None config = None @pytest.fixture def app(request): global fixture global config browser = request.config.getoption("--browser") if config is None: conf_file_pat...
normal
{ "blob_id": "0c0fb3bfb81be5ef6a60584eafeefec61f171679", "index": 9124, "step-1": "<mask token>\n\n\n@pytest.fixture(scope='session', autouse=True)\ndef stop(request):\n global fixture\n\n def finalizer():\n fixture.session.ensure_logout()\n fixture.destroy()\n request.addfinalizer(finalize...
[ 4, 5, 6, 7, 9 ]
import random import time from typing import Dict, List, Optional from bemani.client.base import BaseClient from bemani.protocol import Node class ReflecBeatColette(BaseClient): NAME = 'TEST' def verify_pcb_boot(self, loc: str) -> None: call = self.call_node() pcb = Node.void('pcb') ...
normal
{ "blob_id": "f781377a52400abd617e7f0c5529726120b78476", "index": 3426, "step-1": "<mask token>\n\n\nclass ReflecBeatColette(BaseClient):\n <mask token>\n\n def verify_pcb_boot(self, loc: str) ->None:\n call = self.call_node()\n pcb = Node.void('pcb')\n pcb.set_attribute('method', 'boot...
[ 13, 14, 16, 18, 20 ]
print("Enter string:") s=input() a = s.lower() vowels = "aeiou" consonants = "bcdfghjklmnpqrstvwxyz" digits = "1234567890" whitespace = " " c = 0 v = 0 d = 0 ws= 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: ...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Alignment_Corrector(Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Alignment_Corrector(Module): def __init__(self): ...
flexible
{ "blob_id": "f3eed00a58491f36778b3a710d2f46be093d6eda", "index": 6320, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Alignment_Corrector(Module):\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Alignment_Corrector(Module):\n\n def __init__(self):\n self.d...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __all__: List[str] record: Any recarray: Any format_parser: Any fromarrays: Any fromrecords: Any fromstring: Any fromfile: Any array: Any <|reserved_special_token_1|> from typing import Any, List __all__: List[str] record: Any ...
flexible
{ "blob_id": "2e1ad83bcd16f59338032f8ad5ca8ebd74e92200", "index": 6664, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__: List[str]\nrecord: Any\nrecarray: Any\nformat_parser: Any\nfromarrays: Any\nfromrecords: Any\nfromstring: Any\nfromfile: Any\narray: Any\n", "step-3": "from typing import Any, ...
[ 0, 1, 2 ]
#!/usr/local/bin/python # -*- coding: utf-8 -*- from sqlalchemy import select, update from sqlalchemy import Table, Column, String, Integer, Float, Boolean, Date, BigInteger from sqlalchemy import create_engine, MetaData import API_and_Database_function as func import pandas as pd import re connection, Twitter_Senti...
normal
{ "blob_id": "a558b42106b036719fe38ee6efd1c5b933290f52", "index": 47, "step-1": "<mask token>\n", "step-2": "<mask token>\nconnection.execute(stmt)\nfunc.update_annotations_db(Twitter_Sentiment_Analysis, connection,\n 'Export_csv5.csv')\n", "step-3": "<mask token>\nconnection, Twitter_Sentiment_Analysis = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sample(x, arg=None): if arg is None: arg = [] arg.append(x) return arg <|reserved_special_token_0|> <|reserved_special_token_1|> def sample(x, arg=[]): arg.append(x) return arg <|reserved_s...
flexible
{ "blob_id": "1b645ab0a48b226e26009f76ea49fd3f10f5cc7b", "index": 3880, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sample(x, arg=None):\n if arg is None:\n arg = []\n arg.append(x)\n return arg\n\n\n<mask token>\n", "step-3": "def sample(x, arg=[]):\n arg.append(x)\n re...
[ 0, 1, 2, 3, 4 ]
def game_manager(info_list): dictionary = {} for piece_info in info_list: piece_info = piece_info.split('||') piece_info[2] = int(piece_info[2]) if piece_info[2] not in dictionary: dictionary[piece_info[2]] = {(piece_info[1],piece_info[0])} dictionary[piece_info[2]].a...
normal
{ "blob_id": "a382edb861a43ac3065a781ea996a8d1dd819954", "index": 6649, "step-1": "<mask token>\n", "step-2": "def game_manager(info_list):\n dictionary = {}\n for piece_info in info_list:\n piece_info = piece_info.split('||')\n piece_info[2] = int(piece_info[2])\n if piece_info[2] no...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with tf.name_scope('input_data'): (iterate_data, sub_images, sub_depths, sub_images_placeholder, sub_depths_placeholder) = rd.read_debug_data() sub_images_coarse = tf.constant(value=np.moveaxis(sub_images[0:223, 0:...
flexible
{ "blob_id": "8a2cf1d550a593beae579104413b424e007d511f", "index": 9048, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.name_scope('input_data'):\n (iterate_data, sub_images, sub_depths, sub_images_placeholder,\n sub_depths_placeholder) = rd.read_debug_data()\n sub_images_coarse = tf.c...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(len(peptidasesList)) <|reserved_special_token_0|> for i in range(len(peptidasesList)): if peptidasesList.loc[i, 'PDB'] not in bindingSiteDic: bindingSiteDic[peptidasesList.loc[i, 'PDB']] = {peptidasesList.loc[ ...
flexible
{ "blob_id": "67b1cdfa514aac4fdac3804285ec8d0aebce944d", "index": 6068, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(peptidasesList))\n<mask token>\nfor i in range(len(peptidasesList)):\n if peptidasesList.loc[i, 'PDB'] not in bindingSiteDic:\n bindingSiteDic[peptidasesList.loc[i, 'P...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import rospy from op3_utils.op3_utils import * from vision import * import cv2 import sys import rosnode #Yellow >> Right #Red >> Left class States: INIT = -1 GET_READY = 1 FIND_BAR = 2 WALK_2_BAR = 3 WALK_SIDEWAYS = 4 PICK_BAR = 5 WALK_WITH_BAR = 6 LIFT_BAR = 7 ...
normal
{ "blob_id": "b3a2db38e2074b02c8837bfce85d06598a7b194d", "index": 5701, "step-1": "<mask token>\n\n\nclass States:\n INIT = -1\n GET_READY = 1\n FIND_BAR = 2\n WALK_2_BAR = 3\n WALK_SIDEWAYS = 4\n PICK_BAR = 5\n WALK_WITH_BAR = 6\n LIFT_BAR = 7\n WALK_2_FINISH = 8\n END = 99\n\n\n<ma...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def load_data_from_file(filename): """ Load that data, my dude(tte) :param filename: The file from which you want to load data :return: Time and position data of the file """ time = [] position = [] with open(filename, 'r') as original: time_positio...
flexible
{ "blob_id": "4545ce36c4d3df50e263d3323c04c53acb2b50e0", "index": 7888, "step-1": "<mask token>\n\n\ndef load_data_from_file(filename):\n \"\"\"\n Load that data, my dude(tte)\n :param filename: The file from which you want to load data\n :return: Time and position data of the file\n \"\"\"\n ti...
[ 5, 6, 8, 9, 10 ]
"""Test cases for the __main__ module.""" import pytest from click.testing import CliRunner from skimpy import __main__ from skimpy import generate_test_data from skimpy import skim @pytest.fixture def runner() -> CliRunner: """Fixture for invoking command-line interfaces.""" return CliRunner() def test_ma...
normal
{ "blob_id": "97a51d959ad642467c508cedc8786f636e4050bb", "index": 1333, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef runner() ->CliRunner:\n \"\"\"Fixture for invoking command-line interfaces.\"\"\"\n return CliRunner()\n\n\ndef test_main_succeeds(runner: CliRunner) ->None:\n \"\"\"It exits with a s...
[ 3, 6, 7, 8, 9 ]
''' filter_items = lambda a : a[0] == 'b' fruits = ["apple", "banana", "pear", "orange"] result = filter(filter_items, fruits) print(list(result)) ''' ''' Given a list of integers, return the even integers in the list. input = [11, 4, 5, 8, 9, 2, 12] output = [4, 8, 2, 12] input = [3, 5, 7] output = [] ''' # even_...
normal
{ "blob_id": "7d9032b2426dbf3c285b99efa78be38d8f76ec24", "index": 1933, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(list(result))\n<mask token>\nprint(list(result))\n", "step-3": "<mask token>\neven_integers = lambda a: a % 2 == 0\ninput = [11, 4, 5, 8, 9, 2, 12]\nresult = filter(even_integers,...
[ 0, 1, 2, 3 ]
# # MIT License # # Copyright (c) 2018 Matteo Poggi m.poggi@unibo.it # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, c...
normal
{ "blob_id": "fbd8af4ab3e4ebdcb07509db776d38f9c26fd06a", "index": 9446, "step-1": "<mask token>\n\n\nclass trinet(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def generate_image_left(self, img, disp):\n return bilinear_sampler_1d_h(img, -disp)\n\n def generate_...
[ 8, 14, 15, 17, 18 ]
<|reserved_special_token_0|> def Get_Attachments(service, userId, msg_id, store_dir): """Get and store attachment from Message with given id. Args: service: Authorized Gmail API service instance. userId: User's email address. The special value "me" can be used to in...
flexible
{ "blob_id": "dee1ab3adb7f627680410c774be44ae196f63f6c", "index": 587, "step-1": "<mask token>\n\n\ndef Get_Attachments(service, userId, msg_id, store_dir):\n \"\"\"Get and store attachment from Message with given id.\n Args:\n service: Authorized Gmail API service instance.\n user...
[ 2, 4, 5, 6, 7 ]
__author__ = 'Jager' from equipment import Equipment class Weapon (Equipment): def __init__(self, name, power): super(Weapon, self).__init__(name) self.power = power @staticmethod def fromJSON(jsonstr): obj = Equipment.fromJSON(jsonstr) return Weapon(obj["name"], obj["powe...
normal
{ "blob_id": "276d7ac493ddcb327dbce279d9f4bc8a74c98245", "index": 5749, "step-1": "<mask token>\n\n\nclass Weapon(Equipment):\n\n def __init__(self, name, power):\n super(Weapon, self).__init__(name)\n self.power = power\n <mask token>\n\n def __str__(self):\n return '{}: Power({})'....
[ 3, 4, 5, 6, 7 ]
import math import numpy as np import cv2 from matplotlib import pyplot as plt from sklearn.cluster import KMeans from sklearn import metrics from scipy.spatial.distance import cdist if (__name__ == "__main__"): cap = cv2.VideoCapture('dfd1.mp4') mog = cv2.createBackgroundSubtractorMOG2(detectSha...
normal
{ "blob_id": "28a0ae0492fb676044c1f9ced7a5a4819e99a8d9", "index": 8890, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n cap = cv2.VideoCapture('dfd1.mp4')\n mog = cv2.createBackgroundSubtractorMOG2(detectShadows=0)\n count = 0\n while True:\n list = []\n ...
[ 0, 1, 2, 3 ]
import numpy as np import itertools as itt from random import random from sys import float_info DIGITS = 3 ACCURACY = 0.001 UP_MAX = 30 class AngleInfo(object): def __init__(self, information): # 0 <= spin <= 360 # 0 <= up <= UP_MAX # -1 <= sin, cos <= 1 if len(information) == 2: ...
normal
{ "blob_id": "97bbbbe6a3a89b9acc22ebdff0b96625d6267178", "index": 3341, "step-1": "import numpy as np\nimport itertools as itt\nfrom random import random\nfrom sys import float_info\n\nDIGITS = 3\nACCURACY = 0.001\nUP_MAX = 30\n\nclass AngleInfo(object):\n\n def __init__(self, information):\n # 0 <= spi...
[ 0 ]
<|reserved_special_token_0|> def main(): hostid = hostid_get(token) itemid_array = itemid_get(hostid, token) update(itemid_array, token) def hostid_get(token): payload = {} payload['jsonrpc'] = '2.0' payload['method'] = 'host.get' payload['params'] = {} payload['params']['output'] = ...
flexible
{ "blob_id": "18d7c486b9070a1c607ba2ba5876309246013182", "index": 4651, "step-1": "<mask token>\n\n\ndef main():\n hostid = hostid_get(token)\n itemid_array = itemid_get(hostid, token)\n update(itemid_array, token)\n\n\ndef hostid_get(token):\n payload = {}\n payload['jsonrpc'] = '2.0'\n payload...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class QuitButton(QtGui.QWidget): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class QuitButton(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self....
flexible
{ "blob_id": "5a3431b79b8f42b3042bb27d787d0d92891a7415", "index": 3947, "step-1": "<mask token>\n\n\nclass QuitButton(QtGui.QWidget):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass QuitButton(QtGui.QWidget):\n\n def __init__(self, parent=None):\n QtGui.QWidget.__init__(self...
[ 1, 3, 4, 5, 6 ]
from datetime import datetime import pytz from pytz import timezone ##PDXtime = datetime.now() ##print(PDXtime.hour) ## ##NYCtime = PDXtime.hour + 3 ##print(NYCtime) ## ##Londontime = PDXtime.hour + 8 ##print(Londontime) Londontz = timezone('Europe/London') Londonlocaltime = datetime.now(Londontz) print(Londo...
normal
{ "blob_id": "d8cfd9de95e1f47fc41a5389f5137b4af90dc0f1", "index": 3949, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(Londonlocaltime)\nprint(Londonlocaltime.strftime('%H'))\n<mask token>\nprint(PDXlocaltime)\nprint(PDXlocaltime.strftime('%H'))\n<mask token>\nprint(NYClocaltime)\nprint(NYClocaltime...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> include('f469-disco/manifest_f469.py') freeze('src')
flexible
{ "blob_id": "3b29912788fa4cc76f34f52da7728e934ee96637", "index": 7117, "step-1": "<mask token>\n", "step-2": "include('f469-disco/manifest_f469.py')\nfreeze('src')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
#Classe do controlador do servidor SEEEEEEERVIDOOOOOOOOOOR from usuarioModel import * class ControllerSC: ''' O controlador define 2 ações: - adicionar_pessoa: para adicionar novas pessoas no banco de dados. - listar_pessoas: retornar a lista das pessoas Note que as 2 ações supracita...
normal
{ "blob_id": "39eecf1c7ec19f7c75721caa092c08569f53d3e5", "index": 9449, "step-1": "<mask token>\n\n\nclass ControllerSC:\n <mask token>\n <mask token>\n\n @staticmethod\n def entrarSC(login, senha):\n resultado = Usuario.entrar(login, senha)\n return resultado\n <mask token>\n <mas...
[ 2, 5, 6, 7, 8 ]
import mlcd,pygame,time,random PLAYER_CHAR=">" OBSTACLE_CHAR="|" screenbuff=[[" "," "," "," "," "," "," "," "," "," "," "," "], [" "," "," "," "," "," "," "," "," "," "," "," "]] player={"position":0,"line":0,"score":000} game={"speed":4.05,"level":2.5,"obstacle":0} keys={"space":False,"quit":False,"nex...
normal
{ "blob_id": "aeaab602cbb9fa73992eb5259e8603ecb11ba333", "index": 4863, "step-1": "<mask token>\n\n\ndef keypress():\n global keys\n keys['space'] = keys['quit'] = keys['next'] = False\n for event in pygame.event.get():\n if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @dataclass_with_properties class ExternalMap: external_id: str verified_using: List[IntegrityMethod] = field(default_factory=list) location_hint: Optional[str] = None defining_document: Optional[str] = None <...
flexible
{ "blob_id": "1c085ea8f9b21ea7bef94ad4ecbb1771a57f697a", "index": 2208, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclass_with_properties\nclass ExternalMap:\n external_id: str\n verified_using: List[IntegrityMethod] = field(default_factory=list)\n location_hint: Optional[str] = None\...
[ 0, 1, 2, 3, 4 ]