code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import os from flask import Flask, request, jsonify, Response, abort from sesamutils import sesam_logger, VariablesConfig from sesamutils.flask import serve required_env_vars = ["SUBDOMAIN"] optional_env_vars = ["DEBUG", "LOG_LEVEL", ("API_ROOT","zendesk.com/api/v2/tickets/")] # Default values can be given t...
normal
{ "blob_id": "bb58b4384eaeec45be1af865012c618af05f5a0a", "index": 9667, "step-1": "<mask token>\n\n\n@app.route('/api/orders/update/<int:orderID>', methods=['GET', 'PUT',\n 'POST', 'DELETE'])\ndef update_ticket(orderID):\n try:\n if request.method != 'PUT':\n abort(405)\n logger...
[ 3, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.random.seed(0) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(description= 'Generate artificial videos with one subject in Casia-B') parser.add_argument('--dataset', type=str, re...
flexible
{ "blob_id": "6b32f829648b92da4b638ffd79692ffb86be80fe", "index": 8761, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(0)\nif __name__ == '__main__':\n import argparse\n parser = argparse.ArgumentParser(description=\n 'Generate artificial videos with one subject in Casia-B')\n ...
[ 0, 1, 2, 3 ]
import os import matplotlib.pyplot as plt import cv2 import numpy as np def divide_img(img_path, img_name, save_path): imgg = img_path +'\\' +img_name print(imgg) img = cv2.imread(imgg) print(img) # img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) h = img.shape[0] w = img.shape[1] n = 8 ...
normal
{ "blob_id": "03f3fcb38877570dea830a56460061bd3ccb8927", "index": 8830, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef divide_img(img_path, img_name, save_path):\n imgg = img_path + '\\\\' + img_name\n print(imgg)\n img = cv2.imread(imgg)\n print(img)\n h = img.shape[0]\n w = img...
[ 0, 1, 2, 3, 4 ]
# 使用celery from django.conf import settings from django.core.mail import send_mail from django.template import loader,RequestContext from celery import Celery import time # 在任务处理者一 # # 端加的代码 import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dailyfresh.settings") django.setup() from goods.models ...
normal
{ "blob_id": "7f7d087b7001cd7df01d4f22e056809be5a35568", "index": 9584, "step-1": "<mask token>\n\n\n@app.task\ndef generate_static_index_html():\n \"\"\"产生首页静态页面\"\"\"\n types = GoodsType.objects.all()\n goods_banners = IndexGoodsBanner.objects.all().order_by('index')\n promotion_banners = IndexPromo...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> class MockSOLR(object): class MockHits(list): @property def hits(self): return len(self) @property def docs(self): return self <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "4774c1f4eafc0132bab0073b60c4bcad6b69380d", "index": 9068, "step-1": "<mask token>\n\n\nclass MockSOLR(object):\n\n\n class MockHits(list):\n\n @property\n def hits(self):\n return len(self)\n\n @property\n def docs(self):\n return self\n <mask ...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if 'feira' in msg: print('Sim, foi a feira') else: print('não ele não foi a feira') <|reserved_special_token_1|> msg = 'eduardo foi a feira' if 'feira' in msg: print('Sim, foi a feira') else: print('não ele não ...
flexible
{ "blob_id": "2a83bc9157e2210da46e58c56fc0b7199856f4c0", "index": 6287, "step-1": "<mask token>\n", "step-2": "<mask token>\nif 'feira' in msg:\n print('Sim, foi a feira')\nelse:\n print('não ele não foi a feira')\n", "step-3": "msg = 'eduardo foi a feira'\nif 'feira' in msg:\n print('Sim, foi a feir...
[ 0, 1, 2, 3 ]
from django.shortcuts import render from django.http import HttpResponse # # Create your views here. # def Login_Form(request): # return render(request, 'Login.html')
normal
{ "blob_id": "ee161ff66a6fc651a03f725427c3731bdf4243eb", "index": 6906, "step-1": "<mask token>\n", "step-2": "from django.shortcuts import render\nfrom django.http import HttpResponse\n", "step-3": "from django.shortcuts import render\r\nfrom django.http import HttpResponse\r\n\r\n\r\n\r\n# # Create your vie...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @app.get('/jobs/', response_model=List[schemas.Job]) def read_jobs(skip: int=0, limit: int=100, db: Session=Depends(get_db)): jobs = crud.get_jobs(db, skip=skip, limit=limit) return jobs @app.get('/jobs/{job_id}', response_model=schemas.Job) def read_job(job_id: int, db: Session...
flexible
{ "blob_id": "ad474f5120ca2a8c81b18071ab364e6d6cf9e653", "index": 7031, "step-1": "<mask token>\n\n\n@app.get('/jobs/', response_model=List[schemas.Job])\ndef read_jobs(skip: int=0, limit: int=100, db: Session=Depends(get_db)):\n jobs = crud.get_jobs(db, skip=skip, limit=limit)\n return jobs\n\n\n@app.get('...
[ 6, 8, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_user_agent(): return {'User-Agent': random.choice(user_agent)} <|reserved_special_token_1|> <|reserved_special_token_0|> user_agent = [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534...
flexible
{ "blob_id": "5ed91b98ece3ac9525e9d2c42db9c9d9912d5ed2", "index": 9029, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_user_agent():\n return {'User-Agent': random.choice(user_agent)}\n", "step-3": "<mask token>\nuser_agent = [\n 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us...
[ 0, 1, 2, 3, 4 ]
# SaveIsawQvector import sys import os if os.path.exists("/opt/Mantid/bin"): sys.path.append("/opt/mantidnightly/bin") #sys.path.append("/opt/Mantid/bin") # Linux cluster #sys.path.append('/opt/mantidunstable/bin') else: sys.path.append("C:/MantidInstall/bin") # Windows PC # import ma...
normal
{ "blob_id": "b72bf00d156862c7bddecb396da3752be964ee66", "index": 5463, "step-1": "# SaveIsawQvector\r\n\r\nimport sys\nimport os\n\r\nif os.path.exists(\"/opt/Mantid/bin\"):\n sys.path.append(\"/opt/mantidnightly/bin\")\n #sys.path.append(\"/opt/Mantid/bin\") # Linux cluster\n #sys.path.append('...
[ 0 ]
""" This example shows how to communicate with a SH05 (shutter) connected to a KSC101 (KCube Solenoid). """ # this "if" statement is used so that Sphinx does not execute this script when the docs are being built if __name__ == '__main__': import os import time from msl.equipment import EquipmentRecord, Co...
normal
{ "blob_id": "04b5df5cfd052390f057c6f13b2e21d27bac6449", "index": 943, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n import os\n import time\n from msl.equipment import EquipmentRecord, ConnectionRecord, Backend\n from msl.equipment.resources.thorlabs import Motio...
[ 0, 1, 2 ]
# Generate some object patterns as save as JSON format import json import math import random from obstacle import * def main(map): obs = [] for x in range(1,35): obs.append(Obstacle(random.randint(0,map.getHeight()), y=random.randint(0,map.getWidth()), radius=20).toJsonObject()) jsonOb={'map': {'obstacle': obs}}...
normal
{ "blob_id": "b849a2902c8596daa2c6da4de7b9d1c07b34d136", "index": 7883, "step-1": "# Generate some object patterns as save as JSON format\nimport json\nimport math\nimport random\nfrom obstacle import *\n\ndef main(map):\n\tobs = []\n\tfor x in range(1,35):\n\t\tobs.append(Obstacle(random.randint(0,map.getHeight(...
[ 0 ]
''' Module for interaction with database ''' import sqlite3 from enum import Enum DB_NAME = 'categories.db' class State(Enum): ok = True error = False def get_db_connection(): try: global connection connection = sqlite3.connect(DB_NAME) cursor = connection.cursor() exce...
normal
{ "blob_id": "9b3c2604b428295eda16030b45cf739e714f3d00", "index": 1614, "step-1": "<mask token>\n\n\nclass State(Enum):\n ok = True\n error = False\n\n\n<mask token>\n\n\ndef close_db_connection():\n try:\n connection.close()\n except Exception:\n print('Error closing connection')\n\n\nd...
[ 7, 8, 10, 11, 12 ]
from math import exp from math import e import numpy as np import decimal import pandas as pd pop = [] x = 0 for a in range(1,10001): pop.append((1.2)*e**(-1.2*x)) x =+0.0001 for k in range(100,10100,100): exec(f'S{k} =pop[1:k]') ################################################...
normal
{ "blob_id": "adfdd988b7e208229f195308df8d63fd2799046f", "index": 8941, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor a in range(1, 10001):\n pop.append(1.2 * e ** (-1.2 * x))\n x = +0.0001\nfor k in range(100, 10100, 100):\n exec(f'S{k} =pop[1:k]')\n<mask token>\nfor size in np.arange(100, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): total_count = 0 valid_count = 0 with open(options['INPUT'], 'rb') as fh: reader = MARCReader(fh, to_unicode=True, force_utf8=True) if not options['--csv']: writer = MARCWriter(open('out.mrc' or options['--output'], 'wb')) for...
flexible
{ "blob_id": "c6cce2edafd7683af766b932d90ca170359e648a", "index": 679, "step-1": "<mask token>\n\n\ndef main():\n total_count = 0\n valid_count = 0\n with open(options['INPUT'], 'rb') as fh:\n reader = MARCReader(fh, to_unicode=True, force_utf8=True)\n if not options['--csv']:\n ...
[ 1, 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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": "ef57f0dfea261f022ced36ef9e27a07d63c21026", "index": 2156, "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 = [('eCom', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Other_Operations_Stack(Stack): def min_value(self): min_value = self.peek() for value in self._data: if value < min_value: min_value = value self.pop() return min_value <|reserved_special_token_0|> <|reserv...
flexible
{ "blob_id": "0b2fd671b99b7012a14b132db2322318873b826c", "index": 1345, "step-1": "<mask token>\n\n\nclass Other_Operations_Stack(Stack):\n\n def min_value(self):\n min_value = self.peek()\n for value in self._data:\n if value < min_value:\n min_value = value\n ...
[ 2, 3, 4, 5, 6 ]
import random import numpy as np class Board: def __init__(self, nrows, ncols, random_seed=42): self.nrows = nrows self.ncols = ncols self.random = random.Random() self.random.seed(random_seed) self.board = np.zeros((nrows, ncols)) self.score = 0 self.__add_new_numbers() # Initialize with 1/8 of the ...
normal
{ "blob_id": "cab45a823e319bd504b3db68cf70bff315f44fc6", "index": 7462, "step-1": "<mask token>\n\n\nclass Board:\n\n def __init__(self, nrows, ncols, random_seed=42):\n self.nrows = nrows\n self.ncols = ncols\n self.random = random.Random()\n self.random.seed(random_seed)\n ...
[ 10, 12, 13, 14, 16 ]
from random import randint in_file = open("vocabulary.txt", "r") voca_dic = {} for line in in_file: data = line.strip().split(": ") eng_word = data[0] kor_word = data[1] voca_dic[eng_word] = kor_word while True: keys = list(voca_dic.keys()) index = randint(1, len(keys) - 1) input_val ...
normal
{ "blob_id": "be64c981e7ea70dfcbd840988a633b4a71a43783", "index": 9814, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in in_file:\n data = line.strip().split(': ')\n eng_word = data[0]\n kor_word = data[1]\n voca_dic[eng_word] = kor_word\nwhile True:\n keys = list(voca_dic.keys())...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def upgrade(): op.execute(' '.join([update.format('false'), where])) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def upgrade(): op.execute(' '.join([update.format('false'), where])) def downgrade(): op.execute(' '.join([updat...
flexible
{ "blob_id": "89ed30411c624e3d930db0bc0b5b716a10908727", "index": 8259, "step-1": "<mask token>\n\n\ndef upgrade():\n op.execute(' '.join([update.format('false'), where]))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef upgrade():\n op.execute(' '.join([update.format('false'), where]))\n\n\ndef dow...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> x *= 2 <|reserved_special_token_0|> <|reserved_special_token_1|> #!/usr/bin/env python x *= 2 """run = 0 while(run < 10): [TAB]x = (first number in sequence) [TAB](your code here) [TAB]run += 1"""
flexible
{ "blob_id": "3e84265b7c88fc45bc89868c4339fe37dcc7d738", "index": 1112, "step-1": "<mask token>\n", "step-2": "x *= 2\n<mask token>\n", "step-3": "#!/usr/bin/env python\r\n\r\nx *= 2\r\n\r\n\"\"\"run = 0\r\nwhile(run < 10):\r\n[TAB]x = (first number in sequence)\r\n[TAB](your code here)\r\n[TAB]run += 1\"\"\"...
[ 0, 1, 2 ]
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from django.core.mail import EmailMultiAlternatives from django.template import loader from django.conf import settings from django.contrib.sites.shortcuts import ...
normal
{ "blob_id": "de77edaccdaada785f41828135ad2da4ae2b403e", "index": 725, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n blog = models.ForeignKey(Blog, on_delete=models.DO_NOTHING)\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n header = models.CharField(max_length=50)\n text = mod...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='greeker', version='0.3.2-git', description= 'scrambles nouns in an XML document to produce a specimen for layout testing' , author='Brian Tingle', author_email= 'brian.tingle.cdlib.org@gmail.com', url= ...
flexible
{ "blob_id": "1fda8274024bdf74e7fbd4ac4a27d6cfe6032a13", "index": 9790, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='greeker', version='0.3.2-git', description=\n 'scrambles nouns in an XML document to produce a specimen for layout testing'\n , author='Brian Tingle', author_email=\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> region = 'us-east-2' ec2 = boto3.resource('ec2', region) ImageId = 'ami-07efac79022b86107' KeyName = 'aws_keypair' InstanceType = 't2.micro' instances = ec2.create_instances(ImageId=ImageId, MinCount=1, MaxCount=5, KeyName=Key...
flexible
{ "blob_id": "b7606befe123c4fb6840a1bc62e43e6721edfcc3", "index": 5005, "step-1": "<mask token>\n", "step-2": "<mask token>\nregion = 'us-east-2'\nec2 = boto3.resource('ec2', region)\nImageId = 'ami-07efac79022b86107'\nKeyName = 'aws_keypair'\nInstanceType = 't2.micro'\ninstances = ec2.create_instances(ImageId=...
[ 0, 1, 2, 3 ]
<|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": "156203042ed8a9bde0e9d8587ea3d37de6bcfdf7", "index": 5155, "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 = [('sub_adjuste...
[ 0, 1, 2, 3, 4 ]
import requests from lxml import html headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36'} mail_ru_link = "http://mail.ru" lenta_link = "https://lenta.ru/" req = requests.get(mail_ru_link, headers=headers).text root = html....
normal
{ "blob_id": "00d2a29774a4278b1b022571b3f16c88224f08fc", "index": 5207, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(links) > 0:\n for i, l in enumerate(links):\n article = {'link': l, 'title': titles[i], 'source': mail_ru_link}\n news.append(article)\nelse:\n print('Error')\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def item(request): if not request.session.get('is_login', None): return redirect('/item/item') else: item_list = Item.objects.all() return render(request, 'item/item.html', locals()) <|reserved_special_token_0|> def add_unit(request): if request.met...
flexible
{ "blob_id": "22b2ebdbb48caa593bece030d238089a0aa27053", "index": 1983, "step-1": "<mask token>\n\n\ndef item(request):\n if not request.session.get('is_login', None):\n return redirect('/item/item')\n else:\n item_list = Item.objects.all()\n return render(request, 'item/item.html', loc...
[ 4, 5, 6, 8, 11 ]
<|reserved_special_token_0|> def displayEmployees(): fh = open('Employee.txt', 'r') for line in fh: emp = line.split(',') print('\nEmployee No:', emp[0], '\nEmployee Name:', emp[1], '\nBasic:', emp[2], '\nHRA:', emp[3], '\nDA:', emp[4], '\nGross Salary:', emp[5], '\nInc...
flexible
{ "blob_id": "5b6241907cc97f82d6c6e0a461f4f71a9a567204", "index": 5395, "step-1": "<mask token>\n\n\ndef displayEmployees():\n fh = open('Employee.txt', 'r')\n for line in fh:\n emp = line.split(',')\n print('\\nEmployee No:', emp[0], '\\nEmployee Name:', emp[1],\n '\\nBasic:', emp[...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Connector: <|reserved_special_token_0|> @abc.abstractmethod def save(self, item): pass @abc.abstractmethod def load_all(self): pass @abc.abstractmethod def load_by_id(self, id): pass <|reserved_special_token_0|> <|reserv...
flexible
{ "blob_id": "ac46aa6f8f4f01b6f3c48532533b9dd41a8a1c1c", "index": 7007, "step-1": "<mask token>\n\n\nclass Connector:\n <mask token>\n\n @abc.abstractmethod\n def save(self, item):\n pass\n\n @abc.abstractmethod\n def load_all(self):\n pass\n\n @abc.abstractmethod\n def load_by_...
[ 4, 5, 7, 8, 10 ]
<|reserved_special_token_0|> class UserData(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: verbose_name = 'Данные пользователя...
flexible
{ "blob_id": "8f57e120a1a84eb0b9918128580c152aabc6a724", "index": 6778, "step-1": "<mask token>\n\n\nclass UserData(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_name = 'Данные пользователя'\n ...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python3 import argparse import os import sys,shutil from shutil import make_archive import pathlib from phpManager import execute,execute_outputfile from datetime import date,datetime import re import pymysql import tarfile def append_log(log,message): f = open(log, "a+") today = datetime.now()...
normal
{ "blob_id": "e09af436f2fb37d16427aa0b1416d6f2d59ad6c4", "index": 214, "step-1": "<mask token>\n\n\ndef append_log(log, message):\n f = open(log, 'a+')\n today = datetime.now()\n f.write('%s %s \\n' % (today.strftime('%Y-%m-%d %H:%M:%S'), message))\n f.close()\n\n\ndef get_root_pass():\n with open(...
[ 10, 11, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: r = sr.Recognizer() with sr.Microphone() as source: system('clear') print(color(BOLD + 'Hola!\nAsk me anything.' + END, 'green')) while True: audio = r.listen(source) tr...
flexible
{ "blob_id": "d3e728bda85d2e72b8e477ab439d4dcffa23d63a", "index": 5448, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n r = sr.Recognizer()\n with sr.Microphone() as source:\n system('clear')\n print(color(BOLD + 'Hola!\\nAsk me anything.' + END, 'green'))\n while True:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance ): import math numer = elv2 - baseElev denom = dist_betwn_baseElev_elv2 print(numer, denom) distance = math.sqrt(numer ** 2 + denom ** 2) if denom == 0:...
flexible
{ "blob_id": "65b30bbe737b331447235b5c640e9c3f7f6d6f8c", "index": 5851, "step-1": "<mask token>\n", "step-2": "def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance\n ):\n import math\n numer = elv2 - baseElev\n denom = dist_betwn_baseElev_elv2\n print(numer, denom)\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TreeNode: <|reserved_special_token_0|> class Solution: def isSymmetric(self, root: TreeNode) ->bool: if not root: return True queue ...
flexible
{ "blob_id": "24a4b9246a9b15334bebc45c532a25bd81266918", "index": 9650, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TreeNode:\n <mask token>\n\n\nclass Solution:\n\n def isSymmetric(self, root: TreeNode) ->bool:\n if not root:\n r...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class CutoffStrategy: <|reserved_special_token_0|> def __init__(self, generate_fn, description='undescribed cutoff strategy'): self.generate_fn = generate_fn self.description = description class FixWindowCutoffStrategy(CutoffStrategy): def __init__(self, en...
flexible
{ "blob_id": "30f030d48368e1b103f926ee7a15b4b75c4459c7", "index": 7030, "step-1": "<mask token>\n\n\nclass CutoffStrategy:\n <mask token>\n\n def __init__(self, generate_fn, description='undescribed cutoff strategy'):\n self.generate_fn = generate_fn\n self.description = description\n\n\nclass...
[ 5, 6, 7, 8, 9 ]
import xml.parsers.expat import urllib2 import threading def check_url(checkurl, checkstring, checkname): try: opener = urllib2.urlopen(checkurl, timeout = 5) if checkstring[0] == "!": if checkstring.encode('utf-8')[1:] not in opener.read(): print "Open",checkname else: #print "...
normal
{ "blob_id": "9d3d7000ed13a2623a53705d55b5dbb42662ce2f", "index": 4296, "step-1": "import xml.parsers.expat\nimport urllib2\nimport threading\n\n\n\ndef check_url(checkurl, checkstring, checkname):\n try:\n opener = urllib2.urlopen(checkurl, timeout = 5)\n if checkstring[0] == \"!\":\n if checkstring....
[ 0 ]
<|reserved_special_token_0|> class TabPaneRepartitor(editor.PaneRepartitor): def __init__(self, instance_editor, tab_edited_class): self.instance_editor = ... self.tab_edited_class = ... def is_displayed_in_other_tab(self, attribute, o_Class): ... <|reserved_special_token_0|> ...
flexible
{ "blob_id": "440c116327ee587b5a305953772523011ece5dda", "index": 9641, "step-1": "<mask token>\n\n\nclass TabPaneRepartitor(editor.PaneRepartitor):\n\n def __init__(self, instance_editor, tab_edited_class):\n self.instance_editor = ...\n self.tab_edited_class = ...\n\n def is_displayed_in_oth...
[ 13, 16, 20, 23, 25 ]
from tqdm import tqdm import os import pandas as pd import pickle import numpy as np def inv_list(l, start=0): d = {} for i in range(len(l)): d[l[i]] = i+start return d raw_data_path = '/home/reddy/sindhu/datasets/physionet_2012/' def read_dataset(d): ts = [] pbar = tqdm(os.listdir(raw_dat...
normal
{ "blob_id": "3e07a2a2d0a810c016720fa41d71d0771cbccfef", "index": 626, "step-1": "<mask token>\n\n\ndef inv_list(l, start=0):\n d = {}\n for i in range(len(l)):\n d[l[i]] = i + start\n return d\n\n\n<mask token>\n\n\ndef read_dataset(d):\n ts = []\n pbar = tqdm(os.listdir(raw_data_path + '/s...
[ 2, 3, 4, 5, 6 ]
from unittest.case import TestCase from datetime import datetime from src.main.domain.Cohort import Cohort from src.main.domain.Group import Group from src.main.util.TimeFormatter import TimeFormatter __author__ = 'continueing' class CohortTest(TestCase): def testAnalyzeNewGroups(self): cohort = Cohort(...
normal
{ "blob_id": "f12bdfc054e62dc244a95daad9682790c880f20d", "index": 5367, "step-1": "<mask token>\n\n\nclass CohortTest(TestCase):\n\n def testAnalyzeNewGroups(self):\n cohort = Cohort(aStartDate=TimeFormatter.toDatetime(\n '2014-05-05 00:00:00'), aEndDate=TimeFormatter.toDatetime(\n ...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.0.8 on 2021-03-25 13:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Asha', '0005_baby'), ] operations = [ migrations.AlterField( model_name='baby', ...
normal
{ "blob_id": "e14b8d0f85042ceda955022bee08b3b3b4c2361d", "index": 7367, "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 = [('Asha', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @six.add_metaclass(abc.ABCMeta) class Hal: def __init__(self, configpath): self.configpath = configpath dir_path = os.path.join(os.path.dirname(__file__), 'libraries') lib_files = [f for f in os.listdir(dir_path) if os.path.isfile(os. path.join(dir...
flexible
{ "blob_id": "81dec10686b521dc9400a209caabc1601efd2a88", "index": 540, "step-1": "<mask token>\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass Hal:\n\n def __init__(self, configpath):\n self.configpath = configpath\n dir_path = os.path.join(os.path.dirname(__file__), 'libraries')\n lib_files =...
[ 3, 5, 6, 8, 9 ]
HORIZONTAL_TABLE = b'\x09' class ReagentInfoItem(): ''' This class if defined for a single reagent info unit, from the table's view, its a cell of the table. ''' def __init__(self, reagent_name, reagent_count): self.reagent_name = reagent_name self.reagent_count = reagent_count de...
normal
{ "blob_id": "994210b3de82af02ec7b1b7bee75ceb88ffb2bd5", "index": 2491, "step-1": "\nHORIZONTAL_TABLE = b'\\x09'\n\nclass ReagentInfoItem():\n '''\n This class if defined for a single reagent info unit, from the table's view, its a cell of the table.\n '''\n def __init__(self, reagent_name, reagent_co...
[ 0 ]
<|reserved_special_token_0|> class HandleConfig(ConfigParser): def __init__(self, ini_file_neme): super().__init__() self.ini_file_neme = ini_file_neme def red_conf__(self): file_path = os.path.join(conf_dir, self.ini_file_neme) self.read(file_path, encoding='utf-8') <|rese...
flexible
{ "blob_id": "01e60123ad87d9ff49812fe3a6f5d55bc85921c5", "index": 4071, "step-1": "<mask token>\n\n\nclass HandleConfig(ConfigParser):\n\n def __init__(self, ini_file_neme):\n super().__init__()\n self.ini_file_neme = ini_file_neme\n\n def red_conf__(self):\n file_path = os.path.join(co...
[ 3, 4, 5, 6, 7 ]
from django.apps import AppConfig class SmashbotspainConfig(AppConfig): name = 'smashbotspain'
normal
{ "blob_id": "e714755d660ba809f7958cad4f0b9f95b0a0ffdc", "index": 9320, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SmashbotspainConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass SmashbotspainConfig(AppConfig):\n name = 'smashbotspain'\n", "step-4": "from djan...
[ 0, 1, 2, 3 ]
# # # # ------------------------------------------------------------------------------------------------------------------------------ # # This program have been developed by Hamed Noori and with citiation of the related publicaitons # can be used without permission. # This program is for a novel architecture f...
normal
{ "blob_id": "4775bef3623497e9bbe79ca2d4e9e9da0422c450", "index": 401, "step-1": "<mask token>\n", "step-2": "def start_simulation(sumo, scenario, network, begin, end, interval, output):\n logging.debug('Finding unused port')\n unused_port_lock = UnusedPortLock()\n unused_port_lock.__enter__()\n rem...
[ 0, 1, 2 ]
import base64 import bleach import errno import fcntl import gzip import hashlib import importlib import inspect import magic import mimetypes import morepath import operator import os.path import re import shutil import sqlalchemy import urllib.request from markupsafe import Markup from collections.abc import Iterabl...
normal
{ "blob_id": "084c9ad83091f6f96d19c0f0c28520ccda93bbaf", "index": 7778, "step-1": "<mask token>\n\n\ndef normalize_for_url(text: str) ->str:\n \"\"\" Takes the given text and makes it fit to be used for an url.\n\n That means replacing spaces and other unwanted characters with '-',\n lowercasing everythi...
[ 35, 38, 46, 49, 61 ]
from django.shortcuts import get_object_or_404 from rest_framework import generics from .models import Duck from .serializers import Duck_Serializer class DuckList(generics.ListCreateAPIView): queryset = Duck.objects.all() serializer_class = Duck_Serializer def get_object(self): queryset = self.get_queryset() ...
normal
{ "blob_id": "8334478c8b7fc7688477cdb837467e00e857c07c", "index": 1196, "step-1": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Answer: """ Wrapper for A_B_X directory containing all associated attributes. Populate all fields of the class and call grade to determine if the question was correct **user_answers user_answer either "A" or "B" indicating which file sounded...
flexible
{ "blob_id": "c6ef9154285dee3b21980801a101ad5e34a50cab", "index": 4656, "step-1": "<mask token>\n\n\nclass Answer:\n \"\"\"\n Wrapper for A_B_X directory containing all associated attributes. \n Populate all fields of the class and call grade to determine if the \n question was correct\n **user_ans...
[ 4, 10, 11, 13, 15 ]
<|reserved_special_token_0|> class Cart: def __init__(self): self.book_list = [] self.total = 0 self.save = 0 def total_price(self): ele = 0 for i in self.book_list: ele += i.book.book_dprice * i.amount self.total = round(ele, 2) return sel...
flexible
{ "blob_id": "58efaad41d02bb5dffbf71c478c7fad12af68e5b", "index": 9900, "step-1": "<mask token>\n\n\nclass Cart:\n\n def __init__(self):\n self.book_list = []\n self.total = 0\n self.save = 0\n\n def total_price(self):\n ele = 0\n for i in self.book_list:\n ele ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class CustomRegistrationBackend(object): <|reserved_special_token_0|> def activate(self, request, activation_key): activated = RegistrationProfile.objects.activate_user(activation_key) if activated: signals.user_activated.send(sender=self.__class__, us...
flexible
{ "blob_id": "201279c0cba2d52b6863204bfadb6291a0065f60", "index": 3961, "step-1": "<mask token>\n\n\nclass CustomRegistrationBackend(object):\n <mask token>\n\n def activate(self, request, activation_key):\n activated = RegistrationProfile.objects.activate_user(activation_key)\n if activated:\...
[ 5, 6, 7, 8, 9 ]
a = 1 b = a print(a) print(b) a = 2 print(a) print(b) # 全部大写字符代表常量 USER_NAME = "常量" print(USER_NAME) print(USER_NAME)
normal
{ "blob_id": "1cc9a7bbe1bda06ce76fa8ec1cdc17c7b2fde73b", "index": 4051, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(USER_NAME)\nprint(USER_NAME)\n", "step-3": "a = 1\nb = a\nprint(a)\nprint(b)\na = 2\nprint(a)\nprint(b)\nUSER_N...
[ 0, 1, 2, 3 ]
from flask_wtf import FlaskForm from wtforms import ( StringField, TextAreaField, PasswordField, HiddenField) from wtforms.fields.html5 import URLField, EmailField from flask_wtf.file import FileField from wtforms.validators import ( InputRequired, Length, Email, Optional, URL, ValidationError, Regexp) from...
normal
{ "blob_id": "47b2857ac20e46897cc1f64371868ce5174799d6", "index": 4790, "step-1": "<mask token>\n\n\nclass AddReportForm(ReportBaseForm):\n \"\"\"Form for adding new report.\"\"\"\n pass\n\n\nclass EditReportForm(ReportBaseForm):\n \"\"\"Form for editing a report.\"\"\"\n cleared_file = HiddenField('c...
[ 5, 14, 20, 22, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def pop(i): loc = i sentencesTrial = [] File = open('words.txt') lines = File.read() sentences = nltk.sent_tokenize(lines) locations = ['Castle', 'Beach', 'Beach', 'Ghost Town', 'Ghost Town', 'Hau...
flexible
{ "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 ]
try: fh = open("testfile","w") fh.write("test") except IOError: print("Error:没有找到文件") else: print("sucess") fh.close()
normal
{ "blob_id": "15e0b396a4726f98ce5ae2620338d7d48985707e", "index": 9533, "step-1": "<mask token>\n", "step-2": "try:\n fh = open('testfile', 'w')\n fh.write('test')\nexcept IOError:\n print('Error:没有找到文件')\nelse:\n print('sucess')\n fh.close()\n", "step-3": "try:\r\n\tfh = open(\"testfile\",\"w\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class BaseProperty(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def set(self, obj, value): """Set property value on object. :param obj: Item :type obj: byte.model.Model :param value: Value :type value: any ...
flexible
{ "blob_id": "382f7119beba81087c497baf170eb6814c26c03e", "index": 5458, "step-1": "<mask token>\n\n\nclass BaseProperty(object):\n <mask token>\n <mask token>\n\n def set(self, obj, value):\n \"\"\"Set property value on object.\n\n :param obj: Item\n :type obj: byte.model.Model\n\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def base_model(): input_shape = 1, HM_SLICES, IMG_PX_SIZE, IMG_PX_SIZE inputs = Input(shape=input_shape) conv1 = Convolution3D(32, 5, 5, 5, activation='relu')(inputs) drop1 = Dropout(0.2)(conv1) conv2 = Convolution3D(32, 5, 5, 5, activation='relu')(drop1) pool1 = M...
flexible
{ "blob_id": "e3d886dedaf5b120392d0dc81c4c71398f08f8d6", "index": 8234, "step-1": "<mask token>\n\n\ndef base_model():\n input_shape = 1, HM_SLICES, IMG_PX_SIZE, IMG_PX_SIZE\n inputs = Input(shape=input_shape)\n conv1 = Convolution3D(32, 5, 5, 5, activation='relu')(inputs)\n drop1 = Dropout(0.2)(conv1...
[ 1, 2, 3, 4, 5 ]
from conans import ConanFile, CMake, tools import os class Demo(ConanFile): name = "Demo" version = "0.1" license = "<Put the package license here>" url = "<Package recipe repository url here, for issues about the package>" description = "<Description of Testlib here>" settings = "os", "compile...
normal
{ "blob_id": "c9bc331f4805a956146619c59d183fc3bcbe47cb", "index": 9728, "step-1": "<mask token>\n\n\nclass Demo(ConanFile):\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 <mask...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> class Car: <|reserved_special_token_0|> def activate(self): self.deactivate() self.pi.write(self.STBY, 1) <|reserved_special_token_0|> def setDrive(self, direction, dutycycle=100): dc = int(255.0 / 100.0 * dutycycle) if direction == 1: ...
flexible
{ "blob_id": "5b9f1b3ca4b50a4e9e8bd6715e73c62b4f778929", "index": 1594, "step-1": "<mask token>\n\n\nclass Car:\n <mask token>\n\n def activate(self):\n self.deactivate()\n self.pi.write(self.STBY, 1)\n <mask token>\n\n def setDrive(self, direction, dutycycle=100):\n dc = int(255....
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for month in months: print('The next month is:\t' + month) print('\n') print(""" End of program """) <|reserved_special_token_1|> months = ['january', 'fabruary', 'march', 'april', 'may', 'june', 'july', 'august', '...
flexible
{ "blob_id": "bc8bc5c3b6954302d005fe618827c644f93ad14e", "index": 6030, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor month in months:\n print('The next month is:\\t' + month)\n print('\\n')\nprint(\"\"\"\nEnd of program\n\"\"\")\n", "step-3": "months = ['january', 'fabruary', 'march', 'april...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def factorial(n): """returns n!""" return 1 if n < 2 else n * factorial(n - 1) <|reserved_special_token_0|> <|reserved_special_token_1|> def factorial(n): """returns n!""" return 1 if n < 2 else n * factorial(n - 1) <|reserved_special_t...
flexible
{ "blob_id": "4411c81351ac76d72512faaa6b498cd577815691", "index": 2572, "step-1": "<mask token>\n", "step-2": "def factorial(n):\n \"\"\"returns n!\"\"\"\n return 1 if n < 2 else n * factorial(n - 1)\n\n\n<mask token>\n", "step-3": "def factorial(n):\n \"\"\"returns n!\"\"\"\n return 1 if n < 2 el...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Test(unittest.TestCase): def setUp(self): """Before each test, set up a blank database""" self.app = create_app('configmodule.TestingConfig') self.app.testing = True self.client = self.app.test_client() with self.app.app_context(): ...
flexible
{ "blob_id": "56b4262e88793be366d8ffe0fe4427fdb2a99bd7", "index": 7447, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n\n def setUp(self):\n \"\"\"Before each test, set up a blank database\"\"\"\n self.app = create_app('configmodule.TestingConfig')\n self.app.testing = True\n...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- """ Created on Fri Jul 13 14:52:03 2018 @author: mayn """ import matplotlib.pyplot as plt import DNA_Object import json def draw_area(dna, room): area_center, area = DNA_Object.get_room_area(room) plt.plot(area['x'], area['y'], linewidth='0.5', color='k',) plt.xlim((-15000, 20000...
normal
{ "blob_id": "089bdd6d68a69aff6f3c11f7f5ffb75aed73cd24", "index": 131, "step-1": "<mask token>\n\n\ndef draw_area(dna, room):\n area_center, area = DNA_Object.get_room_area(room)\n plt.plot(area['x'], area['y'], linewidth='0.5', color='k')\n plt.xlim((-15000, 20000))\n plt.ylim((-15000, 20000))\n t...
[ 7, 9, 11, 12, 13 ]
# -*- coding: utf-8 -*- """ Editor de Spyder Este es un archivo temporal. """ def largo (l, n): i=0 cuenta=1 valor1=0 valor2=0 while cuenta < n+1 or cuenta==n+1: a=l[i] b=l[i+1] if a==b: cuenta+= 1 valor1=a i+=1 cuenta=1 while cuenta ...
normal
{ "blob_id": "f3b697e20f60e51d80d655ddf4809aa9afdfcd69", "index": 7495, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef largo(l, n):\n i = 0\n cuenta = 1\n valor1 = 0\n valor2 = 0\n while cuenta < n + 1 or cuenta == n + 1:\n a = l[i]\n b = l[i + 1]\n if a == b:\n...
[ 0, 1, 2, 3, 4 ]
from django.urls import path,include from . import views urlpatterns = [ path('register_curier/',views.curier_register,name="register_curier"), path('private_сurier/',views.private_сurier,name="private_сurier"), path('private_сurier2/',views.private_сurier2,name="private_сurier2"), path('private_curier...
normal
{ "blob_id": "c1a83c9551e83e395a365210a99330fee7877dff", "index": 6881, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('register_curier/', views.curier_register, name=\n 'register_curier'), path('private_сurier/', views.private_сurier, name=\n 'private_сurier'), path('private_сur...
[ 0, 1, 2, 3 ]
#coding:utf-8 #base string opeate #rstrip()删除字符串末尾被指定的字符,默认是空格,如末尾有多个相同的字符,则一并删除 str1="djcc" str2="adcd" print("this's rstrip() function---------") print(str1.rstrip("c")) print(str1.rstrip("d")) #replace()用新字符替换字符串中被指定的字符,str.replace(old, new[, max]),max表示替换多少个,如不指定,全部替换 str3="this is history,it is not fake" prin...
normal
{ "blob_id": "59170e6b0b0705b9908ed1c32bbea87373126594", "index": 9484, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"this's rstrip() function---------\")\nprint(str1.rstrip('c'))\nprint(str1.rstrip('d'))\n<mask token>\nprint(\"this's replace function----------\")\nprint(str3.replace('is', 'was')...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def send_msg(): global nameofcontact, msg css_path = 'span[title="' + nameofcontact + '"]' nameofcontact = driver.find_element_by_css_selector(css_path) nameofcontact.click() chatbox = driver.find_element_by_xpath( '//*[@id="main"]/footer/div[1]/div/div/div[2]/...
flexible
{ "blob_id": "1811c0c5aca9d209638e2221cad2c30e80ee5199", "index": 3116, "step-1": "<mask token>\n\n\ndef send_msg():\n global nameofcontact, msg\n css_path = 'span[title=\"' + nameofcontact + '\"]'\n nameofcontact = driver.find_element_by_css_selector(css_path)\n nameofcontact.click()\n chatbox = d...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def set_seed(n): global seed, py_rng, np_rng, t_rng seed = n py_rng = Random(seed) np_rng = np.random.RandomState(seed) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "9a183b1f81681b3dec1132a27b17e389438ab725", "index": 6045, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef set_seed(n):\n global seed, py_rng, np_rng, t_rng\n seed = n\n py_rng = Random(seed)\n np_rng = np.random.RandomState(seed)\n\n\n<mask token>\n", "step-3": "<mask to...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PileMosaic: def __init__(self): self.width, self.height = 2380, 2800 self.filename = 'pile_mosaic.png' self.crema = 240, 233, 227 self.choco = 89, 62, 53 self.luna = 43, 97, 123 self.latte = 195, 175, 148 self.piscina = 17...
flexible
{ "blob_id": "a484272ace089008e27f4e00d2e641118432665e", "index": 4592, "step-1": "<mask token>\n\n\nclass PileMosaic:\n\n def __init__(self):\n self.width, self.height = 2380, 2800\n self.filename = 'pile_mosaic.png'\n self.crema = 240, 233, 227\n self.choco = 89, 62, 53\n s...
[ 7, 8, 12, 13, 14 ]
<|reserved_special_token_0|> def leftEncoderCallback(answer): global leftSteps leftSteps = leftSteps + 1 global leftDistance leftDistance = leftDistance + 0.24 print('Left Encoder.') def rightEncoderCallback(answer): global rightSteps rightSteps = rightSteps + 1 global rightDistance ...
flexible
{ "blob_id": "53841ba56589955e09b03018af1d0ae79b3756c4", "index": 5595, "step-1": "<mask token>\n\n\ndef leftEncoderCallback(answer):\n global leftSteps\n leftSteps = leftSteps + 1\n global leftDistance\n leftDistance = leftDistance + 0.24\n print('Left Encoder.')\n\n\ndef rightEncoderCallback(answ...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class BaseLoader(metaclass=abc.ABCMeta): @property def plugin_class(self): raise NotImplementedError() <|reserved_special_token_0|> @abc.abstractmethod def get_options(self): """Return the list of parameters associated with the auth plugin. T...
flexible
{ "blob_id": "53127de883fb5da3214d13904664566269becba6", "index": 3570, "step-1": "<mask token>\n\n\nclass BaseLoader(metaclass=abc.ABCMeta):\n\n @property\n def plugin_class(self):\n raise NotImplementedError()\n <mask token>\n\n @abc.abstractmethod\n def get_options(self):\n \"\"\"R...
[ 4, 11, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('C:/users/vinhe/code/projects/golf/golf_stats.csv', 'r') as file_obj: content = file_obj.read() client.import_csv(spreadsheet.id, data=content) <|reserved_special_token_1|> <|reserved_special_token_0|> scope =...
flexible
{ "blob_id": "ac2edcd6ea71ebdc5b1df5fd4211632b5d8e2704", "index": 3019, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('C:/users/vinhe/code/projects/golf/golf_stats.csv', 'r') as file_obj:\n content = file_obj.read()\n client.import_csv(spreadsheet.id, data=content)\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .authenticators import CookieAuthenticator, HeaderAuthenticator from .paginators import LimitOffsetPaginator, PageNumberPaginator from .views import * <|reserved_special_token_1|> from .authenticators import CookieAuthenticator, HeaderAuthenticator fr...
flexible
{ "blob_id": "dab53d10958b36cf75ab53bf30f744b1ed8a09b6", "index": 6475, "step-1": "<mask token>\n", "step-2": "from .authenticators import CookieAuthenticator, HeaderAuthenticator\nfrom .paginators import LimitOffsetPaginator, PageNumberPaginator\nfrom .views import *\n", "step-3": "from .authenticators impor...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if n1 <= n2 and n2 <= n3: print(f'A ordem crescente é {n1}, {n2}, {n3}') elif n1 <= n3 and n3 <= n2: print(f'A ordem crescente é {n1}, {n3}, {n2}') elif n2 <= n1 and n1 <= n3: print(f'A ordem crescente é {n2}, {n1}, {n...
flexible
{ "blob_id": "09712a397ad7915d9865b4aebf16606f85988f67", "index": 2737, "step-1": "<mask token>\n", "step-2": "<mask token>\nif n1 <= n2 and n2 <= n3:\n print(f'A ordem crescente é {n1}, {n2}, {n3}')\nelif n1 <= n3 and n3 <= n2:\n print(f'A ordem crescente é {n1}, {n3}, {n2}')\nelif n2 <= n1 and n1 <= n3:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Ratio_Execution_Time: <|reserved_special_token_0|> <|reserved_special_token_0|> def calculatePercentage(self, B, total, strr): E = {} for i in B: s = '' for j in range(i[0], i[1] + 1): s += '<p>' + strr[j] + '</p>'...
flexible
{ "blob_id": "150603004a4b194a7c08f1f23e37c613aa3b883a", "index": 6431, "step-1": "<mask token>\n\n\nclass Ratio_Execution_Time:\n <mask token>\n <mask token>\n\n def calculatePercentage(self, B, total, strr):\n E = {}\n for i in B:\n s = ''\n for j in range(i[0], i[1]...
[ 3, 5, 7, 8, 10 ]
<|reserved_special_token_0|> def db_create(): cur.execute( """ create table if not exists Offshores_asset ( id INTEGER PRIMARY KEY AUTO_INCREMENT, asset_name VARCHAR(100), asset_link VARCHAR(200), slug ...
flexible
{ "blob_id": "3240310653930662dcc4d79646b1a75c2994cda7", "index": 9063, "step-1": "<mask token>\n\n\ndef db_create():\n cur.execute(\n \"\"\"\n create table if not exists Offshores_asset (\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\n asset_name VARCHA...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def presses(phrase): keyboard = ['1', 'ABC2', 'DEF3', 'GHI4', 'JKL5', 'MNO6', 'PQRS7', 'TUV8', 'WXYZ9', '*', ' 0', '#'] amount = 0 for lttr in phrase.upper(): for key in keyboard: try: i = key.index(lttr...
flexible
{ "blob_id": "c2e9a93861080be616b6d833a9343f1a2f018a0b", "index": 5039, "step-1": "<mask token>\n", "step-2": "def presses(phrase):\n keyboard = ['1', 'ABC2', 'DEF3', 'GHI4', 'JKL5', 'MNO6', 'PQRS7',\n 'TUV8', 'WXYZ9', '*', ' 0', '#']\n amount = 0\n for lttr in phrase.upper():\n for key i...
[ 0, 1 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Implements the webservice calls of the command like rest apis or other network related methods """
normal
{ "blob_id": "48369e1ed826a9a50c0fd9f63b7cc10b8225ce2b", "index": 8760, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\nImplements the webservice calls of the command\nlike rest apis or other network related methods\n\"\"\"", "step-3": null, "step-4": null, ...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('x_train_data shape:', x_train_data.shape) print(x_train_data.shape[0], 'train samples') print(x_test_data.shape[0], 'test samples') print(x_train_data[0]) <|reserved_special_token_0|> print(y_train_data[i]) plt.title('Train...
flexible
{ "blob_id": "b4eb62413fb8069d8f11c34fbfecc742cd79bdb8", "index": 7057, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('x_train_data shape:', x_train_data.shape)\nprint(x_train_data.shape[0], 'train samples')\nprint(x_test_data.shape[0], 'test samples')\nprint(x_train_data[0])\n<mask token>\nprint(y...
[ 0, 1, 2, 3, 4 ]
include_rules = [ "+apps", "+components/live_caption", "+services/device/public", "+components/device_reauth", # Enable remote assistance on Chrome OS "+remoting/host", ] specific_include_rules = { ".*test.*": [ "+chrome/browser/ui/views/frame", "+components/captive_portal", "+components/web...
normal
{ "blob_id": "728af8b07bc391b496709e54926f3f1f49897176", "index": 1992, "step-1": "<mask token>\n", "step-2": "include_rules = ['+apps', '+components/live_caption',\n '+services/device/public', '+components/device_reauth', '+remoting/host']\nspecific_include_rules = {'.*test.*': ['+chrome/browser/ui/views/fr...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-10 11:06 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('album', '0013_auto_20160210_1609'), ] operations = [ migrations.CreateModel(...
normal
{ "blob_id": "a727502063bd0cd959fdde201832d37b29b4db70", "index": 4304, "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 = [('album', '00...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2.3 on 2021-07-24 12:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('profiles', '0018_userprofile_membership_fee_pending'), ] operations = [ migrations.RenameField( model_name='userprofile', ol...
normal
{ "blob_id": "464980a2f17aeedfa08548d6c4e247f8c047e2cb", "index": 5743, "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 = [('profiles', ...
[ 0, 1, 2, 3, 4 ]
""" Contain meta-data related functions: * accessing integration schema: fields, values, constraints on inputs/queries * tracking fields available * tracking known (input field) values """ # coding=utf-8 __author__ = 'vidma'
normal
{ "blob_id": "abdedad2c2b42b54cdba0e61e095ba3df0783b81", "index": 1172, "step-1": "<mask token>\n", "step-2": "<mask token>\n__author__ = 'vidma'\n", "step-3": "\"\"\"\nContain meta-data related functions:\n\n* accessing integration schema: fields, values, constraints on inputs/queries\n* tracking fields avai...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Hypergraph: <|reserved_special_token_0|> def __init__(self): self.nodes = dict() self.hypernodes = dict() self.adj_out = dict() self.adj_in = dict() <|reserved_special_token_0|> def add_hypernode(self, name: Hashable, nodes: Collecti...
flexible
{ "blob_id": "4a3611ecd70d80575f9f68bf45d67532a17b9c93", "index": 7527, "step-1": "<mask token>\n\n\nclass Hypergraph:\n <mask token>\n\n def __init__(self):\n self.nodes = dict()\n self.hypernodes = dict()\n self.adj_out = dict()\n self.adj_in = dict()\n <mask token>\n\n d...
[ 8, 10, 15, 16, 20 ]
# -*- coding: utf-8 -*- """ This file is part of pyCMBS. (c) 2012- Alexander Loew For COPYING and LICENSE details, please refer to the LICENSE file """ import unittest from pycmbs import data4D class TestPycmbsData4D(unittest.TestCase): def setUp(self): pass def test_DummyTest(self): pass i...
normal
{ "blob_id": "87562ce2a957de3fa2eb84cbb0de18c6ce264c6b", "index": 7676, "step-1": "<mask token>\n\n\nclass TestPycmbsData4D(unittest.TestCase):\n\n def setUp(self):\n pass\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestPycmbsData4D(unittest.TestCase):\n\n def setUp(s...
[ 2, 3, 4, 5, 6 ]
def adder(x, y): return x + y adder('one', 'two') adder([3, 4], [9, 0, 33]) adder(4.3, 3.5)
normal
{ "blob_id": "1ee5139cb1613977f1c85619404b3dcc6e996382", "index": 5364, "step-1": "<mask token>\n", "step-2": "def adder(x, y):\n return x + y\n\n\n<mask token>\n", "step-3": "def adder(x, y):\n return x + y\n\n\nadder('one', 'two')\nadder([3, 4], [9, 0, 33])\nadder(4.3, 3.5)\n", "step-4": null, "st...
[ 0, 1, 2 ]
# -*- coding:utf-8 -*- """ Author:xufei Date:2021/1/21 """
normal
{ "blob_id": "d39e3a552a7c558d3f5b410e0b228fb7409d732a", "index": 928, "step-1": "<mask token>\n", "step-2": "# -*- coding:utf-8 -*-\n\"\"\"\nAuthor:xufei\nDate:2021/1/21\n\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from pypc.a_primitives.nand import nand # nand gates used: 5 def half_adder(a: bool, b: bool) -> (bool, bool): """Returns a + b in the form of a tuple of two bools representing the two bits.""" nand_a_b = nand(a, b) nand_c = nand(nand_a_b, a) nand_d = nand(nand_a_b, b) high = nand(na...
normal
{ "blob_id": "66f6639ae62fe8c0b42171cf3e3fb450d8eee2b2", "index": 7671, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef full_adder(a: bool, b: bool, c: bool) ->(bool, bool):\n \"\"\"Returns a + b + c in the form of a tuple of two bools representing the two\n bits.\n \n Carried value is ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @ex.automain def main(json_path, database, _log): database_config = database database = pt.configurable.config_to_instance(database) database_dict = {'datasets': {dataset_name: dict(tqdm(database. get_dataset(dataset_name).items(), desc=dataset_name)) for datas...
flexible
{ "blob_id": "f39130099ccf467623d65ac328fd02538044d36a", "index": 6476, "step-1": "<mask token>\n\n\n@ex.automain\ndef main(json_path, database, _log):\n database_config = database\n database = pt.configurable.config_to_instance(database)\n database_dict = {'datasets': {dataset_name: dict(tqdm(database.\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def quick_sort(array: list) ->list: return [] <|reserved_special_token_1|> """ OBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm Quicksort first divides a large array into two smaller sub-a...
flexible
{ "blob_id": "04099c46c029af37a08b3861809da13b3cc3153b", "index": 997, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef quick_sort(array: list) ->list:\n return []\n", "step-3": "\"\"\"\nOBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm\n\nQuicksort first divides ...
[ 0, 1, 2 ]
t3 = float(input('Digite um numero: ')) print('o dobro deste numero é', t3 * 2) print('O triplo deste numero é', t3 * 3) print('E a raiz quadrada deste numero é', t3 ** (1 / 2))
normal
{ "blob_id": "005ea8a1e75447b2b1c030a645bde5d0cdc8fb53", "index": 3532, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('o dobro deste numero é', t3 * 2)\nprint('O triplo deste numero é', t3 * 3)\nprint('E a raiz quadrada deste numero é', t3 ** (1 / 2))\n", "step-3": "t3 = float(input('Digite um nu...
[ 0, 1, 2 ]
#Write a Python program to get the maximum and minimum value in a dictionary. d1={6: 10, 2: 20, 5: 30, 4: 40, 1: 50, 3: 60} print(max(d1.values())) print(min(d1.values()))
normal
{ "blob_id": "53e397068fcf88bbbce4dcc1bf1b441a2fbbee48", "index": 2261, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(max(d1.values()))\nprint(min(d1.values()))\n", "step-3": "d1 = {(6): 10, (2): 20, (5): 30, (4): 40, (1): 50, (3): 60}\nprint(max(d1.values()))\nprint(min(d1.values()))\n", "step...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html from sqlalchemy.orm.session import sessionmaker, query from FoodPandaStore.FoodPandaStore.model import * import datetime as ...
normal
{ "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|> def epoch_day(epoch_time): epoch_time = int(epoch_time) return epoch_time - epoch_time % 86400 <|reserved_special_token_0|> def add_ecb(): unix_time = Web3.toInt(epoch_day(time.time())) ECB = ECB_Processor() f = open(ecb_daily_log_path, 'a') if time.strftime('%...
flexible
{ "blob_id": "ecd5097d9d497b62b89217ee3c46506f21fc15d2", "index": 5065, "step-1": "<mask token>\n\n\ndef epoch_day(epoch_time):\n epoch_time = int(epoch_time)\n return epoch_time - epoch_time % 86400\n\n\n<mask token>\n\n\ndef add_ecb():\n unix_time = Web3.toInt(epoch_day(time.time()))\n ECB = ECB_Pro...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class CategoriesControllerTests(ControllerTestBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CategoriesControllerTests(ControllerTestBase): @classmethod def setUpClass(cls): sup...
flexible
{ "blob_id": "a4f2418e746cc43bd407b6a212de9802044351e1", "index": 3928, "step-1": "<mask token>\n\n\nclass CategoriesControllerTests(ControllerTestBase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CategoriesControllerTests(ControllerTestBase):\n\n @classmethod\n def setUpCl...
[ 1, 2, 3, 4, 5 ]
__version__ = "2.1.2" default_app_config = "channels.apps.ChannelsConfig" DEFAULT_CHANNEL_LAYER = "default"
normal
{ "blob_id": "92e414c76f4c585092a356d7d2957e91c1477c5f", "index": 5658, "step-1": "<mask token>\n", "step-2": "__version__ = '2.1.2'\ndefault_app_config = 'channels.apps.ChannelsConfig'\nDEFAULT_CHANNEL_LAYER = 'default'\n", "step-3": "__version__ = \"2.1.2\"\n\ndefault_app_config = \"channels.apps.ChannelsCo...
[ 0, 1, 2 ]
try: import RPi.GPIO as GPIO import time import numpy as np import matplotlib.pyplot as plt from os.path import dirname, join as pjoin from scipy.io import wavfile import scipy.io except ImportError: print ("Import error!") raise SystemExit try: chan_list = (26, 19, 13, 6, 5, 1...
normal
{ "blob_id": "675d564ad60870f49b88dece480d5a50a30491df", "index": 4907, "step-1": "<mask token>\n\n\ndef decToBinList(decNumber):\n if decNumber < 0 or decNumber > 255:\n raise ValueError\n return [((int(decNumber) & 1 << i) >> i) for i in range(7, -1, -1)]\n\n\n<mask token>\n", "step-2": "<mask to...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class LSTMRNN(object): def __init__(self, n_steps, input_size, output_size, cell_size, batch_size ): self.n_steps = n_steps self.input_size = input_size self.output_size = output_size self.cell_size = cell_size self.batch_size = batch_s...
flexible
{ "blob_id": "e54078f21176bbb7accb4164e7b56633b13cc693", "index": 8803, "step-1": "<mask token>\n\n\nclass LSTMRNN(object):\n\n def __init__(self, n_steps, input_size, output_size, cell_size, batch_size\n ):\n self.n_steps = n_steps\n self.input_size = input_size\n self.output_size ...
[ 8, 11, 12, 13, 14 ]
<|reserved_special_token_0|> class MediaSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Media fields = 'id', 'name', 'mimetype', 'extension', 'owner', '_links' dump_only = 'id', 'owner', '_links' include_fk = True <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "1810fee40ff8a99871ecc1d024f6794a68ee54e8", "index": 3543, "step-1": "<mask token>\n\n\nclass MediaSchema(ma.SQLAlchemyAutoSchema):\n\n\n class Meta:\n model = Media\n fields = 'id', 'name', 'mimetype', 'extension', 'owner', '_links'\n dump_only = 'id', 'owner', '_links'\n ...
[ 1, 2, 3, 4, 5 ]
from twindb_backup.copy.binlog_copy import BinlogCopy from twindb_backup.status.binlog_status import BinlogStatus def test_get_latest_backup(raw_binlog_status): instance = BinlogStatus(raw_binlog_status) assert instance.get_latest_backup() == BinlogCopy(host='master1', name= 'mysqlbin005.bin', created...
normal
{ "blob_id": "0dc556336cee9e5f41c036c6fcf6da950216693c", "index": 5910, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_get_latest_backup(raw_binlog_status):\n instance = BinlogStatus(raw_binlog_status)\n assert instance.get_latest_backup() == BinlogCopy(host='master1', name=\n 'm...
[ 0, 1, 2 ]
import tensorflow as tf import cv2 img=cv2.imread('d:\st.jpg',0) cv2.namedWindow('st',cv2.WINDOW_NORMAL)#可以调整图像窗口大小 cv2.imshow('st',img) cv2.imwrite('mes.png',img) cv2.waitKey(0) cv2.destroyAllWindows()
normal
{ "blob_id": "6b5399effe73d27eade0381f016cd7819a6e104a", "index": 2466, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.namedWindow('st', cv2.WINDOW_NORMAL)\ncv2.imshow('st', img)\ncv2.imwrite('mes.png', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('d:\\...
[ 0, 1, 2, 3, 4 ]