code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from nltk.stem.porter import PorterStemmer from nltk.stem.snowball import SnowballStemmer p_stemmer = PorterStemmer() s_stemmer = SnowballStemmer(language="english") print(s_stemmer.stem("writing"))
normal
{ "blob_id": "67e6d39ef291e4bb30c0b6bab7b71d97c86b0ef1", "index": 4108, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s_stemmer.stem('writing'))\n", "step-3": "<mask token>\np_stemmer = PorterStemmer()\ns_stemmer = SnowballStemmer(language='english')\nprint(s_stemmer.stem('writing'))\n", "step-...
[ 0, 1, 2, 3, 4 ]
from .checklist_mixin import ChecklistMixin from .citation_mixin import CitationMixin from .license_mixin import LicenseMixin from .registry_mixin import RegistryMixin from .repository_mixin import RepositoryMixin __all__ = [ "RepositoryMixin", "LicenseMixin", "RegistryMixin", "CitationMixin", "Ch...
normal
{ "blob_id": "bf8a524e54aa866c8293a93b2321335f2c7b0850", "index": 7419, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['RepositoryMixin', 'LicenseMixin', 'RegistryMixin',\n 'CitationMixin', 'ChecklistMixin']\n", "step-3": "from .checklist_mixin import ChecklistMixin\nfrom .citation_mixin i...
[ 0, 1, 2, 3 ]
#-*- coding: UTF-8 -*- import re import time import sys import command.server.handle_utility as Utility from ee.common import logger from ee.common import xavier as Xavier1 sys.path.append('/opt/seeing/app/') from b31_bp import xavier1 as Xavier2 global agv agv=sys.argv[1] Xavier=Xavier1 xavier_module = {"tcp:7801":Xa...
normal
{ "blob_id": "10e1756dc1d6c7b6b7e3569de78e9fa4cdfb0d7e", "index": 7136, "step-1": "<mask token>\n\n\ndef dac_voltage_set_handle(params):\n help_info = ('dac set(<channel>,<value>)$\\r\\n \\t channel(' +\n help_str +\n ')\\tvalue: (if ad5761: (0~10000) unit:mv,else :(0~5000) unit:mv) $\\r\\n'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def jumlah(x, y): hasil = x + y return hasil <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def jumlah(x, y): hasil = x + y return hasil print('hasil dari', x, '+'...
flexible
{ "blob_id": "d8482da6b9983d990da980c3a5edab0c49a28229", "index": 2219, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef jumlah(x, y):\n hasil = x + y\n return hasil\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef jumlah(x, y):\n hasil = x + y\n return hasil\n\n\nprint('hasil da...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import io import json import fire from collections import OrderedDict def main(input, output): vocab = OrderedDict({'</s>': 0, '<unk>': 1}) for line in io.open(input, 'r', encoding='utf-8'): word, count = line.strip().split() vocab[word] = len(vocab) with io.open(ou...
normal
{ "blob_id": "e3665141397d52877242463d548c059272d13536", "index": 863, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(input, output):\n vocab = OrderedDict({'</s>': 0, '<unk>': 1})\n for line in io.open(input, 'r', encoding='utf-8'):\n word, count = line.strip().split()\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SpectrumFit(Operation): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SpectrumFit(Operation): <|reserved_special_token_0|> def __init__(self): i...
flexible
{ "blob_id": "7b5713c9a5afa911df1c2939751de30412162f15", "index": 446, "step-1": "<mask token>\n\n\nclass SpectrumFit(Operation):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SpectrumFit(Operation):\n <mask token>\n\n def __init__(self):\n input_names...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> @contextmanager def TemporaryDirectory(): name = tempfile.mkdtemp() try: yield name finally: shutil.rmtree(name) @app.route('/safe', methods=['POST']) def safe(): f = request.files['file-form-param'] name = secure_filename(f.filename) filepath = o...
flexible
{ "blob_id": "9f6cfeff9e00079715827a2887263c14a1bb51ff", "index": 7679, "step-1": "<mask token>\n\n\n@contextmanager\ndef TemporaryDirectory():\n name = tempfile.mkdtemp()\n try:\n yield name\n finally:\n shutil.rmtree(name)\n\n\n@app.route('/safe', methods=['POST'])\ndef safe():\n f = r...
[ 5, 6, 8, 9, 10 ]
# -*- coding: utf-8 -*- from pathlib import Path from ruamel.yaml import YAML from .screen import color2sgr def _get(d, *paths): """ Query into configuration dictionary, return None on any error usag: _get(d, 'k1.2.k3.k4', 2, 'name') """ if d is None: return None if paths is None: return Non...
normal
{ "blob_id": "784159dfb2e85ca4634adf790e68129834155e4d", "index": 2702, "step-1": "<mask token>\n\n\nclass _Settings:\n <mask token>\n\n def _valueAt(self, *paths):\n u = _get(self.userConfig, *paths)\n d = _get(self.defaultConfig, *paths)\n return u, d\n\n def _loadConfigs(self):\n ...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> class OrderClient(PayPalClient): """ This is the sample function to create an order. It uses the JSON body returned by buildRequestBody() to create an order.""" def create_order(self, order_body, debug=False): request = OrdersCreateRequest() request.prefer('re...
flexible
{ "blob_id": "542bd52e3d5bc79077277034234419983005f78e", "index": 2128, "step-1": "<mask token>\n\n\nclass OrderClient(PayPalClient):\n \"\"\" This is the sample function to create an order. It uses the\n JSON body returned by buildRequestBody() to create an order.\"\"\"\n\n def create_order(self, order_...
[ 4, 5, 6, 8, 11 ]
<|reserved_special_token_0|> def authorDetail(request, author_id): author = Author.objects.filter(id=author_id).first() recipes = Recipe.objects.filter(author=author_id) return render(request, 'author_detail.html', {'recipes': recipes, 'author': author}) <|reserved_special_token_1|> <|reserved_...
flexible
{ "blob_id": "f0f8ad7b65707bcf691847ccb387e4d026b405b5", "index": 6395, "step-1": "<mask token>\n\n\ndef authorDetail(request, author_id):\n author = Author.objects.filter(id=author_id).first()\n recipes = Recipe.objects.filter(author=author_id)\n return render(request, 'author_detail.html', {'recipes': ...
[ 1, 2, 3, 4, 5 ]
import sys sys.path.append('../') from IntcodeComputer.intcode import Program if __name__ == '__main__': fn = 'input.txt' with open(fn) as f: program = Program([int(i) for i in f.readline().split(',')]) program.run() result = program.instructions
normal
{ "blob_id": "a54c8ab63c1e0f50d254d6c97ca3f167db7142e9", "index": 4956, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('../')\n<mask token>\nif __name__ == '__main__':\n fn = 'input.txt'\n with open(fn) as f:\n program = Program([int(i) for i in f.readline().split(',')])\n ...
[ 0, 1, 2 ]
#!/usr/bin/env python #_*_ coding:utf-8 _*_ ''' @author: tanglei @contact: tanglei_0315@163.com @file: index.py @time: 2017/11/1 16:26 ''' #需求: #1.每个客户端需要监控的服务不同 #2.每个服务的监控间隔不同 #3.允许模板的形式批量修改监控指标 #4.不同设备的监控阀值不同 #5.可自定义最近n分钟内hit\max\avg\last\... 指标超过阀值 #6.报警策略,报警等级,报警自动升级 #7.历史数据的存储和优化 时间越久数据越失真 #8.跨机房,跨区域代理服务器 #第三方的soc...
normal
{ "blob_id": "886101e5d86daf6c2ac0fe92b361ccca6132b1aa", "index": 3030, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python\n#_*_ coding:utf-8 _*_\n'''\n@author: tanglei\n@contact: tanglei_0315@163.com\n@file: index.py\n@time: 2017/11/1 16:26\n'''\n#需求:\n#1.每个客户端需要监控的服务不同\n#2.每个服务的监控间隔不同\n#3.允许模板的形式批量修...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ensurepip.bootstrap() try: import pip except ImportError: print( 'Error: Failed to install pip, make sure you are running this script as admin.' ) sys.exit() <|reserved_special_token_0|> print('You are ...
flexible
{ "blob_id": "b44f75db652b3a40cd9475bfe44027724e845252", "index": 1146, "step-1": "<mask token>\n", "step-2": "<mask token>\nensurepip.bootstrap()\ntry:\n import pip\nexcept ImportError:\n print(\n 'Error: Failed to install pip, make sure you are running this script as admin.'\n )\n sys.e...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def collect(yt, dir): code = yt.thumbnail_url urllib.request.urlretrieve(code, os.path.join(dir, yt.title + '.jpg')) out = yt.streams.filter(only_audio=True, file_extension='mp4').order_by( 'abr').desc().first().download(dir) def list_update(code): link = 'https:...
flexible
{ "blob_id": "06dd963b62c0a746438dcf01c67ef5de1a4c5e8f", "index": 1558, "step-1": "<mask token>\n\n\ndef collect(yt, dir):\n code = yt.thumbnail_url\n urllib.request.urlretrieve(code, os.path.join(dir, yt.title + '.jpg'))\n out = yt.streams.filter(only_audio=True, file_extension='mp4').order_by(\n ...
[ 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # @Author: Marcela Campo # @Date: 2016-05-06 18:56:47 # @Last Modified by: Marcela Campo # @Last Modified time: 2016-05-06 19:03:21 import os from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand from server import app, db app.config.from_object('confi...
normal
{ "blob_id": "d7b91b0476a1f2e00408ce1f1501bf98d4c06e4e", "index": 9540, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object('config.DevelopmentConfig')\n<mask token>\nmanager.add_command('db', MigrateCommand)\nif __name__ == '__main__':\n manager.run()\n", "step-3": "<mask token>\na...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SA360Validator(object): <|reserved_special_token_0|> def __init__(self, sa360_service: Resource=None, agency: int=None, advertiser: int=None) ->None: self.sa360_service = sa360_service self.agency = agency self.advertiser = advertiser @l...
flexible
{ "blob_id": "cce40ff190f7790ac4eca7d6cb3c032955bb4849", "index": 8288, "step-1": "<mask token>\n\n\nclass SA360Validator(object):\n <mask token>\n\n def __init__(self, sa360_service: Resource=None, agency: int=None,\n advertiser: int=None) ->None:\n self.sa360_service = sa360_service\n ...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append('/uufs/chpc.utah.edu/common/home/u0403692/prog/prism/test') <|reserved_special_token_0|> print('reading...') <|reserved_special_token_0|> print('joining...') <|reserved_special_token_0|> print('processing...') <|re...
flexible
{ "blob_id": "07b6ded9b4841bdba62d481664a399f0b125fcbf", "index": 7876, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('/uufs/chpc.utah.edu/common/home/u0403692/prog/prism/test')\n<mask token>\nprint('reading...')\n<mask token>\nprint('joining...')\n<mask token>\nprint('processing...')\n<m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pprint('-' * 78) pprint(' Running on %d cores' % comm.size) pprint('-' * 78) comm.Barrier() <|reserved_special_token_0|> if comm.rank == 0: A = np.arange(N, dtype=np.float64) else: A = np.zeros(N, dtype=np.float64) print('...
flexible
{ "blob_id": "839b3ebffebce95de25f75edc67a647bd1318268", "index": 5077, "step-1": "<mask token>\n", "step-2": "<mask token>\npprint('-' * 78)\npprint(' Running on %d cores' % comm.size)\npprint('-' * 78)\ncomm.Barrier()\n<mask token>\nif comm.rank == 0:\n A = np.arange(N, dtype=np.float64)\nelse:\n A = np...
[ 0, 1, 2, 3, 4 ]
# 多角色认证装饰器 def auth(role): from core import admin_view,student_view,teacher_view def deco(func): def wrapper(*args,**kwargs): if role == 'admin': if admin_view.admin_user == None: admin_view.login() else: res = func(...
normal
{ "blob_id": "e247ffb5b6e4319ff17d0b8ae9f67e10c282c4ff", "index": 7348, "step-1": "<mask token>\n", "step-2": "def auth(role):\n from core import admin_view, student_view, teacher_view\n\n def deco(func):\n\n def wrapper(*args, **kwargs):\n if role == 'admin':\n if admin_v...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Thu Jun 18 23:54:17 2015 @author: rein @license: MIT @version: 0.1 """ from __future__ import print_function import numpy as np import footballpy.processing.ragged_array as ra """ Ranking dictionary necessary to determine the column number of each player. The type ...
normal
{ "blob_id": "81ae5bbc8e3e712ee4f54656bc28f385a0b4a29f", "index": 6059, "step-1": "<mask token>\n\n\ndef sort_position_data(pos, type='A'):\n \"\"\"Sorts the position data according to player positions.\n\n As the final matrix should contain the player according to their\n position starting from left to ...
[ 5, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class Arrow(Sprite): def __init__(self, color, screen, character, click_position): Sprite.__init__(self) self.color = color self.screen = screen self.character = character self.click_position = click_position width, height = 2, 2 ...
flexible
{ "blob_id": "359db73de2c2bb5967723dfb78f98fb84b337b9d", "index": 343, "step-1": "<mask token>\n\n\nclass Arrow(Sprite):\n\n def __init__(self, color, screen, character, click_position):\n Sprite.__init__(self)\n self.color = color\n self.screen = screen\n self.character = character...
[ 9, 10, 11, 13, 14 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ MIT License Copyright (c) 2016 Matt Menzenski 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 ...
normal
{ "blob_id": "576bb15ad081cd368265c98875be5d032cdafd22", "index": 4789, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fuzzy_match(pattern, instring, adj_bonus=5, sep_bonus=10, camel_bonus=\n 10, lead_penalty=-3, max_lead_penalty=-9, unmatched_penalty=-1):\n \"\"\"Return match boolean and ma...
[ 0, 1, 2, 3, 4 ]
import os import platform import _winreg def gid(x): find=x winreg = _winreg REG_PATH1 = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" REG_PATH2 = r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" registry_key = winreg.OpenKey( winreg.HKEY_LOCAL_MACHINE, REG_PATH1, 0, win...
normal
{ "blob_id": "a444e215b64b3a2d7f736e38227b68c1a1b952a0", "index": 7133, "step-1": "import os\nimport platform\nimport _winreg\n\n\ndef gid(x):\n find=x\n winreg = _winreg\n REG_PATH1 = r\"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\"\n REG_PATH2 = r\"SOFTWARE\\WOW6432Node\\Microsoft\\Windo...
[ 0 ]
'''Finding Perfect Numbers 3/2/17 @author: Annalane Miller (asm9) and Ivanna Rodriguez (imr6)''' num_perfect = 0 for value in range(2, 10000): #set initial values high= value low = 1 divisors = [] #finding divisors while low < high: if value % low ==0: high = value// low ...
normal
{ "blob_id": "1f0349edd9220b663f7469b287f796e4a54df88d", "index": 6502, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor value in range(2, 10000):\n high = value\n low = 1\n divisors = []\n while low < high:\n if value % low == 0:\n high = value // low\n divisors...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui/about.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtG...
normal
{ "blob_id": "25b3defc8410c72c7c6f25288af91bd0c826f2ed", "index": 6051, "step-1": "<mask token>\n\n\nclass Ui_aboutDialog(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_aboutDialog(object):\n\n def setupUi(self, aboutDialog):\n aboutDialog.setObjectName('aboutDi...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Generate(TaskHelper): def task(self, args): return {'result': output} <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python_task_helper', 'files')) <|re...
flexible
{ "blob_id": "24813e03de05058925a42847042157fa65450d21", "index": 3773, "step-1": "<mask token>\n\n\nclass Generate(TaskHelper):\n\n def task(self, args):\n return {'result': output}\n\n\n<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.join(os.path.dirname(__file__), '..', '..',\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Retriving', url) <|reserved_special_token_0|> print('Retrived', len(data), 'characters') <|reserved_special_token_0|> print(json.dumps(js, indent=4)) print('Place id', js['results'][0]['place_id']) <|reserved_special_token_...
flexible
{ "blob_id": "d34159536e860719094a36cfc30ffb5fcae72a9a", "index": 296, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Retriving', url)\n<mask token>\nprint('Retrived', len(data), 'characters')\n<mask token>\nprint(json.dumps(js, indent=4))\nprint('Place id', js['results'][0]['place_id'])\n<mask tok...
[ 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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def numIslands(self, grid: List[List[str]]) ->int: if ...
flexible
{ "blob_id": "58bd14d240242ed58dcff35fe91cebeae4899478", "index": 9087, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def numIslands(self, grid: List[List[str]]) ->int:\n if not grid:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .clip_grad import clip_grad_norm, clip_grad_norm_, clip_grad_value_ from .convert_parameters import parameters_to_vector, vector_to_parameters from .spectral_norm import remove_spectral_norm, spectral_norm from .weight_norm import remove_weight_norm, wei...
flexible
{ "blob_id": "5d9ace3b6c5b4e24fc3b20b5e5640f2fcdb252bb", "index": 9292, "step-1": "<mask token>\n", "step-2": "from .clip_grad import clip_grad_norm, clip_grad_norm_, clip_grad_value_\nfrom .convert_parameters import parameters_to_vector, vector_to_parameters\nfrom .spectral_norm import remove_spectral_norm, sp...
[ 0, 1, 2 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import os import os.path import json from collections import defaultdict, Counter MOST_COMMON = 120000 savepath = r'D:\My Documents\My Project\experiment1\finished\test_vocabs.json' dirpath = 'D:\\My Documents\\My Project\\experiment1\\finished\\test' #dirpath = 'D:\\Corpus\...
normal
{ "blob_id": "d30e2fa4d5b0a0965dad7d69b672b8f4ad137ff4", "index": 1359, "step-1": "<mask token>\n\n\ndef get_file_vocabs(file):\n file_vocabs = Counter()\n for sent in file.readlines():\n voc = Counter()\n for word in sent.split():\n voc[word] += 1\n file_vocabs.update(voc)\n...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Submissions(Cog): <|reserved_special_token_0|> @command() async def current(self, ctx: Context) ->None: await ctx.trigger_typing() repo.init() drafts = repo.drafts() if not drafts: await ctx.send('No competition active') ...
flexible
{ "blob_id": "82bfdb46e1da96e5db91d66c3a060d8bf7747d07", "index": 2214, "step-1": "<mask token>\n\n\nclass Submissions(Cog):\n <mask token>\n\n @command()\n async def current(self, ctx: Context) ->None:\n await ctx.trigger_typing()\n repo.init()\n drafts = repo.drafts()\n if n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class RegressionTestMeta(type): class MetaNamespace(namespaces.LocalNamespace): """Custom namespace to control the cls attribute assignment. Regular Python class attributes can be overriden by either parameters or variables respecting the order of execution....
flexible
{ "blob_id": "e754a24fc9c965c50f7fa12036c884a1a54cc29d", "index": 6853, "step-1": "<mask token>\n\n\nclass RegressionTestMeta(type):\n\n\n class MetaNamespace(namespaces.LocalNamespace):\n \"\"\"Custom namespace to control the cls attribute assignment.\n\n Regular Python class attributes can be o...
[ 2, 4, 6, 8, 10 ]
# This program just for testing push from Mac. def subset2(num): mid_result = [] result = [] subset2_helper(num, mid_result, result, 0) print(result) def subset2_helper(num, mid_result, result, position): result.append(mid_result[:]) for i in range(position, len(num)): mid_result.append...
normal
{ "blob_id": "829910af55ca84838537a2e1fa697713c7a6c6ca", "index": 8400, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef subset2_helper(num, mid_result, result, position):\n result.append(mid_result[:])\n for i in range(position, len(num)):\n mid_result.append(num[i])\n subset2_h...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 2.2.6 on 2019-10-10 07:02 import datetime from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='cronjob', fields=[ ('id', m...
normal
{ "blob_id": "af523777e32c44112bd37a4b9dcbc0941f7e8236", "index": 4242, "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 ]
from typing import List class LanguageDefinition: """Language definition containing general constants and methods.""" @staticmethod def get_translated_file_name(filename: str): """ :returns: Translated file name. """ return filename @staticmethod def create_projec...
normal
{ "blob_id": "672add6aa05e21d3605c05a23ff86281ffc3b17c", "index": 9827, "step-1": "<mask token>\n\n\nclass LanguageDefinition:\n <mask token>\n <mask token>\n\n @staticmethod\n def create_project_files(project_path: str, added_file_paths: List[str]\n =None) ->str:\n \"\"\"\n Creat...
[ 6, 7, 8, 9 ]
# Author: BeiYu # Github: https://github.com/beiyuouo # Date : 2021/2/21 21:57 # Description: __author__ = "BeiYu" from utils.init_env import set_seed from utils.options import * import os import logging import torch from torch import nn from torch import optim from torch.optim.lr_scheduler import MultiStepLR from ...
normal
{ "blob_id": "75e6554ea3c327c87a2a65710a7f1d55e9933bb0", "index": 276, "step-1": "<mask token>\n\n\ndef train():\n args = get_args()\n os.makedirs(args.model_path, exist_ok=True)\n set_seed(args.seed)\n \"\"\"\n To follow this training routine you need a DataLoader that yields the tuples of the...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while ans: ans = input('Ask the magic 8 ball a question. (Press enter to leave): \n') print(random.choice(answers)) <|reserved_special_token_1|> <|reserved_special_token_0|> answers = ['It is certain', 'Without a doubt'...
flexible
{ "blob_id": "b5e9af166f3b55e44d9273077e5acd05b1fd68fa", "index": 2335, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile ans:\n ans = input('Ask the magic 8 ball a question. (Press enter to leave): \\n')\n print(random.choice(answers))\n", "step-3": "<mask token>\nanswers = ['It is certain', '...
[ 0, 1, 2, 3, 4 ]
a = ord(input().rstrip()) if a < 97: print('A') else: print('a') ''' ord(A)=65 ord(Z)=90 ord(a)=97 ord(z)=122 '''
normal
{ "blob_id": "e7c454b2bf6cf324e1e318e374e07a83812c978b", "index": 2381, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n", "step-3": "a = ord(input().rstrip())\nif a < 97:\n print('A')\nelse:\n print('a')\n<mask token>\n", "step-4":...
[ 0, 1, 2, 3 ]
from gevent.event import Event from gevent.queue import Queue from ping_pong_chat.aio_queue import AGQueue received_event = Event() leave_rooms_event = Event() exit_event = Event() output_message_queue = AGQueue() input_message_queue = AGQueue() matrix_to_aio_queue = AGQueue() aio_to_matrix_queue = AGQueue() sync_to_...
normal
{ "blob_id": "af1a6c6009b21962228fbe737f27c22bf9460762", "index": 729, "step-1": "<mask token>\n", "step-2": "<mask token>\nreceived_event = Event()\nleave_rooms_event = Event()\nexit_event = Event()\noutput_message_queue = AGQueue()\ninput_message_queue = AGQueue()\nmatrix_to_aio_queue = AGQueue()\naio_to_matr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class WebInformationModel(BasicModel): class Meta: label_name = {'title': u'通用名稱', 'name': u'識別碼', 'domain_registration': u'網域註冊地', 'domain_registration_price': u'網域註冊費用', 'domain_registration_date': u'網域註冊日', 'domain_expiration_date': u'網...
flexible
{ "blob_id": "3d55a5b4e332523025f65e5f5859f4633f4ee9a3", "index": 7501, "step-1": "<mask token>\n\n\nclass WebInformationModel(BasicModel):\n\n\n class Meta:\n label_name = {'title': u'通用名稱', 'name': u'識別碼',\n 'domain_registration': u'網域註冊地', 'domain_registration_price':\n u'網域註冊費用...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while m < t: n = int(input()) arr = list(map(int, input().strip().split(' '))) s = int(input()) hash_map = {} curr_sum = 0 count = 0 for i in range(len(arr)): curr_sum += arr[i] if curr_...
flexible
{ "blob_id": "3ac69068db94f45bc44a8295a10603126d004b34", "index": 6219, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile m < t:\n n = int(input())\n arr = list(map(int, input().strip().split(' ')))\n s = int(input())\n hash_map = {}\n curr_sum = 0\n count = 0\n for i in range(len(...
[ 0, 1, 2, 3 ]
from classNinapro import Ninapro import numpy as np import tensorflow as tf print(tf.__version__) Debug = True # for tensor dimensionality checking ninapro = Ninapro() ninapro.splitImagesLabels() # Train print('ninapro.TrainImages shape: ', ninapro.TrainImages.shape) # m x 16 x 30 print('ninapro.TrainLabels shape...
normal
{ "blob_id": "30aa8405ccf64ce8a05204f3f9fa2ffab436ad3b", "index": 1578, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(tf.__version__)\n<mask token>\nninapro.splitImagesLabels()\nprint('ninapro.TrainImages shape: ', ninapro.TrainImages.shape)\nprint('ninapro.TrainLabels shape: ', ninapro.TrainLabels...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): app = MultiValueDictApp() print('Welcome to Multivalue Dictionary App') print('COMMANDS and format:') print('KEYS') print('MEMBERS key') print('ADD key value') print('REMOVE key value') ...
flexible
{ "blob_id": "21e83369c4100c41885e9ee8a8d7310556bfe51d", "index": 7271, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n app = MultiValueDictApp()\n print('Welcome to Multivalue Dictionary App')\n print('COMMANDS and format:')\n print('KEYS')\n print('MEMBERS key')\n prin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TwoSum: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TwoSum: def __init__(self): """ Initialize your data structure here. """ ...
flexible
{ "blob_id": "025c740813f7eea37abadaa14ffe0d8c1bedc79d", "index": 6275, "step-1": "<mask token>\n\n\nclass TwoSum:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TwoSum:\n\n def __init__(self):\n \"\"\"\n Initialize your data structure here.\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pc.verifyParameters() <|reserved_special_token_0|> tour.Description(IG.Tour.TEXT, kube_description) tour.Instructions(IG.Tour.MARKDOWN, kube_instruction) rspec.addTour(tour) pc.printRequestRSpec(rspec) <|reserved_special_token_1...
flexible
{ "blob_id": "ff7a865822a4f8b343ab4cb490c24d6d530b14e1", "index": 934, "step-1": "<mask token>\n", "step-2": "<mask token>\npc.verifyParameters()\n<mask token>\ntour.Description(IG.Tour.TEXT, kube_description)\ntour.Instructions(IG.Tour.MARKDOWN, kube_instruction)\nrspec.addTour(tour)\npc.printRequestRSpec(rspe...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def complimentDNA(text): result = '' for letter in text: result = result + mapDNA[letter] return result[::-1] def patternFind(text, pattern): index = [] for i in range(0, len(text) - len(pattern)): word = text[i:i + len(pattern)] if word == pa...
flexible
{ "blob_id": "29c1a989365408bf5c3d6196f7afc969be63df85", "index": 5942, "step-1": "<mask token>\n\n\ndef complimentDNA(text):\n result = ''\n for letter in text:\n result = result + mapDNA[letter]\n return result[::-1]\n\n\ndef patternFind(text, pattern):\n index = []\n for i in range(0, len...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'): handle_of_hearthstone = win32gui.FindWindow(lpClassName, lpWindowName) return win32gui.GetClientRect(handle_of_hearthstone) def countdown(n): for i in np.arange(n, 0, -1): print(i) time.sleep(1...
flexible
{ "blob_id": "e36d2426fb8a268ab9ff4f3d6135aa72697e6326", "index": 1505, "step-1": "<mask token>\n\n\ndef get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'):\n handle_of_hearthstone = win32gui.FindWindow(lpClassName, lpWindowName)\n return win32gui.GetClientRect(handle_of_hearthstone)\n\n\ndef coun...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .__main__ import datajson_write, datajson_read
flexible
{ "blob_id": "2269e74c006833976c3a28cd52c238e2dde20051", "index": 5871, "step-1": "<mask token>\n", "step-2": "from .__main__ import datajson_write, datajson_read\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', hindex, name='HINDEX'), path('galeria/', galeria, name='GALE'), path('mision/', mision_vision, name='MISION'), path( 'direccion/', direccion, name='UBICACION'), path('registro/', registro, name=...
flexible
{ "blob_id": "dff5a46c6f1eb715fe5e1eec87e42ceb295b0eae", "index": 4650, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', hindex, name='HINDEX'), path('galeria/', galeria,\n name='GALE'), path('mision/', mision_vision, name='MISION'), path(\n 'direccion/', direccion, name='UBICA...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Bar(models.Model): b = models.CharField(max_length=10) a = models.ForeignKey(Foo, related_name='bars', on_delete=models.CASCADE) class DTModel(models.Model): name = models.CharField(max_length=32) start_datetime = models.DateTimeField(null=True, blank=True) end...
flexible
{ "blob_id": "d6cfe7132855d832d8fd1ea9ca9760bd22109a92", "index": 1893, "step-1": "<mask token>\n\n\nclass Bar(models.Model):\n b = models.CharField(max_length=10)\n a = models.ForeignKey(Foo, related_name='bars', on_delete=models.CASCADE)\n\n\nclass DTModel(models.Model):\n name = models.CharField(max_l...
[ 5, 6, 8, 10, 13 ]
<|reserved_special_token_0|> def divider(fn): def wrap(*args): odd = sum(i for i in args if i % 2 != 0) even = sum(i for i in args if i % 2 == 0) return fn(odd, even) return wrap @divider def mysum(x, y): return x + y <|reserved_special_token_0|> @divider def mypow(x, y): ...
flexible
{ "blob_id": "253804644e366382a730775402768bc307944a19", "index": 6548, "step-1": "<mask token>\n\n\ndef divider(fn):\n\n def wrap(*args):\n odd = sum(i for i in args if i % 2 != 0)\n even = sum(i for i in args if i % 2 == 0)\n return fn(odd, even)\n return wrap\n\n\n@divider\ndef mysum...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'group' urlpatterns = [path('group/', views.CreateGroup.as_view(), name= 'group_create'), path('shift/', views.CreateShift.as_view(), name= 'shift_create'), path('subject/', views.createSubject.as_view(), name= ...
flexible
{ "blob_id": "0b7e858eb6d4a5f3cf6aca4fea994dae9f889caa", "index": 4781, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'group'\nurlpatterns = [path('group/', views.CreateGroup.as_view(), name=\n 'group_create'), path('shift/', views.CreateShift.as_view(), name=\n 'shift_create'), path('su...
[ 0, 1, 2, 3 ]
from queuingservices.managers.queue_lifecycle_manager import QueueLifecycleManager from queuingservices.managers.queue_publisher_manager import QueuePublisherManager from queuingservices.managers.queue_subscriber_manager import QueueSubscriberManager class QueueMaster(QueueSubscriberManager, QueuePublisherManager, ...
normal
{ "blob_id": "b2b961c6ff1d975d80a84be361321ab44dc026a0", "index": 2134, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass QueueMaster(QueueSubscriberManager, QueuePublisherManager,\n QueueLifecycleManager):\n <mask token>\n pass\n", "step-3": "<mask token>\n\n\nclass QueueMaster(QueueSub...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def setup_logging(default_path='common/config/logging.yaml'): path = default_path if os.path.exists(path): with open(path, 'rt') as f: config = yaml.safe_load(f.read()) logging.config.dict...
flexible
{ "blob_id": "6657f0b51bc021e6b5867bbdd1a520c2b0cb92b3", "index": 2367, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef setup_logging(default_path='common/config/logging.yaml'):\n path = default_path\n if os.path.exists(path):\n with open(path, 'rt') as f:\n config = yaml.sa...
[ 0, 1, 2, 3 ]
import math def sexpr_key(s_expr): return s_expr.strip('(').split(' ')[0] def expr_key(expr): return expr.split(' ')[0] def expr_data(expr): return expr.split(' ')[1:] def list_key(_list): if type(_list) is type(list()): return _list[0] else: return expr_key(_list) def ...
normal
{ "blob_id": "18789b5106d4be8a02197b165e16a74c08a58c66", "index": 8578, "step-1": "<mask token>\n\n\ndef sexpr_key(s_expr):\n return s_expr.strip('(').split(' ')[0]\n\n\n<mask token>\n\n\ndef list_data(_list):\n if type(_list) is type(list()):\n return _list[1]\n else:\n temp = expr_data(_l...
[ 3, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def File_Open_EventC(): FilePath = filedialog.askopenfilename(filetypes=(('C file', '*.c*'), ( 'Text file', '*.txt*'), ('HTML files', '*.html;*.htm'))) fp = open(FilePath, 'r') flag_1 = 0 slash_char = '/' slash_flag = 0 slash_char2 = '/' slash_flag2 = 0...
flexible
{ "blob_id": "6c0ca72d7f5d2373a50cd344991ad9f9e3046e8d", "index": 4087, "step-1": "<mask token>\n\n\ndef File_Open_EventC():\n FilePath = filedialog.askopenfilename(filetypes=(('C file', '*.c*'), (\n 'Text file', '*.txt*'), ('HTML files', '*.html;*.htm')))\n fp = open(FilePath, 'r')\n flag_1 = 0\n...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 24 22:05:12 2019 @author: admin """ for index in range(test_set.shape[0]): print(index)
normal
{ "blob_id": "35647ed5e2c128a5bf819a1e47ead7e958172b1c", "index": 9711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor index in range(test_set.shape[0]):\n print(index)\n", "step-3": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Apr 24 22:05:12 2019\n\n@author: admin\n\...
[ 0, 1, 2 ]
import numpy as np import matplotlib.pyplot as plt x_list = [] y_list = [] file1 = open("pos_data_x.txt", "r") for line in file1: #x_list.append(float(file1.readline(line))) x_list.append(float(line)) file2 = open("pos_data_y.txt", "r") for line in file2: #y_list.append(float(file1.readline(line))) y_list.ap...
normal
{ "blob_id": "d869aa32cb9793ce11a5b6a782cc66c2dd0be309", "index": 6176, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in file1:\n x_list.append(float(line))\n<mask token>\nfor line in file2:\n y_list.append(float(line))\nfile2.close\nfile1.close\n<mask token>\nplt.plot(x_list, y_list, labe...
[ 0, 1, 2, 3, 4 ]
class Book: """Class that defines book model.""" def __init__(self, title, authors, pub_year): self.title = title self.authors = authors self.pub_year = pub_year
normal
{ "blob_id": "14345a8c4e20d84dfc87476d890f59530a8f4d96", "index": 7237, "step-1": "<mask token>\n", "step-2": "class Book:\n <mask token>\n <mask token>\n", "step-3": "class Book:\n <mask token>\n\n def __init__(self, title, authors, pub_year):\n self.title = title\n self.authors = a...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'filter': false, 'title': 'settings.py', 'tooltip': '/mysite/settings.py', 'undoManager': {'mark': 53, 'position': 53, 'stack': [[{'start': {'row': 107, 'column': 13}, 'end': {'row': 107, 'column': 16}, 'action': 'remove', 'lines': ['UTC'], 'id':...
flexible
{ "blob_id": "f6b38698dbed6c1a48faa86183b601f855a7f737", "index": 5728, "step-1": "<mask token>\n", "step-2": "{'filter': false, 'title': 'settings.py', 'tooltip': '/mysite/settings.py',\n 'undoManager': {'mark': 53, 'position': 53, 'stack': [[{'start': {'row':\n 107, 'column': 13}, 'end': {'row': 107, 'c...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def log_config(baseline): message = ( '------------------------------------------------------------------------' ) message += '\nDATASET: ' + dataset message += '\nBASELINE: ' + baseline datahandler.log_config(message) print(message) <|reserved_specia...
flexible
{ "blob_id": "9e8ddf6c35ebad329e1f5a48513e4bfaae0d9a6f", "index": 4925, "step-1": "<mask token>\n\n\ndef log_config(baseline):\n message = (\n '------------------------------------------------------------------------'\n )\n message += '\\nDATASET: ' + dataset\n message += '\\nBASELINE: ' + ...
[ 4, 6, 7, 8, 9 ]
def equals(left, right, tol=0.001): """ Tests equality of left and right Rosalind allows for a default [absolute] error of 0.001 in decimal answers unless otherwise stated. """ try: left = left.strip() right = right.strip() except AttributeError: pass try: ...
normal
{ "blob_id": "b137fc40a5b2dec63c7abb6953664a969f5c126f", "index": 8022, "step-1": "<mask token>\n", "step-2": "def equals(left, right, tol=0.001):\n \"\"\"\n Tests equality of left and right\n\n Rosalind allows for a default [absolute] error of 0.001 in decimal\n answers unless otherwise stated.\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def cubarea(l2, b2, h2): print('Area of cuboid =', 2 * (l2 + b2 + h2)) <|reserved_special_token_0|> <|reserved_special_token_1|> def cubarea(l2, b2, h2): print('Area of cuboid =', 2 * (l2 + b2 + h2)) def cubperimeter(l2, b2, h2): print('Per...
flexible
{ "blob_id": "45a85ff765833fd62fc1670404d8994818788707", "index": 6873, "step-1": "<mask token>\n", "step-2": "def cubarea(l2, b2, h2):\n print('Area of cuboid =', 2 * (l2 + b2 + h2))\n\n\n<mask token>\n", "step-3": "def cubarea(l2, b2, h2):\n print('Area of cuboid =', 2 * (l2 + b2 + h2))\n\n\ndef cubpe...
[ 0, 1, 2, 3 ]
from dateutil import parser from datetime import datetime from backend.crawler import calender_crawler from backend.logic.schedule_by_time.schedule_utils import get_weeks_of_subject from backend.logic.schedule_by_time.schedule_utils import get_time_str # e.g. hôm nay, hôm qua, ngày mai, thứ 2, thứ tư, chủ nhật, thứ ...
normal
{ "blob_id": "6339f5c980ab0c0fb778870196493ddd83963ae7", "index": 9203, "step-1": "<mask token>\n\n\ndef filter_by_session(schedule_table, time_entity):\n subjects_of_day = filter_by_weekday(schedule_table, time_entity)\n start_session_hour = parser.parse(time_entity['value']['from']).hour\n schedule = [...
[ 5, 6, 7, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not os.path.isdir(plotdir): os.makedirs(plotdir) <|reserved_special_token_0|> plot_azav(fig, ax, ro_m, rr, cost, sint, contours=False, notfloat=False, units='') plt.title('$({\\rm{Ro}}_{\\rm{c}})_+$', fontsize=16) plt.t...
flexible
{ "blob_id": "e5c30488c8c1682171c57a11a8ecedc5ccd4d851", "index": 5607, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.isdir(plotdir):\n os.makedirs(plotdir)\n<mask token>\nplot_azav(fig, ax, ro_m, rr, cost, sint, contours=False, notfloat=False,\n units='')\nplt.title('$({\\\\rm{Ro}}_...
[ 0, 1, 2, 3, 4 ]
''' ESTMD Tool to isolate targets from video. You can generate appropriate videos using module Target_animation. __author__: Dragonfly Project 2016 - Imperial College London ({anc15, cps15, dk2015, gk513, lm1015,zl4215}@imperial.ac.uk) CITE ''' import os from copy import deepcopy import cv2 import nump...
normal
{ "blob_id": "b0a354d82880c5169293d1229206470c1f69f24f", "index": 8902, "step-1": "'''\nESTMD\n\nTool to isolate targets from video. You can generate appropriate videos\nusing module Target_animation.\n\n__author__: Dragonfly Project 2016 - Imperial College London\n ({anc15, cps15, dk2015, gk513, lm101...
[ 0 ]
import turtle def draw_triangle(brad): brad.color("blue", "green") brad.fill(True) brad.forward(300) brad.left(120) brad.forward(300) brad.left(120) brad.forward(300) brad.end_fill() #jdjjdd brad.color("blue", "white") brad.fill(True) brad.left(180) brad.forward(150) ...
normal
{ "blob_id": "33f766bf12a82e25e36537d9d3b745b2444e1fd7", "index": 7042, "step-1": "<mask token>\n\n\ndef draw():\n window = turtle.Screen()\n window.bgcolor('white')\n brad = turtle.Turtle()\n brad.shape('turtle')\n brad.color('blue')\n brad.speed(6)\n draw_triangle(brad)\n window.exitoncl...
[ 1, 2, 3, 4, 5 ]
from pybot import usb4butia u4b = usb4butia.USB4Butia() while True: bot = u4b.getButton(6) print bot
normal
{ "blob_id": "24b6d33849f034b9f61ffd4aaff90a0f428085fe", "index": 7473, "step-1": "from pybot import usb4butia\n\nu4b = usb4butia.USB4Butia()\n\nwhile True:\n bot = u4b.getButton(6)\n print bot\n\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> config_env = {'api_port': int(getenv('API_PORT')), 'psg_uri': getenv('PSG_URI') } <|reserved_special_token_1|> from os import getenv config_env = {'api_port': int(getenv('API_PORT')), 'psg_uri': getenv('PSG_URI') }
flexible
{ "blob_id": "21dd3d1deb00e9bc09803d01f1c05673ea8d25d2", "index": 3771, "step-1": "<mask token>\n", "step-2": "<mask token>\nconfig_env = {'api_port': int(getenv('API_PORT')), 'psg_uri': getenv('PSG_URI')\n }\n", "step-3": "from os import getenv\nconfig_env = {'api_port': int(getenv('API_PORT')), 'psg_uri'...
[ 0, 1, 2 ]
def create_map(rows): maze = [] for row in rows: row = row[:-1] subarr = [] for i in row: subarr.append(i) maze.append(subarr) return maze def print_map(chart): for subarr in chart: print(subarr) def find_start(chart): for y in range(len(chart)...
flexible
{ "blob_id": "bde37f3b41c810ab465de5e0ae374703af9f01f3", "index": 9033, "step-1": "def create_map(rows):\n maze = []\n for row in rows:\n row = row[:-1]\n subarr = []\n for i in row:\n subarr.append(i)\n maze.append(subarr)\n return maze\n\n\ndef print_map(chart):\n...
[ 3, 4, 5, 6, 7 ]
#!/use/bin/python import os, sys from io import BytesIO from pathlib import Path from flask_config import app from flask import send_file from PyPDF2 import PdfFileReader, PdfFileWriter def rotate_pdf(working_dir, filename, rotation): os.chdir(working_dir) output_name = 'pages' rotate_pdf_pages(filename, rotati...
normal
{ "blob_id": "624027373f53f62ededc40bfc859f28b5a83ca04", "index": 3266, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef rotate_pdf_pages(filename, rotation, output_name):\n pdf_reader = PdfFileReader('{}.pdf'.format(filename))\n pdf_writer = PdfFileWriter()\n for page in range(pdf_reader.g...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def r(ep=100): length = len(corpus) batch_size = 256 mbl = time_steps * batch_size sr = length - mbl - time_steps - 2 for i in range(ep): print('---------------------iter', i, '/', ep) j = np.random.choice(sr) minibatch = corpus[j:j + mbl] ...
flexible
{ "blob_id": "0016e38d39ed2a4c7a75bed103bc47a5b6fd0e8c", "index": 2538, "step-1": "<mask token>\n\n\ndef r(ep=100):\n length = len(corpus)\n batch_size = 256\n mbl = time_steps * batch_size\n sr = length - mbl - time_steps - 2\n for i in range(ep):\n print('---------------------iter', i, '/'...
[ 6, 9, 12, 13, 14 ]
r""" Definition ---------- Calculates the scattering from a **body-centered cubic lattice** with paracrystalline distortion. Thermal vibrations are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is assumed to be isotropic and characterized by a Gaussian dis...
normal
{ "blob_id": "7ccaa15f025b2c1ba560d07c1a30b06c9ebf9ad1", "index": 1927, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef random():\n \"\"\"Return a random parameter set for the model.\"\"\"\n radius = 10 ** np.random.uniform(1.3, 4)\n d_factor = 10 ** np.random.uniform(-2, -0.7)\n dnn_fr...
[ 0, 1, 2, 3, 4 ]
from django.contrib.postgres.fields import JSONField from django.db import models from core.utils.time import get_now class BaseManager(models.Manager): """ Our basic manager is used to order all child models of AbstractLayer by created time (descending), therefore it creates a LIFO order, causing th...
normal
{ "blob_id": "5a33aeffa740a41bd0bd1d80f45796ae37377a4c", "index": 757, "step-1": "<mask token>\n\n\nclass AbstractLayer(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def filter(cls, *args, **kwa...
[ 12, 17, 18, 19, 22 ]
import caffe import numpy as np class PyLayer(caffe.Layer): def setup(self, bottom, top): if len(bottom) != 2: raise Exception("Need two inputs to compute distance") def reshape(self, bottom, top): if bottom[0].count != bottom[1].count: raise Exception("Inputs must have the same dimension") ...
normal
{ "blob_id": "8040b47dc3fd6b03432f64d7fb8a4267cc94ac9a", "index": 2698, "step-1": "<mask token>\n\n\nclass PyLayer(caffe.Layer):\n\n def setup(self, bottom, top):\n if len(bottom) != 2:\n raise Exception('Need two inputs to compute distance')\n\n def reshape(self, bottom, top):\n if...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def calEntropy(dataSet): """ 输入:二维数据集 输出:二维数据集标签的熵 描述: 计算数据集的标签的香农熵;香农熵越大,数据集越混乱; 在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到 """ entryNum = len(dataSet) labelsCount = {} for entry in dataSet: label = entry[-1] if label not in labelsCount....
flexible
{ "blob_id": "b051a3dbe1c695fda9a0488dd8986d587bbb24a6", "index": 5838, "step-1": "<mask token>\n\n\ndef calEntropy(dataSet):\n \"\"\"\n 输入:二维数据集\n 输出:二维数据集标签的熵\n 描述:\n 计算数据集的标签的香农熵;香农熵越大,数据集越混乱;\n 在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到\n \"\"\"\n entryNum = len(dataSet)\n labelsCount = ...
[ 12, 18, 19, 21, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': ghettoGoogle = SearchEngine() def searchButtonEvent(): search_query = searchQueryWidget.get() search_results = ghettoGoogle.search(search_query) resultsCanvas = tk.Tk() ...
flexible
{ "blob_id": "0cf90cd7704db9f7467e458b402fadb01c701148", "index": 7307, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n ghettoGoogle = SearchEngine()\n\n def searchButtonEvent():\n search_query = searchQueryWidget.get()\n search_results = ghettoGoogle.search...
[ 0, 1, 2, 3 ]
# from magicbot import AutonomousStateMachine, timed_state, state # from components.drivetrain import Drivetrain, DrivetrainState # from components.intake import Intake # from fieldMeasurements import FieldMeasurements # class PushBotAuto(AutonomousStateMachine): # # this auto is intended to push other robots of...
normal
{ "blob_id": "fdef3e94bbeb29c25bf14e17cd1d013cf848bedc", "index": 9456, "step-1": "# from magicbot import AutonomousStateMachine, timed_state, state\n\n# from components.drivetrain import Drivetrain, DrivetrainState\n# from components.intake import Intake\n\n# from fieldMeasurements import FieldMeasurements\n\n# ...
[ 1 ]
<|reserved_special_token_0|> class QLearn: <|reserved_special_token_0|> <|reserved_special_token_0|> def checkBoundaries(self, state, action): row, column = int(state[0]), int(state[1]) if action == Directions.UP: return f'{max(row - 1, 0)}{column}', self.environment[max(row -...
flexible
{ "blob_id": "221b6ad6035276fb59addc4065c4ccee3f5a2d84", "index": 6351, "step-1": "<mask token>\n\n\nclass QLearn:\n <mask token>\n <mask token>\n\n def checkBoundaries(self, state, action):\n row, column = int(state[0]), int(state[1])\n if action == Directions.UP:\n return f'{ma...
[ 5, 7, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ConvMainUnitTest: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ConvMainUnitTest: @staticmethod def implicit_gemm(input: Tensor, weight: Tensor, output: Tens...
flexible
{ "blob_id": "a6f3c51d4115a6e0d6f01aa75bf5e6e367840d43", "index": 914, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ConvMainUnitTest:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ConvMainUnitTest:\n\n @staticmethod\n def implicit_gemm(input: Tensor, weight: Tensor, output: ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, 101): mlt = i ** 2 mlt_sum += mlt num_sum += i print(num_sum ** 2 - mlt_sum) <|reserved_special_token_1|> mlt = 1 mlt_sum = 0 num_sum = 0 for i in range(1, 101): mlt = i ** 2 mlt_sum += mlt...
flexible
{ "blob_id": "6f877dccab8d62e34b105bbd06027cbff936e3aa", "index": 6885, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 101):\n mlt = i ** 2\n mlt_sum += mlt\n num_sum += i\nprint(num_sum ** 2 - mlt_sum)\n", "step-3": "mlt = 1\nmlt_sum = 0\nnum_sum = 0\nfor i in range(1, 101):\...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: UTF-8 -*- def parse(node, array): string = '' string += "\t%s = ScrollView:create();\n" % node if (array.get('IsBounceEnabled') != None and array['IsBounceEnabled']): string += "\t%s:setBounceEnabled(true);\n" % node if (array.get('InnerNodeSize') != None): ...
normal
{ "blob_id": "97b94f3388a6e2473d43e3c4c4e281a86a031dbb", "index": 9288, "step-1": "<mask token>\n", "step-2": "def parse(node, array):\n string = ''\n string += '\\t%s = ScrollView:create();\\n' % node\n if array.get('IsBounceEnabled') != None and array['IsBounceEnabled']:\n string += '\\t%s:set...
[ 0, 1, 2 ]
#!/usr/bin/python # encoding=utf-8 """ @Author : Don @Date : 9/16/2020 1:40 PM @Desc : """ import os import yaml config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.yaml") with open(config_path, "r", encoding="utf-8") as f: conf = yaml.load(f.read(), Loader=yaml.FullLoader)...
normal
{ "blob_id": "8834548f6180fc864d73a71194125b22d230a393", "index": 6882, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(config_path, 'r', encoding='utf-8') as f:\n conf = yaml.load(f.read(), Loader=yaml.FullLoader)\n", "step-3": "<mask token>\nconfig_path = os.path.join(os.path.dirname(os.pa...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Hdmovie14Ag(SimpleScraperBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def _fetch_search_url(self, search_term, media_t...
flexible
{ "blob_id": "27a12a0f5ea6120036b66ee1cdd903da868a037f", "index": 952, "step-1": "<mask token>\n\n\nclass Hdmovie14Ag(SimpleScraperBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _fetch_search_url(self, search_term, media_type):\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> file.write('Yo') <|reserved_special_token_1|> file = open('yo.txt', 'wr') file.write('Yo') <|reserved_special_token_1|> file = open("yo.txt", "wr") file.write("Yo")
flexible
{ "blob_id": "207b6e56b683c0b069c531a4c6076c2822814390", "index": 512, "step-1": "<mask token>\n", "step-2": "<mask token>\nfile.write('Yo')\n", "step-3": "file = open('yo.txt', 'wr')\nfile.write('Yo')\n", "step-4": "file = open(\"yo.txt\", \"wr\")\n\nfile.write(\"Yo\")\n\n", "step-5": null, "step-ids":...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @pytest.fixture def unified_job(mocker): mocker.patch.object(UnifiedJob, 'can_cancel', return_value=True) j = UnifiedJob() j.status = 'pending' j.cancel_flag = None j.save = mocker.MagicMock() j.websocket_emit_status = mocker.MagicMock() return j <|reserved_s...
flexible
{ "blob_id": "80a397b0974e41c4669f07638b5b38830b58cb37", "index": 9051, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef unified_job(mocker):\n mocker.patch.object(UnifiedJob, 'can_cancel', return_value=True)\n j = UnifiedJob()\n j.status = 'pending'\n j.cancel_flag = None\n j.save = mocker.MagicM...
[ 2, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import sys import getopt import datetime import gettext import math import datetime import json import gettext from datetime import datetime FIELD_INDEX_DATE = 0 FIELD_INDEX_DATA = 1 def getPercentile(arr, percentile): percentile = min(100, max(0, percentile)) index = (percentile / 10...
normal
{ "blob_id": "a801ca6ae90556d41fd278032af4e58a63709cec", "index": 7977, "step-1": "<mask token>\n\n\ndef write(output_filename, content):\n with open(output_filename, 'w') as outfile:\n outfile.write(content)\n\n\ndef main(argv):\n \"\"\"\n WebPerf Core Carbon Percentiles\n\n\n Usage:\n * ru...
[ 2, 4, 5, 6, 7 ]
import json import urllib.request, urllib.parse, urllib.error import xml.etree.ElementTree as ET import ssl ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE total=list() url= input ('Enter Location: ') #user input url print('Retrieving: ', url) uh = urllib.request.urlope...
normal
{ "blob_id": "cd175c236dd1d1c7387a21a491e80d6723f161dc", "index": 7762, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Retrieving: ', url)\n<mask token>\nprint('Retrieved', len(data), 'characters')\n<mask token>\nprint('User count:', len(info['comments']))\n<mask token>\nfor items in x:\n y = it...
[ 0, 1, 2, 3, 4 ]
S = input() T = [] sen = ["dream", "dreamer", "erase", "eraser"] s_len = len(S) while len(T) <= s_len:
normal
{ "blob_id": "b874bb37fa59d9f1194c517bedbdbafae748786e", "index": 5695, "step-1": "S = input()\n\nT = []\nsen = [\"dream\", \"dreamer\", \"erase\", \"eraser\"]\ns_len = len(S)\n\n\nwhile len(T) <= s_len:\n ", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# -*- coding: utf-8 -*- """ Created on Mon Jul 8 11:51:49 2019 @author: Christian Post """ # TODO: row index as an attribute of Data? # make iterrows return a row object to access column names for each row import csv import os import datetime def euro(number): return f'{number:.2f} €'.replace(...
normal
{ "blob_id": "8db952ba5bf42443da89f4064caf012036471541", "index": 2307, "step-1": "<mask token>\n\n\ndef euro(number):\n return f'{number:.2f} €'.replace('.', ',')\n\n\n<mask token>\n\n\nclass Data:\n\n def __init__(self, data=None, columns=[]):\n self.data = {}\n self.columns = columns\n ...
[ 8, 10, 11, 12, 13 ]
from menu_sun_integration.application.adapters.customer_adapter import CustomerAdapter from menu_sun_integration.infrastructure.brf.builders.brf_base_builder import BRFBaseBuilder from menu_sun_integration.infrastructure.brf.translators.brf_customer_translator import BRFCustomerTranslator class BRFCustomerBuilder(BRF...
normal
{ "blob_id": "8020bac94de3e68193c9891a628a48c537c5afa0", "index": 9069, "step-1": "<mask token>\n\n\nclass BRFCustomerBuilder(BRFBaseBuilder):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BRFCustomerBuilder(BRFBaseBuilder):\n\n def define_translator(self) ->None:\n self._...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def index(request): return render(request, 'canyon/index.html') def results(request): return render(request, 'canyon/results.html') <|reserved_special_token_1|> <|reserved_special_token_0|> django.setup() def index(request): return render(request, 'canyon/index.html') ...
flexible
{ "blob_id": "c385fe2af9aebc9c4a42d4db5a341fcedeec3898", "index": 3579, "step-1": "<mask token>\n\n\ndef index(request):\n return render(request, 'canyon/index.html')\n\n\ndef results(request):\n return render(request, 'canyon/results.html')\n", "step-2": "<mask token>\ndjango.setup()\n\n\ndef index(reque...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(9 * int(input()) / 5 + 32) <|reserved_special_token_1|> print((9*int(input())/5)+32)
flexible
{ "blob_id": "4e9a968842c2b3eca79690f0b56c8e176b203138", "index": 362, "step-1": "<mask token>\n", "step-2": "print(9 * int(input()) / 5 + 32)\n", "step-3": "print((9*int(input())/5)+32)", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import torch from torch import nn, autograd import config import time import copy import progressbar as pb from dataset import TrainDataSet from model import BiAffineSrlModel from fscore import FScore config.add_option('-m', '--mode', dest='mode', default='train...
normal
{ "blob_id": "038ccba05113fb7f2f589eaa7345df53cb59a5af", "index": 18, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train(num_epochs=30):\n lossfunction = nn.CrossEntropyLoss()\n trainset = TrainDataSet()\n model = BiAffineSrlModel(vocabs=trainset.vocabs)\n optimizer = torch.optim.Ada...
[ 0, 1, 2, 3, 4 ]
import pathlib, binascii from textwrap import wrap from PIL import Image import struct def loadFile(): global data x = 0 data = [] subs = ["image", "text file"] exts = [".jpg", ".txt"] while x < 2: check = pathlib.Path(input(f"Enter {subs[x]} name: ")).with_suffix(exts[x]) #...
normal
{ "blob_id": "aae09dafeb10a1f9ed260439e63e4aaadadc3768", "index": 2051, "step-1": "<mask token>\n\n\ndef loadFile():\n global data\n x = 0\n data = []\n subs = ['image', 'text file']\n exts = ['.jpg', '.txt']\n while x < 2:\n check = pathlib.Path(input(f'Enter {subs[x]} name: ')).with_suf...
[ 4, 5, 6, 7, 8 ]
# https://py.checkio.org/blog/design-patterns-part-1/ class ImageOpener(object): @staticmethod def open(filename): raise NotImplementedError() class PNGImageOpener(ImageOpener): @staticmethod def open(filename): print('PNG: open with Paint') class JPEGImageOpener(ImageOpener): @...
normal
{ "blob_id": "c199b2f87b7a4ac820001dab13f24fdd287a1575", "index": 3507, "step-1": "<mask token>\n\n\nclass UnknownImageOpener(ImageOpener):\n\n @staticmethod\n def open(filename):\n print(\"You don't hame program for %s extension\" % filename.split(\n '.')[-1].upper())\n\n\nclass Image(obj...
[ 5, 6, 12, 13, 15 ]
<|reserved_special_token_0|> def blogs(request): only_pub_blog = Blog.objects.filter(status=1) return render(request, 'dlblog/blogs.html', {'blog': only_pub_blog}) <|reserved_special_token_0|> @login_required def newblog(request): return render(request, 'dlblog/newblog.html') <|reserved_special_toke...
flexible
{ "blob_id": "70fcf25cd7d70972e8042dc882f6ecb12d36461a", "index": 3353, "step-1": "<mask token>\n\n\ndef blogs(request):\n only_pub_blog = Blog.objects.filter(status=1)\n return render(request, 'dlblog/blogs.html', {'blog': only_pub_blog})\n\n\n<mask token>\n\n\n@login_required\ndef newblog(request):\n r...
[ 5, 6, 7, 8, 9 ]
def main(): try: contacts = open('contactsLab4.txt', 'r') names = [] birthdates = [] name = contacts.readline() while name != '': names.append(name.rstrip('\n')) date = contacts.readline() birthdates.append(date.rstrip('\n')) na...
flexible
{ "blob_id": "661f94f5770df1026352ee344d0006466662bb3c", "index": 2537, "step-1": "def main():\n try:\n contacts = open('contactsLab4.txt', 'r')\n names = []\n birthdates = []\n name = contacts.readline()\n while name != '':\n names.append(name.rstrip('\\n'))\n ...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def factorial(num): sum = 1 while num != 0: sum *= num num -= 1 return sum <|reserved_special_token_0|> <|reserved_special_token_1|> def factorial(num): sum = 1 while num != 0: sum *= num num -= 1 r...
flexible
{ "blob_id": "cc6f02f9e1633fa15b97af5f926e083a65a8336e", "index": 5977, "step-1": "<mask token>\n", "step-2": "def factorial(num):\n sum = 1\n while num != 0:\n sum *= num\n num -= 1\n return sum\n\n\n<mask token>\n", "step-3": "def factorial(num):\n sum = 1\n while num != 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for en in list: ef = re.sub('en', 'ef', en) efAli = re.sub('en', 'efAli', en) cmd = 'proc2d %s %s_filt.mrc apix=1.501 lp=20' % (ef, ef[:-4]) subprocess.Popen(cmd, shell=True).wait() cmd = 'alignhuge %s_filt.mrc...
flexible
{ "blob_id": "e5cc556d4258ef5c85f7bc5149cdd33471493bdb", "index": 1972, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor en in list:\n ef = re.sub('en', 'ef', en)\n efAli = re.sub('en', 'efAli', en)\n cmd = 'proc2d %s %s_filt.mrc apix=1.501 lp=20' % (ef, ef[:-4])\n subprocess.Popen(cmd, shel...
[ 0, 1, 2, 3, 4 ]