code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import requests, os def lambda_handler(event, context): print(requests) apiKey = os.environ['newrelic_api_key'] headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8', 'X-api-key': apiKey} r = requests.get('https://api.newrelic.com/v2/applications.json', headers=heade...
normal
{ "blob_id": "e89600f109335ffdb00c13f617d61496c547ba61", "index": 5612, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n print(requests)\n apiKey = os.environ['newrelic_api_key']\n headers = {'content-type': 'application/json', 'Accept-Charset':\n 'U...
[ 0, 1, 2 ]
# Code By it4min # t.me/it4min # t.me/LinuxArmy # -- Combo List Maker v1 -- import time, os os.system("clear") banner = ''' \033[92m .o88b. .d88b. .88b d88. d8888b. .d88b. d8P Y8 .8P Y8. 88'YbdP`88 88 `8D .8P Y8. 8P 88 88 88 88 88 88oooY' 88 88 8b 88 88 88 88 88 88~~~b. 88 88 Y8b...
normal
{ "blob_id": "6ab5ac0caa44366268bb8b70ac044376d9c062f0", "index": 6976, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('clear')\n<mask token>\nprint(banner)\n<mask token>\nos.system('clear')\nprint('\\n' + '\\x1b[94m - Loading Data ...')\ntime.sleep(3)\nfor u in usrf:\n userlist.append(u...
[ 0, 1, 2, 3, 4 ]
from flask import Flask app=Flask('__name__') @app.route("/my/<name>/<age>") def my(name,age): name ="saral" age="20" return "my name is {} and age is {}".format(name,age)
normal
{ "blob_id": "3817770a80f8ab16322485522be18edd6b3f5516", "index": 179, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/my/<name>/<age>')\ndef my(name, age):\n name = 'saral'\n age = '20'\n return 'my name is {} and age is {}'.format(name, age)\n", "step-3": "<mask token>\napp = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestPacktOffer: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_offer_title_extracter_proper(self): result = offer_title_extracter(self.proper_soup) assert_equals(result, 'Example title') <|reserved...
flexible
{ "blob_id": "a29f89750ef3a55116959b217b8c9100b294c66c", "index": 3766, "step-1": "<mask token>\n\n\nclass TestPacktOffer:\n <mask token>\n <mask token>\n <mask token>\n\n def test_offer_title_extracter_proper(self):\n result = offer_title_extracter(self.proper_soup)\n assert_equals(resu...
[ 3, 7, 8, 11, 12 ]
class Node: def __init__(self, data): self.data = data self.next = None <|reserved_special_token_0|> def Reverse(Head): Temp = Head TempNext = Head.next while TempNext != None: NextSaved = TempNext.next TempNext.next = Temp Temp = TempNext TempNext = ...
flexible
{ "blob_id": "ff137b51ea5b8c21e335a38a3d307a3302921245", "index": 9993, "step-1": "class Node:\n\n def __init__(self, data):\n self.data = data\n self.next = None\n\n\n<mask token>\n\n\ndef Reverse(Head):\n Temp = Head\n TempNext = Head.next\n while TempNext != None:\n NextSaved =...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def weergeef_instagram_links(): """ Geeft de bijbehorende station dict uit de lijst van alle stations (in de NS API) :param stationnaam: geef ofwel kort, middel als lange stationnaam om de bijbehorende station te identificeren :type stationnaam: str :return: station di...
flexible
{ "blob_id": "2804d49fc9f0e40859de1e8eb4f04a849639b1d4", "index": 8277, "step-1": "<mask token>\n\n\ndef weergeef_instagram_links():\n \"\"\"\n Geeft de bijbehorende station dict uit de lijst van alle stations (in de NS API)\n :param stationnaam: geef ofwel kort, middel als lange stationnaam om de bijbeh...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: """ @param root: The root of binary tree. @return: An integer """ def maxDepth(self, root): if not ...
flexible
{ "blob_id": "262d6722f4c158d0a41b22433792cdc35651d156", "index": 9459, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n \"\"\"\n @param root: The root of binary tree.\n @return: An integer\n \"\"\"\n\n def maxDept...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class CaricaturaAdmin(admin.ModelAdmin): pass class VideoAdmin(admin.ModelAdmin): pass class TypePostAdmin(admin.ModelAdmin): pass class PostAdmin(admin.ModelAdmin): class Media: js = ('admin/js/tiny_mce/tiny_mce.js', 'admin/js/tiny_mce/basic_co...
flexible
{ "blob_id": "3c9302b5cb92e5103ed16ec56e1b349f0662950c", "index": 154, "step-1": "<mask token>\n\n\nclass CaricaturaAdmin(admin.ModelAdmin):\n pass\n\n\nclass VideoAdmin(admin.ModelAdmin):\n pass\n\n\nclass TypePostAdmin(admin.ModelAdmin):\n pass\n\n\nclass PostAdmin(admin.ModelAdmin):\n\n\n class Med...
[ 8, 9, 10, 11, 15 ]
<|reserved_special_token_0|> @login_required def article_create(request, block_id): block_id = int(block_id) block = Block.objects.get(id=block_id) if request.method == 'GET': return render(request, 'article_create.html', {'b': block}) else: form = ArticleForm(request.POST) if ...
flexible
{ "blob_id": "0f94537fa64066bb29c5e9e97836b0a8ac01ac19", "index": 9844, "step-1": "<mask token>\n\n\n@login_required\ndef article_create(request, block_id):\n block_id = int(block_id)\n block = Block.objects.get(id=block_id)\n if request.method == 'GET':\n return render(request, 'article_create.ht...
[ 1, 2, 3, 4, 5 ]
n, a, b = map(int, input().split()) cl = list(map(int, input().split())) for i in range(n): if cl[i] == a + b: print(i + 1)
normal
{ "blob_id": "ff081a5ff46ab37dc5a144fb4616c06ef3bca490", "index": 7286, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n if cl[i] == a + b:\n print(i + 1)\n", "step-3": "n, a, b = map(int, input().split())\ncl = list(map(int, input().split()))\nfor i in range(n):\n if cl[...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.executescript(sql_as_string) for row in cursor.execute('SELECT * FROM results_states'): print(row) <|reserved_special_token_1|> <|reserved_special_token_0|> connection = sqlite3.connect('../db.sqlite3') cursor = conn...
flexible
{ "blob_id": "10a981e35ce00ee8e32a613823d3bc919fafaae8", "index": 8225, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.executescript(sql_as_string)\nfor row in cursor.execute('SELECT * FROM results_states'):\n print(row)\n", "step-3": "<mask token>\nconnection = sqlite3.connect('../db.sqlite3'...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from datetime import datetime from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx from odoo.tools import DEFAULT_SERVER_DATE_FORMAT import xlwt from odoo import _ from odoo.exceptions import AccessError, UserError class mutasibankjurnal(ReportXlsx): def generate_xlsx_r...
normal
{ "blob_id": "950929edc82bf78ee33df117fba370b937255adc", "index": 1703, "step-1": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n\n def generate_xlsx_report(self, workbook, data, wizard):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def make_save_folder(prefix='', add_suffix=True) ->str: """ 1. 現在時刻のハッシュをsuffixにした文字列の生成 2. 生成した文字列のフォルダが無かったら作る :param prefix:save folderの系統ラベル :param add_suffix: suffixを付与するかを選ぶフラグ, True: 付与, False: 付与しない ...
flexible
{ "blob_id": "14e304f30364932910986f2dda48223b6d4b01c0", "index": 8372, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_save_folder(prefix='', add_suffix=True) ->str:\n \"\"\"\n 1. 現在時刻のハッシュをsuffixにした文字列の生成\n 2. 生成した文字列のフォルダが無かったら作る\n :param prefix:save folderの系統ラベル\n :param add...
[ 0, 1, 2, 3, 4 ]
#-*- coding: utf-8 -*- from django.db import models from authentication.models import Account class QuestionFaq(models.Model): title = models.CharField(max_length=50, verbose_name=u'Тема вопроса') question = models.TextField(verbose_name=u'Задайте вопрос') date = models.DateField(auto_now_add=True) ch...
normal
{ "blob_id": "b00c9f099fcb31262df947f47d7190912ee66965", "index": 6159, "step-1": "<mask token>\n\n\nclass AnswerFaq(models.Model):\n account = models.ForeignKey(Account)\n answer = models.TextField(verbose_name=u'Ответ на вопрос в FAQ')\n question = models.ForeignKey(QuestionFaq)\n date = models.Date...
[ 3, 4, 6, 7, 8 ]
import requests import json def display_response(rsp): try: print("Printing a response.") print("HTTP status code: ", rsp.status_code) h = dict(rsp.headers) print("Response headers: \n", json.dumps(h, indent=2, default=str)) try: body = rsp.json() p...
normal
{ "blob_id": "31761b9469cc579c209e070fbe7b71943404a1ff", "index": 3992, "step-1": "<mask token>\n\n\ndef test_get_from_hell():\n try:\n url = (\n 'http://127.0.0.1:5000/api/lahman2017/people?children=appearances%2Cbatting&people.nameLast=Williams&batting.yearID=1960&appearances.yearID=1960&fi...
[ 1, 2, 3, 4, 5 ]
from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Post(models.Model): title = models.CharField(max_length=100) content = models.TextField() date_posted = models.DateTimeField(auto_now_add=timezone.now) autho...
normal
{ "blob_id": "25ce31aee44c80ce4a5c1af7d1ca12c73c14df47", "index": 5530, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SurveyHistory(models.Model):\n post = models.ForeignKey(to=Post, ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> svg2pdf.svg2pdf('report.svg', 'teste2.pdf') svg2pdf.svg2pdf2('report.svg', 'teste3.pdf') <|reserved_special_token_1|> <|reserved_special_token_0|> svg2pdf = CDLL('./libsvg2pdf.so') svg2pdf.svg2pdf('report.svg', 'teste2.pdf') sv...
flexible
{ "blob_id": "9c85252b4048b5412978b3ac05cd6dde4479e3bf", "index": 3333, "step-1": "<mask token>\n", "step-2": "<mask token>\nsvg2pdf.svg2pdf('report.svg', 'teste2.pdf')\nsvg2pdf.svg2pdf2('report.svg', 'teste3.pdf')\n", "step-3": "<mask token>\nsvg2pdf = CDLL('./libsvg2pdf.so')\nsvg2pdf.svg2pdf('report.svg', '...
[ 0, 1, 2, 3, 4 ]
import numpy as np N, M = (int(x) for x in input().split()) x, y, z = np.zeros(N, dtype=int), np.zeros(N, dtype=int), np.zeros(N, dtype=int ) for i in range(N): x[i], y[i], z[i] = (int(x) for x in input().split()) temp = [] for sx in (-1, 1): for sy in (-1, 1): for sz in (-1, 1): _x, _y,...
normal
{ "blob_id": "af40239551709eff02b8a1f034583ab80845d1d7", "index": 1532, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n x[i], y[i], z[i] = (int(x) for x in input().split())\n<mask token>\nfor sx in (-1, 1):\n for sy in (-1, 1):\n for sz in (-1, 1):\n _x, _y, _z ...
[ 0, 1, 2, 3 ]
import requests response = requests.get( 'https://any-api.com:8443/https://rbaskets.in/api/version') print(response.text)
normal
{ "blob_id": "ab36b3d418be67080e2efaba15edc1354386e191", "index": 6888, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.text)\n", "step-3": "<mask token>\nresponse = requests.get(\n 'https://any-api.com:8443/https://rbaskets.in/api/version')\nprint(response.text)\n", "step-4": "import...
[ 0, 1, 2, 3 ]
""" Created on Apr 27, 2017 @author: Franziska Schlösser """ from ipet.parsing.Solver import Solver import re from ipet import Key from ipet import misc class MIPCLSolver(Solver): solverId = "MIPCL" recognition_expr = re.compile("Reading data") primalbound_expr = re.compile("Objective value: (\S*)") dualbound_ex...
normal
{ "blob_id": "191154c896fe441519ad4f343c6d92d6304fb3db", "index": 8187, "step-1": "<mask token>\n\n\nclass MIPCLSolver(Solver):\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 <...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> polytope.ilp_polytope.test2() <|reserved_special_token_1|> import polytope polytope.ilp_polytope.test2() <|reserved_special_token_1|> # this is just to test with ilp_polytope import polytope polytope.ilp_polytope.test2()
flexible
{ "blob_id": "d2fce15636e43ca618c39c5c963bbf0c3a6a3886", "index": 4444, "step-1": "<mask token>\n", "step-2": "<mask token>\npolytope.ilp_polytope.test2()\n", "step-3": "import polytope\npolytope.ilp_polytope.test2()\n", "step-4": "# this is just to test with ilp_polytope\nimport polytope\n\npolytope.ilp_po...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_webcasts(year): url = 'https://www.sans.org/webcasts/archive/' + str(year) page = urlopen(url) soup = BeautifulSoup(page, 'html.parser') table = soup.find('table', {'class': 'table table-bordered table-st...
flexible
{ "blob_id": "14971842092c7aa41477f28cec87628a73a8ffd6", "index": 8407, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_webcasts(year):\n url = 'https://www.sans.org/webcasts/archive/' + str(year)\n page = urlopen(url)\n soup = BeautifulSoup(page, 'html.parser')\n table = soup.find(...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’]) 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例 def test001(self,"变量参数名称") assert 变量名称 """
flexible
{ "blob_id": "24f3284a7a994951a1f0a4ef64c951499bbba1b4", "index": 6958, "step-1": "<mask token>\n", "step-2": "\"\"\"\n pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’])\n 上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例\n def test001(self,\"变量参数名称\")\n assert 变量名称\n\n\"\"\"", "step...
[ 0, 1 ]
<|reserved_special_token_0|> class addItemThread(QThread): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "8ddb7abb480ea8ee674c59719c0946f133ef0a4b", "index": 1303, "step-1": "<mask token>\n\n\nclass addItemThread(QThread):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Example(QWidget):\n\n def...
[ 11, 12, 13, 14, 17 ]
import argparse import datetime import importlib import pprint import time import random import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from utils import get_git_state, time_print, AverageMeter, ProgressMeter, save_checkpoint def train(cfg, epoch, data_loader, model): data_tim...
normal
{ "blob_id": "81688d51696156905736b5de7a4929387fd385ab", "index": 91, "step-1": "<mask token>\n\n\ndef train(cfg, epoch, data_loader, model):\n data_time = AverageMeter('Data', ':6.3f')\n batch_time = AverageMeter('Time', ':6.3f')\n losses = AverageMeter('Loss', ':.4e')\n progress = ProgressMeter(len(...
[ 2, 3, 4, 5, 6 ]
print('Welcome aboard, Oleksij!')
normal
{ "blob_id": "2b1ec29d665aa93cd53644b62efcd1305b34e13e", "index": 2636, "step-1": "<mask token>\n", "step-2": "print('Welcome aboard, Oleksij!')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def convert(lst: list) ->list(): """String Unicode to int""" l = list() for item in lst: l.append(ord(item)) return l <|reserved_special_token_0|> def write(filename: str, data: list, header: list): name = filename.split('.') filename = name[0] + '_out....
flexible
{ "blob_id": "63be96c0d1231f836bbec9ce93f06bda32775511", "index": 2259, "step-1": "<mask token>\n\n\ndef convert(lst: list) ->list():\n \"\"\"String Unicode to int\"\"\"\n l = list()\n for item in lst:\n l.append(ord(item))\n return l\n\n\n<mask token>\n\n\ndef write(filename: str, data: list, ...
[ 2, 3, 4, 5, 6 ]
#coding=utf-8 # """ my custom common module """ import json import base64 # sdk账号信息 APP_ID = '10676432' API_KEY = 'Hy1D1urUTdXzTOzqr9LeN3gc' SECRET_KEY = 'foS4GMg2w3QZtO9XNoSQF17Kkk007xWk' def print_json(obj): """json格式打印信息 Args: obj 待打印的对象信息 """ print(json.dumps(obj, ensure_ascii=False)) ...
normal
{ "blob_id": "0b0eebd31d822ff5c1b951c3ee213f58a3a13aa0", "index": 134, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef print_json(obj):\n \"\"\"json格式打印信息\n\n Args:\n obj 待打印的对象信息\n \"\"\"\n print(json.dumps(obj, ensure_ascii=False))\n\n\ndef print_error(err_code, err_msg):\n ...
[ 0, 3, 4, 5, 6 ]
from django.http import HttpResponsePermanentRedirect from django.urls import is_valid_path from django.utils.deprecation import MiddlewareMixin from django.utils.http import escape_leading_slashes class AppendSlashMiddleware(MiddlewareMixin): response_redirect_class = HttpResponsePermanentRedirect def proc...
normal
{ "blob_id": "ec70fb9119b430dcd36549f2fac8e5e0a0e1bb00", "index": 2696, "step-1": "<mask token>\n\n\nclass AppendSlashMiddleware(MiddlewareMixin):\n <mask token>\n\n def process_request(self, request):\n redirect_url = ''\n if self.should_redirect_with_slash(request):\n path = self....
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-03-09 14:28 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('proposal', '0016_project_callobjectives'), ] operations = [ migrations.Alte...
normal
{ "blob_id": "d5c7b8966e73c607d1d1c5da9814ef507dc53b59", "index": 6852, "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 = [('proposal', ...
[ 0, 1, 2, 3, 4 ]
""" Plugin for ResolveUrl Copyright (C) 2022 shellc0de This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
normal
{ "blob_id": "8dfea24545ec4bb95b66d4b5ff3c4936990eb73a", "index": 9500, "step-1": "<mask token>\n\n\nclass TubeloadResolver(ResolveUrl):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def get_url(self, host, media_id):\n return self._default_get_url(host, media_id, template=...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def to_json(body_str): """转化格式""" try: body_str = to_str(body_str) except: return False body_dict = {} for each in body_str.split('&'): body_dict[str(each.split('=')[0])] = str(each.split('=')[1]) print(body_dict) with open('demo.json', ...
flexible
{ "blob_id": "d8e9b9f7a8d5ec2a72f083ec2283e8c0724dbe0d", "index": 9119, "step-1": "<mask token>\n\n\ndef to_json(body_str):\n \"\"\"转化格式\"\"\"\n try:\n body_str = to_str(body_str)\n except:\n return False\n body_dict = {}\n for each in body_str.split('&'):\n body_dict[str(each....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def resultwriter(feature, output_dest): flag = True with open(output_dest, 'w') as f: for item in feature: w = csv.DictWriter(f, item[1].keys()) if flag: w.writeheader() flag = False w.writerow(item[1]) ...
flexible
{ "blob_id": "9d190face528d1a237f4c92bfb94a399f61a5af2", "index": 9317, "step-1": "<mask token>\n\n\ndef resultwriter(feature, output_dest):\n flag = True\n with open(output_dest, 'w') as f:\n for item in feature:\n w = csv.DictWriter(f, item[1].keys())\n if flag:\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def background_percent_complete(report, run_dir, is_running): if is_running: return {'percentComplete': 0, 'frameCount': 0} dump_file = _dump_file(run_dir) if os.path.exists(dump_file): beam_header = hellweg_dump_reader.beam_header(dump_file) last_updat...
flexible
{ "blob_id": "9e6fd6620b4ec6a574d7948fb0d14b0a2ad0d24e", "index": 5240, "step-1": "<mask token>\n\n\ndef background_percent_complete(report, run_dir, is_running):\n if is_running:\n return {'percentComplete': 0, 'frameCount': 0}\n dump_file = _dump_file(run_dir)\n if os.path.exists(dump_file):\n ...
[ 22, 26, 32, 36, 37 ]
<|reserved_special_token_0|> def line_count(filename, hdfs_used=False, client=None): if hdfs_used: with client.read(filename, encoding='utf-8') as reader: num_lines = sum(1 for _ in reader) return num_lines else: return int(subprocess.check_output(['wc', '-l', filename]...
flexible
{ "blob_id": "203e678d565753bb51e1bbd90ffec0f3260b22fb", "index": 119, "step-1": "<mask token>\n\n\ndef line_count(filename, hdfs_used=False, client=None):\n if hdfs_used:\n with client.read(filename, encoding='utf-8') as reader:\n num_lines = sum(1 for _ in reader)\n return num_li...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class BillOfLading(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|> <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "f8e287abc7e1a2af005aa93c25d95ce770e29bf9", "index": 7378, "step-1": "<mask token>\n\n\nclass BillOfLading(models.Model):\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>...
[ 30, 32, 38, 47, 49 ]
from django.db import models class UserData(models.Model): username = models.CharField(max_length=24) email = models.EmailField(max_length=32, blank=True, null=True) password = models.CharField(max_length=32) created_data = models.DateTimeField() email_is_confirm = models.CharField(max_length=20, ...
normal
{ "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 ]
from django.shortcuts import render # Create your views here. from django.shortcuts import render_to_response from post.models import Post #def ver_un_post(request, idpost): # post = Post.objects.get(id=idpost) # # return render_to_response("post.html",{"post":post,},) def home(request): cursos = Cur...
normal
{ "blob_id": "bd81f4431699b1750c69b0bbc82f066332349fbd", "index": 8976, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef home(request):\n cursos = Curso.objects.order_by('numero')\n return render_to_response('home.html', {'posts': posts})\n", "step-3": "from django.shortcuts import render\nf...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): pass <|reserved_special_token_0|> <|reserved_special_token_1|> def main(): pass def handle_result(args, result, target_window_id, boss): if args[1] == 'next': boss.active_tab_manager.next_tab(1) elif args[1] == 'prev...
flexible
{ "blob_id": "3a7f9bf5420b2d3587f1988c35f2f88bd2fa2b32", "index": 2771, "step-1": "<mask token>\n", "step-2": "def main():\n pass\n\n\n<mask token>\n", "step-3": "def main():\n pass\n\n\ndef handle_result(args, result, target_window_id, boss):\n if args[1] == 'next':\n boss.active_tab_manager....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Merkle: <|reserved_special_token_0|> <|reserved_special_token_0|> def commit_(leafs): assert len(leafs) & len(leafs ) - 1 == 0, 'List must be of a power two length' if len(leafs) == 1: return leafs[0] return Merkle.H(Merkl...
flexible
{ "blob_id": "547926904f9a4b88a988e3b59c49b94fe0e30de4", "index": 1955, "step-1": "<mask token>\n\n\nclass Merkle:\n <mask token>\n <mask token>\n\n def commit_(leafs):\n assert len(leafs) & len(leafs\n ) - 1 == 0, 'List must be of a power two length'\n if len(leafs) == 1:\n ...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> regressor.fit(X_train, y_train) <|reserved_special_token_0|> regressor_OLS.summary() <|reserved_special_token_0|> regressor_OLS.summary() <|reserved_special_token_0|> regressor_OLS.summary() <|reserved_special_token_0|> regressor_...
flexible
{ "blob_id": "4d722975b4ffc1bbfe7591e6ceccc758f67a5599", "index": 6920, "step-1": "<mask token>\n", "step-2": "<mask token>\nregressor.fit(X_train, y_train)\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Acquisition: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def csv_string(self): out_string = '#sample_rate=%d' % self.sample_rate for row in z...
flexible
{ "blob_id": "ec44e12624fbee3148cfa4f886e86ba437e920ec", "index": 4158, "step-1": "<mask token>\n\n\nclass Acquisition:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def csv_string(self):\n out_string = '#sample_rate=%d' % self.sample_rate\n for row...
[ 13, 15, 19, 20, 24 ]
"""updateimage URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-b...
normal
{ "blob_id": "b3b5f7eeb81e10a51eb0322bc5278d33ee5f8e97", "index": 9222, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', jsonre_data), url('^serialize/$', SerializeView.\n as_view()), url('^serialize/$', SerializeView.as_view()), url('^all/$',\n Serializeall.as_view()), url('^...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python from time import sleep from org.mustadroid.python.interleech import processPage import MySQLdb from org.mustadroid.python.interleech.item import Item import re import time if __name__ == "__main__": db = MySQLdb.connect(host = "localhost", user = "interleech", pa...
normal
{ "blob_id": "598c634aac1df951f544127e102a1e2d61cac0b0", "index": 4323, "step-1": "#!/usr/bin/env python\nfrom time import sleep\nfrom org.mustadroid.python.interleech import processPage\nimport MySQLdb\nfrom org.mustadroid.python.interleech.item import Item\nimport re\nimport time\n\nif __name__ == \"__main__\":...
[ 0 ]
class Solution: def levelOrder(self, root): if root is None: return [] currentList = [root] nextList = [] solution = [] while currentList: thisLevel = [node.val for node in currentList] solution.append(thisLevel) for node in cu...
normal
{ "blob_id": "d9f176262dcaf055414fbc43b476117250249b63", "index": 4696, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def levelOrder(self, root):\n if root is None:\n return []\n currentList = [root]\n nextList = ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def spm_hrf_compat(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp =1, p_u_ratio=6, normalize=True): """ SPM HRF function from sum of two gamma PDFs This function is designed to be partially compatible with SPMs `spm_hrf.m` function. The SPN HRF is a *peak* ...
flexible
{ "blob_id": "596ee5568a32c3044e797375fbc705e2091f35c2", "index": 4340, "step-1": "<mask token>\n\n\ndef spm_hrf_compat(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp\n =1, p_u_ratio=6, normalize=True):\n \"\"\" SPM HRF function from sum of two gamma PDFs\n\n This function is designed to be par...
[ 4, 5, 6, 7, 8 ]
##This script looks at a path for a dated file, then parses it by row into two different files/folders based on fields being blank within each row. import os.path from datetime import date ##sets date variables/format today = date.today() todayFormatted = today.strftime("%m%d%Y") print(todayFormatted) ##Se...
normal
{ "blob_id": "07a546928df1acfedf7a7735dc813de9da8373e0", "index": 1275, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(todayFormatted)\n<mask token>\nos.chdir(basepath)\nif not os.path.isfile(filename):\n print('File does not exist.')\nelse:\n with open(filename) as f:\n content = f.rea...
[ 0, 2, 3, 4, 5 ]
class DuplicatedBlockException(Exception): code = 'duplicated_block_exception'
normal
{ "blob_id": "983e3b2902fe3bc701167da2f308fdaed612ae84", "index": 1784, "step-1": "<mask token>\n", "step-2": "class DuplicatedBlockException(Exception):\n <mask token>\n", "step-3": "class DuplicatedBlockException(Exception):\n code = 'duplicated_block_exception'\n", "step-4": null, "step-5": null,...
[ 0, 1, 2 ]
#read file my_file=open("file.txt","r") #print(my_file.read()) #print(my_file.readline()) #print(my_file.read(3))#read 3 caracteres """ for line in my_file: print(line) my_file.close() """ print(my_file.readlines())#list #close file my_file.close() #create new file and writing new_file=open("newfile.txt",mode="w",...
normal
{ "blob_id": "d44f8a2dee35d76c152695d49d73f74e9c25bfa9", "index": 3015, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(my_file.readlines())\nmy_file.close()\n<mask token>\nfor i in range(5):\n new_file.write('new line ' + str(i + 1) + '\\n')\nnew_file.close()\n<mask token>\nnew_file.writelines(a)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Perpleksitet til news: %.2f' % perpNews) print('Perpleksitet til adventure: %.2f' % perpAdventure) <|reserved_special_token_0|> for sekvens in zippy: print('Ord: %4s Antall: %4d Sekvens: %.4f ' % (sekvens[0], sekvens[...
flexible
{ "blob_id": "d268f8d563aac28852457f6f130b2fb4ea6269a2", "index": 907, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Perpleksitet til news: %.2f' % perpNews)\nprint('Perpleksitet til adventure: %.2f' % perpAdventure)\n<mask token>\nfor sekvens in zippy:\n print('Ord: %4s Antall: %4d Sekvens: %...
[ 0, 1, 2, 3, 4 ]
"""Proper parenthetics extra credit kata.""" from _que_structure import Q def proper_parenthetics(string): """Return if parentheses are matching or not.""" if isinstance(string, str): paren_q = Q() for i in range(len(string)): paren_q.enqueue(string[i]) opening_parens = 0 ...
normal
{ "blob_id": "a28ece0db9bf0d4c3ab26207216b1da45f7aaa0f", "index": 7582, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef proper_parenthetics(string):\n \"\"\"Return if parentheses are matching or not.\"\"\"\n if isinstance(string, str):\n paren_q = Q()\n for i in range(len(string...
[ 0, 1, 2, 3 ]
import numpy,math,random from scipy.io.wavfile import write notes=[('c',32.7),('c#',34.65),('d',36.71),('d#',38.89),('e',41.2),('f',43.65), ('f#',46.25),('g',49),('g#',51.91),('a',55),('a#',58.27),('b',61.47)] #notes={'c':32.7,'c#':34.65,'d':36.71,'d#':38.89,'e':41.2,'f':43.65,'f#':46.25, # 'g':49,'g#':51.91,'a...
normal
{ "blob_id": "2ad1b44027b72499c1961f2d2b1c12c356c63d2b", "index": 5350, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_wave(freq, time=1, amp=1, phase=0, samplerate=44100, bitspersample=16\n ):\n bytelist = []\n TwoPiDivSamplerate = 2 * math.pi / samplerate\n increment = TwoPiDivS...
[ 0, 2, 3, 4, 5 ]
class ClickAction: Click = 0 DoubleClick = 1 class MouseButton: Left = 0 Right = 1 Middle = 2
normal
{ "blob_id": "cabebeb5ca02da2505df4a138e8b28f74dd108fa", "index": 4362, "step-1": "<mask token>\n\n\nclass MouseButton:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MouseButton:\n Left = 0\n Right = 1\n Middle = 2\n", "step-3": "class ClickAction:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Variable: def __init__(self, type_str: str, name: str): self.original_type = type_str self.__map_variable_type(type_str) self.name = name def __str__(self): return 'VariableDto name=' + self.name + ' type=' + str(self.type.name) def __m...
flexible
{ "blob_id": "434ec7791345ad869d8ce86aa1cdc08344203171", "index": 2028, "step-1": "<mask token>\n\n\nclass Variable:\n\n def __init__(self, type_str: str, name: str):\n self.original_type = type_str\n self.__map_variable_type(type_str)\n self.name = name\n\n def __str__(self):\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('将进行无限计算,请用Ctrl_C或其他方式强制退出!!!') input('按回车(Enter)键开始...') print('开始计算...,退出请用Ctrl_C或其他强制退出方式...') print(""" 实验次数 计算结果""") while 1: for i in range(num_halt): x = random.random() y = random.random() ...
flexible
{ "blob_id": "5d9afef2a748782659b82b329ea08d5815162cbc", "index": 3744, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('将进行无限计算,请用Ctrl_C或其他方式强制退出!!!')\ninput('按回车(Enter)键开始...')\nprint('开始计算...,退出请用Ctrl_C或其他强制退出方式...')\nprint(\"\"\"\n实验次数 计算结果\"\"\")\nwhile 1:\n for i in range(num_halt):\n...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-03-31 17:58 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('words', '0004_auto_20180330_0647'), ] operations = [ migrations.AddField( ...
normal
{ "blob_id": "e6884afaae15e903c62eecb3baec868548998080", "index": 2106, "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 = [('words', '00...
[ 0, 1, 2, 3, 4 ]
class Job: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Job: <|reserved_special_token_0|> def run(self, time_slice): self.duration -= time_slice <|reserved_special_token_0|> <|reserved_special_token_1|> c...
flexible
{ "blob_id": "cf7bd8aa9c92d1c3acb9ccc1658d66fa0e7a142d", "index": 3777, "step-1": "class Job:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Job:\n <mask token>\n\n def run(self, time_slice):\n self.duration -= time_slice\n <mask token>\n", "step-3": "class Job:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): plaintext = 'Hello World!' string = b'' for _ in range(random.randint(0, 10)): i = random.randint(33, 126) string += chr(i).encode() string += plaintext.encode() seed = random.randint(1, 2 ** 16) print('> Seed value coded to be', seed) ...
flexible
{ "blob_id": "66b7d928bc2c98a12f7adb8a375ced21edce8333", "index": 8492, "step-1": "<mask token>\n\n\ndef main():\n plaintext = 'Hello World!'\n string = b''\n for _ in range(random.randint(0, 10)):\n i = random.randint(33, 126)\n string += chr(i).encode()\n string += plaintext.encode()\n...
[ 1, 3, 4, 5, 6 ]
# Constructor without arguments class Demo: def __init__(self): print("\nThis is constructor") obj = Demo() # Constructor with arguments class Demo2: def __init__(self, number1, number2): sumOfNumbers = number1 + number2 print(sumOfNumbers) obj2 = Demo2(50,75...
normal
{ "blob_id": "b005f4657a1036044c2e6051207641fe621eb17e", "index": 8861, "step-1": "<mask token>\n\n\nclass Demo2:\n\n def __init__(self, number1, number2):\n sumOfNumbers = number1 + number2\n print(sumOfNumbers)\n\n\n<mask token>\n", "step-2": "class Demo:\n <mask token>\n\n\n<mask token>\n...
[ 2, 3, 4, 5, 6 ]
from django.conf.urls import url from . import views from .views import ShopView, ShopListView urlpatterns = [ url(r'^coffeeshops/(\d+)$', ShopView.as_view()), url(r'^coffeeshops$', ShopListView.as_view()), ]
normal
{ "blob_id": "54a705de2597140a72e47f5afe86614b619461b7", "index": 1109, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^coffeeshops/(\\\\d+)$', ShopView.as_view()), url(\n '^coffeeshops$', ShopListView.as_view())]\n", "step-3": "from django.conf.urls import url\nfrom . import view...
[ 0, 1, 2, 3 ]
import os from os import listdir from openpyxl import load_workbook, Workbook ROOT_PATH = os.getcwd() # print(f'ROOT_PATH : {ROOT_PATH}') CUR_PATH = os.path.dirname(os.path.abspath(__file__)) # print(f'CUR_PATH : {CUR_PATH}') path = f'{ROOT_PATH}/xlsx_files' files = listdir(path) result_xlsx = Workbook() result_sheet...
normal
{ "blob_id": "d23700f03e8498a5ff3d1d03d8808048ba79a56b", "index": 9381, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor myfile in files:\n if myfile[-4:] != 'xlsx':\n continue\n tg_xlsx = load_workbook(os.path.join(path, myfile), read_only=True)\n tg_sheet = tg_xlsx.active\n for row ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def bellman_ford(graph, start): distance = {} predecessor = {} for node in graph: distance[node] = INF predecessor[node] = None distance[start] = 0 for _ in range(len(graph) - 1): for node in graph: for neigbor in graph[node]: ...
flexible
{ "blob_id": "8ebf031cb294c69bf744d543b18783d6ac5ef257", "index": 1910, "step-1": "<mask token>\n\n\ndef bellman_ford(graph, start):\n distance = {}\n predecessor = {}\n for node in graph:\n distance[node] = INF\n predecessor[node] = None\n distance[start] = 0\n for _ in range(len(gra...
[ 1, 2, 3, 4, 5 ]
from flask import Flask, request, jsonify from flask_restful import Api import json import eth_account import algosdk app = Flask(__name__) api = Api(app) app.url_map.strict_slashes = False @app.route('/verify', methods=['GET','POST']) def verify(): content = request.get_json(silent=True, force=True) #Check i...
normal
{ "blob_id": "8bae45de54535e7b0788aa12717645ae9f193664", "index": 8113, "step-1": "<mask token>\n\n\n@app.route('/verify', methods=['GET', 'POST'])\ndef verify():\n content = request.get_json(silent=True, force=True)\n print(content)\n if content == None:\n return jsonify('No json data is sent.')\...
[ 1, 2, 3, 4, 5 ]
import random from turtle import Turtle colors = ["red", "blue", 'green', 'peru', 'purple', 'pink', 'chocolate', 'grey', 'cyan', 'brown'] class Food(Turtle): def __init__(self): super().__init__() self.shape("circle") self.penup() self.color("red") self.speed("fastest") ...
normal
{ "blob_id": "8adda42dfebd3f394a1026720465824a836c1dd1", "index": 7997, "step-1": "<mask token>\n\n\nclass Food(Turtle):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Food(Turtle):\n\n def __init__(self):\n super().__init__()\n self.shape('circle')\n self.pen...
[ 1, 3, 4, 5, 6 ]
from starter2 import * from collections import defaultdict import scipy import colors import hair_dryer reload(hair_dryer) import three_loopers_u500 as TL import movie_frames def GE_pearson(this_looper,core_list=None): if core_list is None: core_list = np.unique(this_looper.tr.core_ids) name = th...
normal
{ "blob_id": "0762c5bec2d796bb7888e3de45e29fb20f88f491", "index": 392, "step-1": "<mask token>\n\n\ndef GE_pearson(this_looper, core_list=None):\n if core_list is None:\n core_list = np.unique(this_looper.tr.core_ids)\n name = this_looper.sim_name\n thtr = this_looper.tr\n mask = movie_frames.q...
[ 1, 2, 3, 4, 5 ]
import sys import datetime training = False if (sys.argv[1]=='0') else True def read_file(filename): with open(filename) as f: aux = [str(x) for x in f.readline().split()] array = [] for line in f: # read rest of lines s=line.split() array2=[s[0]] + [float(x) for x in s[1:]] ar...
normal
{ "blob_id": "dd4892c5a0b675d1c97fb91a5ca8115801a2bbca", "index": 9034, "step-1": "\nimport sys\nimport datetime\n\ntraining = False if (sys.argv[1]=='0') else True\n\ndef read_file(filename):\n\n with open(filename) as f:\n aux = [str(x) for x in f.readline().split()]\n array = []\n for line in f: # re...
[ 0 ]
<|reserved_special_token_0|> class Blacklist(models.Model): class Meta: db_table = 'Blacklist' app_label = 'backlog' date_blacklisted = models.DateField(auto_now_add=True) pipeline_version = models.ForeignKey(Pipeline, on_delete=models.CASCADE) error = models.ForeignKey(StudyError, o...
flexible
{ "blob_id": "dff5e75460637cf175b1b65af3320d01dc2e35b6", "index": 2628, "step-1": "<mask token>\n\n\nclass Blacklist(models.Model):\n\n\n class Meta:\n db_table = 'Blacklist'\n app_label = 'backlog'\n date_blacklisted = models.DateField(auto_now_add=True)\n pipeline_version = models.Foreign...
[ 35, 36, 38, 45, 47 ]
from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score print(accuracy_score(true_labels, guesses)) print(recall_score(true_labels, guesses)) print(precision_score(true_labels, guesses)) print(f1_score(true_labels, guesses)) from sklearn.metrics import confusion_matrix print(confusion_matrix...
normal
{ "blob_id": "faa53db9dd581b6508fb9e4042ec86ebaf850e60", "index": 5320, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(accuracy_score(true_labels, guesses))\nprint(recall_score(true_labels, guesses))\nprint(precision_score(true_labels, guesses))\nprint(f1_score(true_labels, guesses))\n<mask token>\n...
[ 0, 1, 2 ]
class Node: def __init__(self, char = None): self.char = char self.children = [] self.end = False root = Node('*') curr = root # recursive insert into the trie def insert(s, curr): if curr.children and curr.children[0].char == s[0]: curr = curr.children[0] elif len(curr.chi...
normal
{ "blob_id": "37c42a5e52832c81660e88f45d93e6a9f0300de0", "index": 7654, "step-1": "class Node:\n\n def __init__(self, char=None):\n self.char = char\n self.children = []\n self.end = False\n\n\n<mask token>\n\n\ndef search(sequence):\n tmp_node = root\n found = False\n for letter ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def main(expt_set, chrom, checkpoint_code, dataset='val', model_list=[], directory=None): if directory is None: directory = output_dir model_list = sorted(model_list, key=extract_chrom_num) print('Using the following {} models'.format(len(model_list)), model_list) ...
flexible
{ "blob_id": "c6d61a0159073304309cd4b1534ed5aed666bab5", "index": 3666, "step-1": "<mask token>\n\n\ndef main(expt_set, chrom, checkpoint_code, dataset='val', model_list=[],\n directory=None):\n if directory is None:\n directory = output_dir\n model_list = sorted(model_list, key=extract_chrom_num)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def shell(cmd): subprocess.call(cmd, shell=True) print('Done! {0}.'.format(cmd)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def shell(cmd): subprocess.call(cmd, shell=True) print('Done! {0}.'.format(cmd)) <|reserved_spec...
flexible
{ "blob_id": "2a0172641c48c47f048bf5e9f1889b29abbb0b7c", "index": 767, "step-1": "<mask token>\n\n\ndef shell(cmd):\n subprocess.call(cmd, shell=True)\n print('Done! {0}.'.format(cmd))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef shell(cmd):\n subprocess.call(cmd, shell=True)\n print('Done...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class JoinCondition: primaryjoin_initial: Optional[ColumnElement[bool]] primaryjoin: ColumnElement[bool] secondaryjoin: Optional[ColumnElement[bool]] secondary: Optional[FromClause] prop: RelationshipProperty[Any] synchronize_pairs: _ColumnPairs secondary_synch...
flexible
{ "blob_id": "5f8303ce91c5de779bbddbaafb3fb828596babe5", "index": 8669, "step-1": "<mask token>\n\n\nclass JoinCondition:\n primaryjoin_initial: Optional[ColumnElement[bool]]\n primaryjoin: ColumnElement[bool]\n secondaryjoin: Optional[ColumnElement[bool]]\n secondary: Optional[FromClause]\n prop: ...
[ 44, 79, 88, 99, 100 ]
<|reserved_special_token_0|> def Print(text): if text is None or len(text) == 0: print('invalid text.') print('--------------------------------------------------------------') return text_set = set() for i in text: text_set.add(i) if len(text_set) == 1: print('i...
flexible
{ "blob_id": "bcdd36b534fd3551de9cb40efc11581f4d95a002", "index": 9717, "step-1": "<mask token>\n\n\ndef Print(text):\n if text is None or len(text) == 0:\n print('invalid text.')\n print('--------------------------------------------------------------')\n return\n text_set = set()\n ...
[ 5, 7, 8, 9, 10 ]
from functools import update_wrapper from django.db import models # Create your models here. class Product(models.Model): product_id=models.AutoField product_name=models.CharField(max_length=50) category=models.CharField(max_length=50,default="") subcategory=models.CharField(max_length=50,default="")...
normal
{ "blob_id": "d123083358a4fd69f6f8de27fa177afac3bf80ce", "index": 5680, "step-1": "<mask token>\n\n\nclass Contact(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name\n\n\nclass Order(models.Model):\n order...
[ 7, 9, 11, 12, 13 ]
<|reserved_special_token_0|> class TestLengthPreservingCipher: def test_Functionality(self): key = base64.urlsafe_b64encode(os.urandom(16)) lpc = LengthPreservingCipher(key, 10) for i in xrange(20): msg = os.urandom(6) assert lpc.decrypt(lpc.encrypt(msg)) == msg ...
flexible
{ "blob_id": "2464da1c4d2ddab3a053f0a14e3cc9a8beabe031", "index": 6031, "step-1": "<mask token>\n\n\nclass TestLengthPreservingCipher:\n\n def test_Functionality(self):\n key = base64.urlsafe_b64encode(os.urandom(16))\n lpc = LengthPreservingCipher(key, 10)\n for i in xrange(20):\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def addnumber(i, j): sum = i + j print(sum) <|reserved_special_token_0|> <|reserved_special_token_1|> def addnumber(i, j): sum = i + j print(sum) num1 = int(input('Enter 1st number')) num2 = int(input('Enter 2nd number')) z = addnumber(...
flexible
{ "blob_id": "2350c2ab05499f1b40ba61f2101c51d9581d57f6", "index": 8668, "step-1": "<mask token>\n", "step-2": "def addnumber(i, j):\n sum = i + j\n print(sum)\n\n\n<mask token>\n", "step-3": "def addnumber(i, j):\n sum = i + j\n print(sum)\n\n\nnum1 = int(input('Enter 1st number'))\nnum2 = int(inp...
[ 0, 1, 2, 3 ]
import logging import datetime import numpy as np def log_players(game_map): logging.debug("------Players Info------") for player in game_map.all_players(): logging.debug("-----Player ID: {}-----".format(player.id)) for ship in player.all_ships(): logging.debug("----Ship ID: {}----"...
normal
{ "blob_id": "879bb8d67c0e1e8b125ac5994fcb142e3366c9d8", "index": 9094, "step-1": "<mask token>\n\n\ndef log_all_ships(myMap):\n logging.debug('Logging all ships:')\n for ship_id, ship in myMap.data_ships[myMap.my_id].items():\n logging.debug('ship_id: {}'.format(ship_id))\n for k, v in ship.i...
[ 3, 6, 7, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse', 'apply_running_rect', 'nb_tools', 'matrices', 'running'] <|reserved_special_token_1|> from . import metrics from . import matrices from .pairwise import ...
flexible
{ "blob_id": "3605e8b8b2f8f49cc7c40fc436c147578b12091c", "index": 6026, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse',\n 'apply_running_rect', 'nb_tools', 'matrices', 'running']\n", "step-3": "from . import metrics\nfrom . import m...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def multiply(value): return value * 5 <|reserved_special_token_0|> <|reserved_special_token_1|> def multiply(value): return value * 5 if __name__ == '__main__': a = [0, 1, 2, 3, 4, 5] new_empty_list = [] print(a) for item in a: ...
flexible
{ "blob_id": "0778b25363d50e699edf48b92f1104ab57c03172", "index": 2015, "step-1": "<mask token>\n", "step-2": "def multiply(value):\n return value * 5\n\n\n<mask token>\n", "step-3": "def multiply(value):\n return value * 5\n\n\nif __name__ == '__main__':\n a = [0, 1, 2, 3, 4, 5]\n new_empty_list ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def read_country_code(): """ 获取国家中英文字典 :return: """ country_dict = {} for key, val in namemap.nameMap.items(): country_dict[val] = key return country_dict def read_csv(): """ 读取数据,返回国家英文名称列表和累计确诊数列表 :return: """ country_dict = read...
flexible
{ "blob_id": "fe3584dd858c06d66215b4a182adf87d35324975", "index": 4486, "step-1": "<mask token>\n\n\ndef read_country_code():\n \"\"\"\n 获取国家中英文字典\n :return:\n \"\"\"\n country_dict = {}\n for key, val in namemap.nameMap.items():\n country_dict[val] = key\n return country_dict\n\n\ndef...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', views.IndexView.as_view(), name='index'), url( '^login/$', views.LoginFormView.as_view(), name='login'), url( '^logout/$', views.LogoutFormView.as_view(), name='logout'), url( '^register/$', vi...
flexible
{ "blob_id": "3ea123aceb72e4731afe98cf4c5beced2d424035", "index": 3302, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.IndexView.as_view(), name='index'), url(\n '^login/$', views.LoginFormView.as_view(), name='login'), url(\n '^logout/$', views.LogoutFormView.as_view(...
[ 0, 1, 2, 3 ]
a = [5, 4, 3, 2, 1] a = [1, 2, 3, 7, 5, 6, 4, 8, 9] import time sorted = True for i in range(0, len(a)): print('main') sorted = True for j in range(1, len(a) - i): if a[j] < a[j - 1]: a[j], a[j - 1] = a[j - 1], a[j] print('inner') print(a) time.sleep(1...
normal
{ "blob_id": "30fbe52a5e3fb184a998fce43d716cffdaf0d2dc", "index": 1790, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, len(a)):\n print('main')\n sorted = True\n for j in range(1, len(a) - i):\n if a[j] < a[j - 1]:\n a[j], a[j - 1] = a[j - 1], a[j]\n ...
[ 0, 1, 2, 3 ]
import glob import html import os import re import sys import textwrap from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union import pycountry import requests from pyd2v import D2V from pymediainfo import MediaInfo, Track from pynfogen.formatter import CustomFormats class NFO: AUDIO...
normal
{ "blob_id": "e434d5519e3ba4255ed928769070de391cb0955b", "index": 3462, "step-1": "<mask token>\n\n\nclass NFO:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self) ->str:\n return '<{c} {attrs}>'.format(c=self.__class__.__name__, attrs=' '.\n ...
[ 14, 16, 18, 19, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def multiplicaciones(): """ Funcion se encargara de crear las multiplicaciones entre 999 y 100 mediante dos ciclos for. """ ultimo_palindromo = 0 total = 0 for primer_numero in range(100, 1000): ...
flexible
{ "blob_id": "45f9d5ac0fa7d9259c1d53b92c030559f3bfda89", "index": 7161, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef multiplicaciones():\n \"\"\"\n Funcion se encargara de crear las multiplicaciones entre 999 y 100\n\n mediante dos ciclos for.\n \"\"\"\n ultimo_palindromo = 0\n ...
[ 0, 1, 2, 3, 4 ]
# 001. 웹 서버에 요청하고 응답받기 # 학습 내용 : 웹 서버에 접속하여 웹 페이지 정보를 요청하고 서버로부터 응답 객체를 받는 과정을 이해한다. # 힌트 내용 : requests 모듈의 get() 함수에 접속하려는 웹 페이지의 주소(URL)를 입력한다. import requests url = "https://www.python.org/" resp = requests.get(url) print(resp) # 200, 정상 동작 url2 = "https://www.python.org/1" resp2 = requests.get(url2) print(resp2)...
normal
{ "blob_id": "1af73c0ca38ea32119f622dc14741c0bb0aa08fd", "index": 6344, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(resp)\n<mask token>\nprint(resp2)\n", "step-3": "<mask token>\nurl = 'https://www.python.org/'\nresp = requests.get(url)\nprint(resp)\nurl2 = 'https://www.python.org/1'\nresp2 = r...
[ 0, 1, 2, 3, 4 ]
""" AlbumInfo-related frames for the Album view. """ from __future__ import annotations import logging from typing import TYPE_CHECKING, Iterator, Collection, Any from ds_tools.caching.decorators import cached_property from tk_gui.elements import Element, HorizontalSeparator, Multiline, Text, Input, Image, Spacer fr...
normal
{ "blob_id": "384588e1a767081191228db2afa4a489f967a220", "index": 3952, "step-1": "\"\"\"\nAlbumInfo-related frames for the Album view.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport logging\nfrom typing import TYPE_CHECKING, Iterator, Collection, Any\n\nfrom ds_tools.caching.decorators import cached_pro...
[ 0 ]
__all__ = ["AddonsRepository", "Addon", "Addons", "Utils"]
normal
{ "blob_id": "054d7e4bd51110e752a18a5c0af4432a818ef3b8", "index": 7974, "step-1": "<mask token>\n", "step-2": "__all__ = ['AddonsRepository', 'Addon', 'Addons', 'Utils']\n", "step-3": "__all__ = [\"AddonsRepository\", \"Addon\", \"Addons\", \"Utils\"]", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
class Boundary(): def __init__(self, py5_inst, x1, y1, x2, y2): self.py5 = py5_inst self.a = self.py5.create_vector(x1, y1) self.b = self.py5.create_vector(x2, y2) def show(self): self.py5.stroke(255) self.py5.line(self.a.x, self.a.y, self.b.x, self.b.y)
normal
{ "blob_id": "df00cc501b7b682cc1f4fbc9ae87a27984e6b5ef", "index": 5424, "step-1": "<mask token>\n", "step-2": "class Boundary:\n <mask token>\n <mask token>\n", "step-3": "class Boundary:\n <mask token>\n\n def show(self):\n self.py5.stroke(255)\n self.py5.line(self.a.x, self.a.y, se...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def onImport(): mypath = '../../data/roget_processed' onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] for f_name in onlyfiles: f_temp = open(mypath + '/' + f_name) f_lines = f_temp.readlines() for line in f_lines: parts =...
flexible
{ "blob_id": "b1b9840fabc96c901e5ed45e22ee63af2f3550cb", "index": 8643, "step-1": "<mask token>\n\n\ndef onImport():\n mypath = '../../data/roget_processed'\n onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]\n for f_name in onlyfiles:\n f_temp = open(mypath + '/' + f_name)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': module = importlib.import_module('UserFile') print(module.if_new_message) print(module.ID) <|reserved_special_token_1|> import importlib if __name__ == '__main__': module = importlib.i...
flexible
{ "blob_id": "8a773448383a26610f4798e12fb514248e71dc4b", "index": 698, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n module = importlib.import_module('UserFile')\n print(module.if_new_message)\n print(module.ID)\n", "step-3": "import importlib\nif __name__ == '__ma...
[ 0, 1, 2 ]
import os import numpy as np import nibabel as nib def loop_access(n,m,data,tpl): if n >m: return loop_access(n,m+1,data[tpl[m]],tpl) else: return data[tpl[m]] def loop_rec(n,m,mapCoords,dims,data,tple): if n >= m: for x in range(dims[m]): loop_rec(n,m+1,mapCoords,dims,...
normal
{ "blob_id": "55b4448caa73bcb50a15eb46d07328934fce72c8", "index": 7029, "step-1": "<mask token>\n\n\ndef loop_rec(n, m, mapCoords, dims, data, tple):\n if n >= m:\n for x in range(dims[m]):\n loop_rec(n, m + 1, mapCoords, dims, data, tple + (x,))\n else:\n temp = loop_access(len(dim...
[ 1, 2, 3, 4, 5 ]
import abc import math import random from typing import Union, Tuple import numpy as np from scipy import stats from . import Rectangle, Line, Point, Shape __all__ = ['get_critical_angle', 'Paddle', 'Ball', 'Snell', 'Canvas'] EPSILON = 1e-7 def get_critical_angle(s0: float, s1: float) -> Union[float, None]: "...
normal
{ "blob_id": "42d2be7544d2afb9580841422ae35e1a5621df52", "index": 6459, "step-1": "<mask token>\n\n\nclass TrajectoryRectangle(TrajectoryBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def top_left(self) ->Line:\n \"\"\"\n Line representing the tr...
[ 46, 51, 75, 76, 83 ]
''' MDSANIMA Setup ''' import sys import pathlib from setuptools import setup, find_packages HERE = pathlib.Path(__file__).parent CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 6) # This check and everything above must remain compatible with Python 2.7. if CURRENT_PYTHON < REQUIRED_PYTHON: sys.stde...
normal
{ "blob_id": "2827a56c12c1e15a6fe26ce182aa07d76735d77f", "index": 407, "step-1": "<mask token>\n", "step-2": "<mask token>\nif CURRENT_PYTHON < REQUIRED_PYTHON:\n sys.stderr.write(\n \"\"\"==========================\nUnsupported Python Version\n==========================\nThis version of MDSANIMA requ...
[ 0, 1, 2, 3, 4 ]
# -*-coding:utf-8 -*- # # Created on 2016-04-01 # __ __ # - /__) _ /__) __/ # / / ( (/ / ( / # / from core.views import BaseView class TestView(BaseView): """ 测试页面 """ # template_name = 'test/blog-1.html' template_name = 'test/music-1.html'
normal
{ "blob_id": "dc2b074d7d0e87105b2479bb60b46c73dce6c069", "index": 6113, "step-1": "<mask token>\n\n\nclass TestView(BaseView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestView(BaseView):\n <mask token>\n template_name = 'test/music-1.html'\n", "step-3": "<mask token>\n...
[ 1, 2, 3, 4, 5 ]
print ("hello") print ("===================================================") print ("Nama Lengkap : Agung Dharmawan") print ("Kelas : Teknik Informatika 2018 A") print ("Kampus : Universitas Nahdlatul Ulama Sidoarjo") print ("===================================================")
normal
{ "blob_id": "4e10bc876797d0939c91cff5eff497b36af35dcb", "index": 1932, "step-1": "<mask token>\n", "step-2": "print('hello')\nprint('===================================================')\nprint('Nama Lengkap : Agung Dharmawan')\nprint('Kelas : Teknik Informatika 2018 A')\nprint('Kampus : Universit...
[ 0, 1, 2 ]
__author__ = 'liwenchang' #-*- coding:utf-8 -*- import os import time import win32api, win32pdhutil, win32con, win32com.client import win32pdh, string def check_exsit(process_name): WMI = win32com.client.GetObject('winmgmts:') processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % pro...
normal
{ "blob_id": "bb6d6061365fad809448d09a1c031b984423b5e0", "index": 8658, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_exsit(process_name):\n WMI = win32com.client.GetObject('winmgmts:')\n processCodeCov = WMI.ExecQuery(\n 'select * from Win32_Process where Name=\"%s\"' % proces...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class HrCnpsSettings(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|> <|reserved_special_token_0|> <|reserved_special...
flexible
{ "blob_id": "4f7b689c06383673b510092932b051c644306b84", "index": 3500, "step-1": "<mask token>\n\n\nclass HrCnpsSettings(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass HrCnpsCotisationLineTe...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Sun Jan 28 12:54:27 2018 @author: Alex """ import numpy as np def saveListToCSV(filepath, _list): with open(filepath,'ab') as f: np.savetxt(f, [_list], delimiter=',', fmt='%f')
normal
{ "blob_id": "555f4e41661ff4cbf4b9d72feab41ca8b7da2d5f", "index": 750, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef saveListToCSV(filepath, _list):\n with open(filepath, 'ab') as f:\n np.savetxt(f, [_list], delimiter=',', fmt='%f')\n", "step-3": "<mask token>\nimport numpy as np\n\n\...
[ 0, 1, 2, 3 ]
from flask import Blueprint class NestableBlueprint(Blueprint): def register_blueprint(self, blueprint, **options): def deferred(state): # state.url_prefix => 自己url前缀 + blueprint.url_prefix => /v3/api/cmdb/ url_prefix = (state.url_prefix or u"") + (options.get('url_prefix', bluepri...
normal
{ "blob_id": "2c505f3f1dfdefae8edbea0916873229bcda901f", "index": 764, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NestableBlueprint(Blueprint):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NestableBlueprint(Blueprint):\n\n def register_blueprint(self, blueprint, **options):\...
[ 0, 1, 2, 3, 4 ]
__author__ = 'ldd' # -*- coding: utf-8 -*- from view.api_doc import handler_define, api_define, Param from view.base import BaseHandler,CachedPlusHandler @handler_define class HelloWorld(BaseHandler): @api_define("HelloWorld", r'/', [ ], description="HelloWorld") def get(self): self.write({'st...
normal
{ "blob_id": "3c738a07d71338ab838e4f1d683e631252d50a30", "index": 4085, "step-1": "<mask token>\n\n\n@handler_define\nclass HelloWorld(BaseHandler):\n <mask token>\n", "step-2": "<mask token>\n\n\n@handler_define\nclass HelloWorld(BaseHandler):\n\n @api_define('HelloWorld', '/', [], description='HelloWorl...
[ 1, 2, 3, 4, 5 ]