code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# 문제 설명 # 길이가 같은 두 1차원 정수 배열 a, b가 매개변수로 주어집니다. a와 b의 내적을 return 하도록 solution 함수를 완성해주세요. # 이때, a와 b의 내적은 a[0]*b[0] + a[1]*b[1] + ... + a[n-1]*b[n-1] 입니다. (n은 a, b의 길이) # 제한사항 # a, b의 길이는 1 이상 1,000 이하입니다. # a, b의 모든 수는 -1,000 이상 1,000 이하입니다. # 입출력 예 # a b result # [1,2,3,4] [-3,-1,0,2] 3 # [-1,0,1] [1,0,-1] -2 # 입출력...
normal
{ "blob_id": "5b8322761975ebec76d1dccd0290c0fb1da404e5", "index": 5999, "step-1": "<mask token>\n\n\ndef solution2(a, b):\n answer = [(a[i] * b[i]) for i in range(len(a))]\n return sum(answer)\n\n\n<mask token>\n\n\ndef solution5(a, b):\n answer = sum([(i * j) for i, j in zip(a, b)])\n return answer\n...
[ 2, 3, 4, 5, 6 ]
from data.dataframe_sequence_multi import DataFrameSequenceMulti from metrics import Metrics from models.models_ts_multi import lstm_model_multi import threading import sys from keras import optimizers from data.data_helper import plot_history epochs = 100 start = 6 end = 18 res = [] sets = [] min_vals = [] min_loss ...
normal
{ "blob_id": "af903feda57e4ace0c7f909abbeb86bb9a7e4d8c", "index": 1806, "step-1": "<mask token>\n\n\ndef run_final_test_days():\n sqs = [5]\n cams = [1]\n permutations = [(True, True, True)]\n permutations_names = ['all data perez']\n for pidx, p in enumerate(permutations):\n for s in sqs:\n...
[ 3, 5, 7, 8, 9 ]
<|reserved_special_token_0|> def upgrade(): op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('firstname', sa.String(length=64), nullable=True), sa. Column('lastname', sa.String(length=64), nullable=True), sa.Column( 'email', sa.String(length=120), nullable=...
flexible
{ "blob_id": "9989d31dfe13809d67f629cc283cd02ce354a74e", "index": 115, "step-1": "<mask token>\n\n\ndef upgrade():\n op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),\n sa.Column('firstname', sa.String(length=64), nullable=True), sa.\n Column('lastname', sa.String(length=64)...
[ 1, 2, 3, 4, 5 ]
from rest_framework import serializers from urlshortner.models import UrlShortnerModel from urlshortner.constants import HOST class UrlShortRequest(serializers.Serializer): url = serializers.CharField(required=True, max_length=255) # Long Url expiry = serializers.DateTimeField(required=False) class UrlLong...
normal
{ "blob_id": "6c16afe89d5d0fd6aa6911e3de9e9cebb57bf35e", "index": 1752, "step-1": "<mask token>\n\n\nclass UrlLongRequest(serializers.Serializer):\n url = serializers.CharField(required=True, max_length=64)\n\n def validate_url(self, url):\n if url.startswith(HOST):\n return url\n e...
[ 4, 5, 6, 7, 8 ]
import json import boto3 import os import datetime regionName = os.environ['AWS_REGION'] BUCKET_PATH = os.environ['BUCKET_PATH'] SENSITIVIT = os.environ['SENSITIVIT'] s3_client = boto3.client('s3', region_name=regionName) ddb_resource = boto3.resource('dynamodb', region_name=regionName) def lambda_handler(event, co...
normal
{ "blob_id": "8c96c38a67c2eb97e30b325e4917ba4888731118", "index": 7349, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n body = event\n videoPath = str(body['videoPath'])\n templatePath = str(body['templatePath'])\n facePath = str(body['facePath'])\n ...
[ 0, 1, 2, 3, 4 ]
# RUSH HOUR m = int(input('Enter number of males:')) f = int(input('Enter number of females:')) if m%20 == 0: m2 = m//20 c = 20 else: m2 = m//20+1 c = m%20 f2 = f - 10*m2 if f2 <= 0 or f2-(20-c) <=0: print('Number of trains needed: '+str(m2)) else: print('Number of trains ...
normal
{ "blob_id": "3c6ef57501e01da79f894b36726a93a3a5e0a8f6", "index": 8068, "step-1": "<mask token>\n", "step-2": "<mask token>\nif m % 20 == 0:\n m2 = m // 20\n c = 20\nelse:\n m2 = m // 20 + 1\n c = m % 20\n<mask token>\nif f2 <= 0 or f2 - (20 - c) <= 0:\n print('Number of trains needed: ' + str(m2...
[ 0, 1, 2, 3 ]
def main(): ' main entry point for module execution\n ' argument_spec = dict(src=dict(type='path'), replace_src=dict(), lines=dict(aliases=['commands'], type='list'), parents=dict(type='list'), before=dict(type='list'), after=dict(type='list'), match=dict(default='line', choices=['line', 'strict', 'exact', '...
normal
{ "blob_id": "99b5ac74da95dff399c31d58e19bac65e538a34b", "index": 8012, "step-1": "<mask token>\n", "step-2": "def main():\n \"\"\" main entry point for module execution\n \"\"\"\n argument_spec = dict(src=dict(type='path'), replace_src=dict(), lines=\n dict(aliases=['commands'], type='list'), p...
[ 0, 1, 2 ]
# Generated by Django 2.1.5 on 2021-06-01 19:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('fotbal', '0008_auto_20210601_2109'), ] operations = [ migrations.RemoveField( model_name='komenty', name='jmeno', ),...
normal
{ "blob_id": "71ffad81bcbc480dc0a750680bc72e1d5c48556a", "index": 3619, "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 = [('fotbal', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Meetup: <|reserved_special_token_0|> def check_if_meetup_exists(self, topic): query = 'SELECT topic from meetups WHERE topic=%s;' cur.execute(query, (topic,)) meetup = cur.fetchone() if meetup: return True <|reserved_special_t...
flexible
{ "blob_id": "275f8b6ac31792a9e4bb823b61366f868e45ef4e", "index": 6521, "step-1": "<mask token>\n\n\nclass Meetup:\n <mask token>\n\n def check_if_meetup_exists(self, topic):\n query = 'SELECT topic from meetups WHERE topic=%s;'\n cur.execute(query, (topic,))\n meetup = cur.fetchone()\n...
[ 4, 7, 8, 9, 10 ]
import re def make_slug(string): print(re.sub(^'\w','',string)) make_slug('#$gejcb#$evnk?.kjb')
normal
{ "blob_id": "41e981e2192b600cdf9c9b515fe9f397cd1b8826", "index": 5788, "step-1": "import re\n\ndef make_slug(string):\n print(re.sub(^'\\w','',string))\n \nmake_slug('#$gejcb#$evnk?.kjb')\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
class _ProtectedClass: pass class MyClass: pass class OtherClass(MyClass): pass def _protected_fun() -> MyClass: return variable # noqa: F821 def my_fun() -> MyClass: return variable # noqa: F821 def my_fun2() -> MyClass: return variable # noqa: F821 variable: MyClass variable_wit...
normal
{ "blob_id": "b5949b40d731178bdbab776af8877921dcdfbf15", "index": 3215, "step-1": "class _ProtectedClass:\n pass\n\n\nclass MyClass:\n pass\n\n\nclass OtherClass(MyClass):\n pass\n\n\ndef _protected_fun() ->MyClass:\n return variable\n\n\n<mask token>\n\n\ndef my_fun2() ->MyClass:\n return variable...
[ 5, 6, 7, 8, 9 ]
from binaryninja import * import yara def get_yara_rule_path(): return get_open_filename_input("Open YARA rule", "YARA rules (*.yar *.yara)") def get_markdown_result(matches): entry_fmt = "| {} | {} | {} |\n" md_text = """# YARA - Scan results | Rule Name | Function | Strings offsets | |-----------|----------|---...
normal
{ "blob_id": "56d4532b633242f34f7a6ed86a35290836861f67", "index": 4201, "step-1": "<mask token>\n\n\ndef get_markdown_result(matches):\n entry_fmt = '| {} | {} | {} |\\n'\n md_text = \"\"\"# YARA - Scan results\n\n| Rule Name | Function | Strings offsets |\n|-----------|----------|-----------------|\n\"\"\"...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "fac60a8967354e4f306b95fdb5c75d02dc2c1455", "index": 2247, "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 = [('chat', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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]) open...
flexible
{ "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 json import requests import itertools import logging from shared_code.config.setting import Settings from TailwindTraderFunc.cognitiveservices import CognitiveServices from shared_code.storage.storage import BlobStorageService class TailwindTraders(): def __init__(self, req): self._settings = Sett...
normal
{ "blob_id": "75ba2448897bed8388a7b8d876827461e1bc9dd7", "index": 2809, "step-1": "<mask token>\n\n\nclass TailwindTraders:\n\n def __init__(self, req):\n self._settings = Settings()\n self._cs = CognitiveServices()\n self._storage = BlobStorageService(self._settings.\n get_stor...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(models.Comentario) <|reserved_special_token_1|> from django.contrib import admin from . import models admin.site.register(models.Comentario) <|reserved_special_token_1|> from django.contrib import admin f...
flexible
{ "blob_id": "d7d94cfed0b819297069c3434c70359a327403cd", "index": 718, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(models.Comentario)\n", "step-3": "from django.contrib import admin\nfrom . import models\nadmin.site.register(models.Comentario)\n", "step-4": "from django.contrib ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def uncommonFromSentences(self, A: str, B: str) ->List[str]: word_count = {} A = A.split() B = B.split() whole = A + B ...
flexible
{ "blob_id": "09420360ddcf2f74c2e130b4e09ae2a959e42e50", "index": 8305, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def uncommonFromSentences(self, A: str, B: str) ->List[str]:\n word_count = {}\n A = A.split()\n B = B.spl...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): book_list = book.objects.all() c = Context({'book_list': book_list}) return render_to_response('index.html', c) <|reserved_special_token_1|> from django.http import HttpResponse from django.sho...
flexible
{ "blob_id": "441d224c37e0eae531c17db0e903b3344c570516", "index": 9867, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n book_list = book.objects.all()\n c = Context({'book_list': book_list})\n return render_to_response('index.html', c)\n", "step-3": "from django.http im...
[ 0, 1, 2, 3 ]
# -*- snakemake -*- # # CENTIPEDE: Transcription factor footprinting and binding site prediction # install.packages("CENTIPEDE", repos="http://R-Forge.R-project.org") # # http://centipede.uchicago.edu/ # include: '../ngs.settings.smk' config_default = { 'bio.ngs.motif.centipede' : { 'options' : '', ...
normal
{ "blob_id": "4620b52a43f2469ff0350d8ef6548de3a7fe1b55", "index": 5019, "step-1": "<mask token>\n", "step-2": "include: '../ngs.settings.smk'\n<mask token>\nupdate_config(config_default, config)\n<mask token>\n", "step-3": "include: '../ngs.settings.smk'\nconfig_default = {'bio.ngs.motif.centipede': {'options...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): tools.unpack.main() util.files.main() util.dark.main() util.flat.main() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): tools.unpack.main(...
flexible
{ "blob_id": "3667651697ac1c093d48fe2c4baa4b4dbdf20f8a", "index": 6832, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n tools.unpack.main()\n util.files.main()\n util.dark.main()\n util.flat.main()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n tools.unp...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Mon Mar 6 12:20:45 2017 @author: 7 """ from os import listdir from PIL import Image as PImage from scipy import misc import numpy as np from Image_loader import LoadImages """ def LoadImages(path): # return array of images imagesList = listdir(path) ...
normal
{ "blob_id": "9cad36de6231f310ef9022f16f6ed0da83a003b3", "index": 9757, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ModifyImages(path, path1):\n imagesList = listdir(path)\n for image in imagesList:\n old_img = PImage.open(path + image)\n old_size = old_img.size\n new...
[ 0, 1, 2, 3 ]
#coding: utf-8 import logging from threading import Thread from ldap import SCOPE_BASE from seafevents.ldap_syncer.ldap_conn import LdapConn from seafevents.ldap_syncer.utils import bytes2str, add_group_uuid_pair from seaserv import get_group_dn_pairs logger = logging.getLogger(__name__) def migrate_dn_pairs(set...
normal
{ "blob_id": "8cc0393082448bb8f61068b5c96e89ef3aee77ed", "index": 235, "step-1": "<mask token>\n\n\nclass LdapSync(Thread):\n\n def __init__(self, settings):\n Thread.__init__(self)\n self.settings = settings\n\n def run(self):\n if self.settings.enable_group_sync:\n migrate_...
[ 9, 10, 11, 12, 13 ]
""" Authentication views. login() Flask view to log a user in. """ import functools from typing import Any, Callable, cast, Dict from flask import Blueprint, make_response, request, session from werkzeug.security import check_password_hash as _check_password_hash from .accesscontrol import PERMISSIONS from .api...
normal
{ "blob_id": "2d36ae916ad257615016ed6c0bc67e506ee313c9", "index": 1528, "step-1": "<mask token>\n\n\n@bp.route('/login', methods=('POST',))\ndef login() ->Any:\n \"\"\"Flask view for logging a user in.\"\"\"\n user_dict = UserSchema().load(request.json, partial=('id',\n 'qualifications') + PERMISSION...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def fibonacci(quantidade): resultado = [1, 2] for _ in range(2, quantidade): resultado.append(sum(resultado[-2:])) return resultado <|reserved_special_token_0|> <|reserved_special_token_1|> def fibonacci(quantidade): resultado = [...
flexible
{ "blob_id": "83c7bb2e109f8affd9e2a12e8c5370b0f5a34048", "index": 653, "step-1": "<mask token>\n", "step-2": "def fibonacci(quantidade):\n resultado = [1, 2]\n for _ in range(2, quantidade):\n resultado.append(sum(resultado[-2:]))\n return resultado\n\n\n<mask token>\n", "step-3": "def fibonac...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('speaker_book.txt') as fin: for line in fin: elems = line.split('|') ID = elems[0].lstrip().strip() speaker = elems[1].lstrip().strip() subset = elems[3].lstrip().strip() book ...
flexible
{ "blob_id": "3b41bd59c133bb04dae3aa48dc0699388d5bf3d4", "index": 8346, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('speaker_book.txt') as fin:\n for line in fin:\n elems = line.split('|')\n ID = elems[0].lstrip().strip()\n speaker = elems[1].lstrip().strip()\n ...
[ 0, 1, 2, 3, 4 ]
import numpy as np def layer_forward(x, w): """ input: - inputs (x): (N, d_1, ..., d_k), - weights (w): (D, M) """ # intermediate value (z) z = None output = [] cache = (x, w, z, output) return output, cache def layer_backward(d_output, cache): """ Re...
normal
{ "blob_id": "c1fd6e940b3b15ae01a102b3c0aba9bd327c77b2", "index": 8403, "step-1": "<mask token>\n\n\ndef layer_forward(x, w):\n \"\"\"\n input:\n - inputs (x): (N, d_1, ..., d_k),\n - weights (w): (D, M)\n \"\"\"\n z = None\n output = []\n cache = x, w, z, output\n r...
[ 4, 5, 6, 7, 8 ]
__author__ = "Prikly Grayp" __license__ = "MIT" __version__ = "1.0.0" __email__ = "priklygrayp@gmail.com" __status__ = "Development" from contextlib import closing class RefrigeratorRaider: '''Raid a refrigerator''' def open(self): print('Open fridge door.') def take(self, food): print('...
normal
{ "blob_id": "7455eb670c2c019b8d066fcc6f2878a2136b7fd0", "index": 5051, "step-1": "<mask token>\n\n\nclass RefrigeratorRaider:\n \"\"\"Raid a refrigerator\"\"\"\n\n def open(self):\n print('Open fridge door.')\n\n def take(self, food):\n print('Finding {}...'.format(food))\n if food ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def valid_date(datestring): """ Determine if something is a valid date """ try: datetime.strptime(datestring, '%Y-%m-%d') return True except ValueError as e: logger.info('not a valid date: ' + e) return False def portfolio_value_on_date(date):...
flexible
{ "blob_id": "0bc72a558b9bd3b5f74ce5dfce586dd66c579710", "index": 5776, "step-1": "<mask token>\n\n\ndef valid_date(datestring):\n \"\"\" Determine if something is a valid date \"\"\"\n try:\n datetime.strptime(datestring, '%Y-%m-%d')\n return True\n except ValueError as e:\n logger....
[ 4, 5, 6, 7, 8 ]
# coding=utf8 from __future__ import print_function from application.controllers import * from application.models import board def __return__(): return render_template('board/board.html', lecturers = board.Lecturer.query.all(), disciplines = board.Discipline.query.all()) def __return_modal__(id): le...
normal
{ "blob_id": "f87c036c1eb5026e088bed62fbc330cfd2ea1952", "index": 7500, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef __return_modal__(id):\n lecturer = board.Lecturer.query.get(id)\n print('esdasd' + lecturer.description)\n return render_template('board/modal.html', lecturer=lecturer)\n...
[ 0, 1, 2, 3, 4 ]
from app.api import app def main(): app.run(host='0.0.0.0', port=5001) if __name__ == '__main__': main()
normal
{ "blob_id": "b49e5b40ce1e16f1b7c0bd9509daf94f36c51256", "index": 6726, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\nif __name__ == '__mai...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(num1) <|reserved_special_token_1|> <|reserved_special_token_0|> num1 = random.randint(50, 151) print(num1) <|reserved_special_token_1|> <|reserved_special_token_0|> import random num1 = random.randint(50, 151) print(nu...
flexible
{ "blob_id": "7d3355ee775f759412308ab68a7aa409b9c74b20", "index": 708, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num1)\n", "step-3": "<mask token>\nnum1 = random.randint(50, 151)\nprint(num1)\n", "step-4": "<mask token>\nimport random\nnum1 = random.randint(50, 151)\nprint(num1)\n", "step...
[ 0, 1, 2, 3, 4 ]
import time import os import psutil start = time.time() from queue import Queue from copy import copy process = psutil.Process(os.getpid()) class Node: object_id = 0 weight = 0 value = 0 def __init__(self,object_id,weight,value): self.object_id=object_id self.weight=weight ...
normal
{ "blob_id": "be408b349e2795101b525ad8d948dbf52cab81bf", "index": 4281, "step-1": "<mask token>\n\n\nclass Node:\n object_id = 0\n weight = 0\n value = 0\n\n def __init__(self, object_id, weight, value):\n self.object_id = object_id\n self.weight = weight\n self.value = value\n\n\...
[ 4, 5, 7, 8, 9 ]
#!/usr/bin/python # -*- coding:utf-8 -*- ################################################################ # 服务器程序 ################################################################ import json import time import traceback from flask import Flask, abort, render_template, redirect, send_from_directory, request, make_respon...
normal
{ "blob_id": "2c89f12d633da8da4d500dca910662d351b0958f", "index": 4509, "step-1": "#!/usr/bin/python\n# -*- coding:utf-8 -*-\n################################################################\n# 服务器程序\n################################################################\nimport json\nimport time\nimport traceback\nfro...
[ 0 ]
def convertEnEntier(nombre): result = ""; if (nombre == 4): result = "IV" if (nombre == 3): result = "III" if (nombre == 2): result = "II" if (nombre == 1): result = "I" return result print (convertEnEntier(1)) print (convertEnEntier(2)) pri...
normal
{ "blob_id": "ef7fad5019e79950e8fad56404e9ba5d302cfe1c", "index": 7596, "step-1": "<mask token>\n", "step-2": "def convertEnEntier(nombre):\n result = ''\n if nombre == 4:\n result = 'IV'\n if nombre == 3:\n result = 'III'\n if nombre == 2:\n result = 'II'\n if nombre == 1:\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def isPrime(x): if x == 1: return False for d in range(1, int(x ** 0.5)): if x == d + 1: continue if x % (d + 1) == 0: return False else: return True <|reserved_special_token_0|> <|reserv...
flexible
{ "blob_id": "37d465043eddd34c4453fd7e31b08d0ba58b725f", "index": 4351, "step-1": "<mask token>\n", "step-2": "def isPrime(x):\n if x == 1:\n return False\n for d in range(1, int(x ** 0.5)):\n if x == d + 1:\n continue\n if x % (d + 1) == 0:\n return False\n e...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CotisationComputes: @staticmethod def current_year(): now = datetime.datetime.now() if now.month > 8: return now.year + 1 return now.year @staticmethod def registration_current_year(): now = datetime.datetime.now() ...
flexible
{ "blob_id": "d726e468a9df26f1bcb8a016812b87fad7b41aa8", "index": 8089, "step-1": "<mask token>\n\n\nclass CotisationComputes:\n\n @staticmethod\n def current_year():\n now = datetime.datetime.now()\n if now.month > 8:\n return now.year + 1\n return now.year\n\n @staticmet...
[ 11, 12, 16, 17, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def findKthNumber(self, m: int, n: int, k: int) ->int: return bisect_left(range(m * n), k, key=lambda x: x // n * n + sum( x // i for i i...
flexible
{ "blob_id": "ec9efeca7eef7b8ee25c1e089e675bdb1e53413b", "index": 417, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def findKthNumber(self, m: int, n: int, k: int) ->int:\n return bisect_left(range(m * n), k, key=lambda x: x // n * n + s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DagRunnableReportingThread(StoppableThread, LoggingMixin): def __init__(self, async_mode: bool, dag_file_processor_agent, mailbox: Mailbox, *args, **kwargs): super(DagRunnableReportingThread, self).__init__(*args, **kwargs) self.setName('DagTrigger-DagRu...
flexible
{ "blob_id": "8e26a6b50539fa5f498aa2079a2625214e5b4d03", "index": 5919, "step-1": "<mask token>\n\n\nclass DagRunnableReportingThread(StoppableThread, LoggingMixin):\n\n def __init__(self, async_mode: bool, dag_file_processor_agent, mailbox:\n Mailbox, *args, **kwargs):\n super(DagRunnableReporti...
[ 13, 19, 20, 22, 24 ]
<|reserved_special_token_0|> def aggSumFn(path, grpByCol): allFiles = glob.glob(path + '/*.csv') for file_ in allFiles: df = pd.read_csv(file_, index_col=None, header=0) list_.append(df) frame = pd.concat(list_) frame[grpByCol] = pd.to_datetime(frame['day'], format='%Y-%m-%d') fram...
flexible
{ "blob_id": "252d6b381af09dbafb1d10c188eb154e53213033", "index": 8845, "step-1": "<mask token>\n\n\ndef aggSumFn(path, grpByCol):\n allFiles = glob.glob(path + '/*.csv')\n for file_ in allFiles:\n df = pd.read_csv(file_, index_col=None, header=0)\n list_.append(df)\n frame = pd.concat(list...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def build_response(session_attributes, speechlet_response): """ Build the full response JSON from the speechlet response """ return {'version': '1.0', 'sessionAttributes': session_attributes, 'response': speechlet_response} def get_welcome_response(): welcome...
flexible
{ "blob_id": "237277e132c8223c6048be9b754516635ab720e2", "index": 8964, "step-1": "<mask token>\n\n\ndef build_response(session_attributes, speechlet_response):\n \"\"\"\n Build the full response JSON from the speechlet response\n \"\"\"\n return {'version': '1.0', 'sessionAttributes': session_attribu...
[ 8, 11, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('domain_name', metavar='D', type=str, nargs='+', help= 'domain name to give to virtual host. multiple domains can be specified at once' ) <|reserved_special_token_0|> print( 'The following virtual h...
flexible
{ "blob_id": "a8e67ddbb741af6a9ff7540fef8c21468321ede0", "index": 7996, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('domain_name', metavar='D', type=str, nargs='+', help=\n 'domain name to give to virtual host. multiple domains can be specified at once'\n )\n<mask token>\nprin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for name in ('Manny', 'Moe', 'Jack'): print('Hi ya', name + '!') <|reserved_special_token_1|> #!/usr/bin/env python3 """ Greets the Pep Boys. """ for name in "Manny", "Moe", "Jack": print("Hi ya", name + '!')
flexible
{ "blob_id": "81ff77064a299b4fcd456f341ecb40ba5afe3295", "index": 1714, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor name in ('Manny', 'Moe', 'Jack'):\n print('Hi ya', name + '!')\n", "step-3": "#!/usr/bin/env python3\n\"\"\" Greets the Pep Boys.\n\"\"\"\n\nfor name in \"Manny\", \"Moe\", \"Jac...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def create_oauth_flow(): """Prepare Google OAuth workflow from config file.""" app.flow = flow_from_clientsecrets(str(Path(app.config['ROOT_DIR'], 'configs/client_secrets.json')), scope=['email', 'profile'], redirect_uri=url_for('auth.oauth2callback', _external=Tru...
flexible
{ "blob_id": "fe73a80b15cad025a33930ddd9abb31524cd0244", "index": 9404, "step-1": "<mask token>\n\n\ndef create_oauth_flow():\n \"\"\"Prepare Google OAuth workflow from config file.\"\"\"\n app.flow = flow_from_clientsecrets(str(Path(app.config['ROOT_DIR'],\n 'configs/client_secrets.json')), scope=['...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> def detectCycle(self, head): cycle_len = -1 one_node, two_node = head, head...
flexible
{ "blob_id": "3319614d154b16190f3cd8f4f65c3b0e0da277e9", "index": 9751, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def detectCycle(self, head):\n cycle_len = -1\n one_node, two_node = head, he...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def _set_webhook(): status = bot.set_webhook(WEBHOOK_URL) if not status: print('Webhook setup failed') sys.exit(1) else: print('Your webhook URL has been set to "{}"'.format(WEBHOOK_URL)) @app.route('/hook', methods=['POST']) def webhook_handler(): ...
flexible
{ "blob_id": "984efa858e782777472d84aab85471616a05b0e0", "index": 2886, "step-1": "<mask token>\n\n\ndef _set_webhook():\n status = bot.set_webhook(WEBHOOK_URL)\n if not status:\n print('Webhook setup failed')\n sys.exit(1)\n else:\n print('Your webhook URL has been set to \"{}\"'.fo...
[ 3, 4, 5, 6, 7 ]
import random from PyQt4.QtGui import ( QWidget, QHBoxLayout, QPushButton, QMainWindow, QIcon, QAction, QShortcut, QKeySequence, QFileDialog, QMessageBox) from PyQt4 import QtCore class Controls(QWidget): def __init__(self, parent): super(Controls, self).__init__(parent) ...
normal
{ "blob_id": "4e86dd74374297c3b0ce8fea93910003dac7d5d7", "index": 8742, "step-1": "<mask token>\n\n\nclass MainWindow(QMainWindow):\n playSong = QtCore.pyqtSignal(str)\n\n def __init__(self, music_dir):\n super(MainWindow, self).__init__()\n self.__music_dir = music_dir\n self.resize(40...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # Python version 3.8.5 # # Author Maria Catharina van Veen # # Purpose To provide users with a tool to create # or edit an html file. # # Tested OS This code was written and tested to # work with Windows 10. ...
normal
{ "blob_id": "63e5ead200fb2884d93f19e7d9b8dc76c7f4f0e3", "index": 4611, "step-1": "<mask token>\n\n\nclass MainWindow(Frame):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MainWindow(Frame):\n\n def __init__(self, root):\n Frame.__init__(self, root)\n self.root = ro...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .most_serializers import *
flexible
{ "blob_id": "a718949ed95b7d78f091b1e0f237eed151b102ae", "index": 2160, "step-1": "<mask token>\n", "step-2": "from .most_serializers import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import sys from melody_types import * import dataclasses """ Marks notes for grace notes """ # Mark grace notes on the peak note of every segment def _peaks(song): for phrase in song.phrases: for pe in phrase.phrase_elements: if type(pe) == Segment: if pe.direction != SegmentDir...
normal
{ "blob_id": "ac83d7d39319c08c35302abfb312ebee463b75b2", "index": 5130, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef _insert_grace_notes(song):\n for phrase in song.phrases:\n for pe in phrase.phrase_elements:\n if type(pe) != Segment:\n continue\n ...
[ 0, 1, 3, 4, 6 ]
#!/usr/bin/python # -*-coding:utf-8 -*- import smtplib import MySQLdb import datetime import types def sendEmail(sender,passwd,host,port,receivers,date,mail) : message = MIMEText(mail, 'html', 'utf-8') message['From'] = Header("告警发送者<"+sender+">", 'utf-8') subject = str(date) + '服务器告警通知' message['Subjec...
normal
{ "blob_id": "221a75d37fbb49e8508fc786ee8e6e90b19e12c0", "index": 4683, "step-1": "#!/usr/bin/python\n# -*-coding:utf-8 -*-\nimport smtplib\nimport MySQLdb\nimport datetime\nimport types\ndef sendEmail(sender,passwd,host,port,receivers,date,mail) :\n message = MIMEText(mail, 'html', 'utf-8')\n message['From...
[ 0 ]
<|reserved_special_token_0|> class DateTimeField(Field): <|reserved_special_token_0|> def process_formdata(self, values): if values: value = values[0].strip() if value == '': self.data = self.default if self.empty_to_default else '' else: ...
flexible
{ "blob_id": "72b29764f584c7f824eaa63ab0fdb1839a8d9102", "index": 8166, "step-1": "<mask token>\n\n\nclass DateTimeField(Field):\n <mask token>\n\n def process_formdata(self, values):\n if values:\n value = values[0].strip()\n if value == '':\n self.data = self.de...
[ 19, 21, 23, 30, 34 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(MODEL_LABELS_FILENAME, 'rb') as f: lb = pickle.load(f) <|reserved_special_token_0|> for root, dirs, files in os.walk(CAPTCHA_IMAGE_FOLDER): for name in tqdm(files, desc='Solving captchas'): kernel = 5, 5 ...
flexible
{ "blob_id": "c2ddf31bce4a5f3ae2b0d5455bbc9942f92bff40", "index": 275, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(MODEL_LABELS_FILENAME, 'rb') as f:\n lb = pickle.load(f)\n<mask token>\nfor root, dirs, files in os.walk(CAPTCHA_IMAGE_FOLDER):\n for name in tqdm(files, desc='Solving capt...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def final_frequency(): frequency = 0 with open('input') as f: for line in f: frequency += int(line) return frequency <|reserved_special_token_0|> <|reserved_special_token_1|> def final_frequency(): frequency = 0 wi...
flexible
{ "blob_id": "4d68b663933070cb287689b70d6ded07958cef22", "index": 3047, "step-1": "<mask token>\n", "step-2": "def final_frequency():\n frequency = 0\n with open('input') as f:\n for line in f:\n frequency += int(line)\n return frequency\n\n\n<mask token>\n", "step-3": "def final_fr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logging.basicConfig(level=logging.INFO) <|reserved_special_token_0|> @dp.message_handler(commands=['start', 'help']) async def send_welcome(message: types.Message): await message.reply( """Портал Государственных услу...
flexible
{ "blob_id": "4193fa992d06890afb660c072842cf1b85a43774", "index": 3207, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level=logging.INFO)\n<mask token>\n\n\n@dp.message_handler(commands=['start', 'help'])\nasync def send_welcome(message: types.Message):\n await message.reply(\n ...
[ 0, 1, 2, 3, 4 ]
import inspect import json import os import re import urllib.request from functools import wraps from ..errors import NotFoundError class API: def __init__(self, base_url, version=1): self.BASE = base_url or 'https://api.starlist.pro/v{}'.format(version) self.PROFILE = self.BASE + '/player' ...
normal
{ "blob_id": "3f3db7e8813f49fe0265e110236b6dc4fed6cd1b", "index": 7214, "step-1": "<mask token>\n\n\nclass API:\n\n def __init__(self, base_url, version=1):\n self.BASE = base_url or 'https://api.starlist.pro/v{}'.format(version)\n self.PROFILE = self.BASE + '/player'\n self.CLUB = self.BA...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> reload(sys) sys.setdefaultencoding('utf-8') <|reserved_special_token_0|> for l in root.iter('l'): file.write(''.join(l.itertext()) + '\n') file.close() <|reserved_special_token_1|> <|reserved_special_token_0|> reload(sys) s...
flexible
{ "blob_id": "cfea7848dfb41c913e5d8fec2f0f4f8afaaa09f3", "index": 5928, "step-1": "<mask token>\n", "step-2": "<mask token>\nreload(sys)\nsys.setdefaultencoding('utf-8')\n<mask token>\nfor l in root.iter('l'):\n file.write(''.join(l.itertext()) + '\\n')\nfile.close()\n", "step-3": "<mask token>\nreload(sys...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class QNetwork: <|reserved_special_token_0|> def __init__(self, state_dim: int, action_dim: int=3, hidden_layer_sizes: List=[128, 256, 256, 128], activation: str='relu'): self._state_dim = state_dim self._action_dim = action_dim self._hidden_layer_...
flexible
{ "blob_id": "a3e655350fb5fe7999bea4a87fb62c7698fb63f1", "index": 6663, "step-1": "<mask token>\n\n\nclass QNetwork:\n <mask token>\n\n def __init__(self, state_dim: int, action_dim: int=3,\n hidden_layer_sizes: List=[128, 256, 256, 128], activation: str='relu'):\n self._state_dim = state_dim\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> db = {'host': 'localhost', 'user': 'root', 'passwd': 'm74e71', 'database': 'dw_toner'} data_inicial = '1990-01-01' ano_final = 2018 feriados = 'feriados.csv' meses_de_ferias = 1, 2, 7, 12 dias_final_semana = 1, 6, 7 <|reserved_special_token_1|> #!/usr/...
flexible
{ "blob_id": "360881cecbad88ea5d150548fba6a39d8dc30681", "index": 8598, "step-1": "<mask token>\n", "step-2": "db = {'host': 'localhost', 'user': 'root', 'passwd': 'm74e71', 'database':\n 'dw_toner'}\ndata_inicial = '1990-01-01'\nano_final = 2018\nferiados = 'feriados.csv'\nmeses_de_ferias = 1, 2, 7, 12\ndia...
[ 0, 1, 2 ]
""" quiz materials for feature scaling clustering """ # FYI, the most straightforward implementation might # throw a divide-by-zero error, if the min and max # values are the same # but think about this for a second--that means that every # data point has the same value for that feature! # why would you rescale it? O...
normal
{ "blob_id": "6a6a7cc6d4f601f4461488d02e03e832bc7ab634", "index": 2928, "step-1": "\"\"\" quiz materials for feature scaling clustering \"\"\"\n\n# FYI, the most straightforward implementation might\n# throw a divide-by-zero error, if the min and max\n# values are the same\n# but think about this for a second--th...
[ 0 ]
import numpy as np import random with open("./roc.txt", "r") as fin: with open("./roc_shuffle.txt", "w") as fout: tmp = [] for k, line in enumerate(fin): i = k + 1 if i % 6 == 0: idx = [0] + np.random.permutation(range(1,5)).tolist() for sen i...
normal
{ "blob_id": "2aec0581413d4fb0ffb4090231fde0fed974bf18", "index": 27, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('./roc.txt', 'r') as fin:\n with open('./roc_shuffle.txt', 'w') as fout:\n tmp = []\n for k, line in enumerate(fin):\n i = k + 1\n if i % 6 ...
[ 0, 1, 2, 3 ]
from graph import Graph import ast import itertools def add_nodes(g): nodes = ['a', 'b', 'c', 'd'] for n in nodes: g.add_node(n) def add_desc(g): desc = [('b', 'a'), ('b', 'c'), ('d', 'c')] for d in desc: g.add_desc(d) def add_edges(g): edges = [('b', 'a'), ('b', 'c'), ('d', '...
normal
{ "blob_id": "8efee4ad16e938e85a500e5aebf5154b5708b277", "index": 9287, "step-1": "<mask token>\n\n\ndef add_nodes(g):\n nodes = ['a', 'b', 'c', 'd']\n for n in nodes:\n g.add_node(n)\n\n\ndef add_desc(g):\n desc = [('b', 'a'), ('b', 'c'), ('d', 'c')]\n for d in desc:\n g.add_desc(d)\n\n...
[ 4, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- """ Created on Fri Jul 3 18:27:30 2020 @author: PREET MODH """ for _ in range(int(input())): n=int(input()) xco,yco=[],[] flagx,flagy,xans,yans=1,1,0,0 for x in range(4*n-1): x,y=input().split() xco.append(int(x)) yco.append(int(y)) ...
normal
{ "blob_id": "d3b0a1d8b9f800c5d34732f4701ea2183405e5b4", "index": 9523, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(int(input())):\n n = int(input())\n xco, yco = [], []\n flagx, flagy, xans, yans = 1, 1, 0, 0\n for x in range(4 * n - 1):\n x, y = input().split()\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class tax(osv.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class tax(osv.Model): _inherit = 'sgr.tax' def send_alerts(self, ...
flexible
{ "blob_id": "1ddec426e4ad50f1d0e8a57ed841fbdf8c51b00f", "index": 9871, "step-1": "<mask token>\n\n\nclass tax(osv.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass tax(osv.Model):\n _inherit = 'sgr.tax'\n\n def send_alerts(self, cr, uid...
[ 1, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class User(MBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class UserTimeLine(MBase): """ POSTs that user will see in their timeline """ user_id =...
flexible
{ "blob_id": "9cb734f67d5149b052ff1d412d446aea1654fa69", "index": 9543, "step-1": "<mask token>\n\n\nclass User(MBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass UserTimeLine(MBase):\n \"\"\"\n POSTs that user will see in their timeline\n \"\"\"\...
[ 30, 32, 35, 37, 41 ]
<|reserved_special_token_0|> class model_objectdetection_ppm_centernet_v1: <|reserved_special_token_0|> def _build_net(self): self.learning_rate_tensor = tf.compat.v1.placeholder(tf.float32, shape=[], name='learning_rate') print(self.learning_rate_tensor) self.X = tf.compa...
flexible
{ "blob_id": "e24a62f2a3ff0122922f472a7b37f1773dfe9c11", "index": 7605, "step-1": "<mask token>\n\n\nclass model_objectdetection_ppm_centernet_v1:\n <mask token>\n\n def _build_net(self):\n self.learning_rate_tensor = tf.compat.v1.placeholder(tf.float32,\n shape=[], name='learning_rate')\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def decrypt_string(password_string, need_return=False): if not is_number(VERSION): raise ValueError('Invalid argument: --Version') ver = float(VERSION) Cipher = ARC4.new(getCipherKey()) try: if ver < 5.1: de_password = Cipher.decrypt(b64decode(p...
flexible
{ "blob_id": "5f2427c077d460d109f5a3e94b93f72c090f036d", "index": 7181, "step-1": "<mask token>\n\n\ndef decrypt_string(password_string, need_return=False):\n if not is_number(VERSION):\n raise ValueError('Invalid argument: --Version')\n ver = float(VERSION)\n Cipher = ARC4.new(getCipherKey())\n ...
[ 5, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> random.shuffle(lista) print('A ordem de apresentacao será') print(lista) <|reserved_special_token_1|> <|reserved_special_token_0|> a1 = input('Primeiro aluno: ') a2 = input('Primeiro segundo: ') a3 = input('Primeiro terceiro: '...
flexible
{ "blob_id": "9a0e24fbe9f51dc914d891e90196c2ff4e65f04a", "index": 9652, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.shuffle(lista)\nprint('A ordem de apresentacao será')\nprint(lista)\n", "step-3": "<mask token>\na1 = input('Primeiro aluno: ')\na2 = input('Primeiro segundo: ')\na3 = input('Pri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def plot_img(): """ plot ground truth (left) and reconstruction (right) showing b/w image data of mnist """ plt.subplot(121) plt.imshow(data.data.numpy()[0,].squeeze()) plt.subplot(122) plt.imshow(dec_mean.view(-1, 28, 28).data.numpy()[0,].squeeze()) p...
flexible
{ "blob_id": "cca9d91fe20e58f233ccfc4100edb748356ed234", "index": 6311, "step-1": "<mask token>\n\n\ndef plot_img():\n \"\"\" \n plot ground truth (left) and reconstruction (right)\n showing b/w image data of mnist\n \"\"\"\n plt.subplot(121)\n plt.imshow(data.data.numpy()[0,].squeeze())\n pl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ax.set_xticks(x + width / 2) ax.set_xticklabels(x_axis) plt.legend((p_rf[0], p_anns[0], p_adaboost[0]), ('RF', 'ANNs', 'AdaBoost'), loc='best', fontsize=20) plt.xticks(fontsize=18) plt.yticks(fontsize=18) plt.ylim(150, 200) pl...
flexible
{ "blob_id": "13342922022f0a0e8928c81c1c4716125af0b2c4", "index": 418, "step-1": "<mask token>\n", "step-2": "<mask token>\nax.set_xticks(x + width / 2)\nax.set_xticklabels(x_axis)\nplt.legend((p_rf[0], p_anns[0], p_adaboost[0]), ('RF', 'ANNs', 'AdaBoost'),\n loc='best', fontsize=20)\nplt.xticks(fontsize=18)...
[ 0, 1, 2, 3, 4 ]
import datetime,os def GetDatetimeFromMyFormat(l): # l = "2018-5-17 19:18:45" l_words = l.split() l_days = l_words[0].split('-') l_times = l_words[1].split(':') out = datetime.datetime(int(l_days[0]),int(l_days[1]),int(l_days[2]),int(l_times[0]),int(l_times[1]),int(l_times[2])) return out
normal
{ "blob_id": "6767302869d73d041e2d7061722e05484d19f3e0", "index": 4752, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GetDatetimeFromMyFormat(l):\n l_words = l.split()\n l_days = l_words[0].split('-')\n l_times = l_words[1].split(':')\n out = datetime.datetime(int(l_days[0]), int(l_da...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SelectSubsDialog(QDialog): <|reserved_special_token_0|> def enable_save_buttons(self): self.confirm_button.setEnabled(True) self.save_as_set_button.setEnabled(True) def get_substituents(self): self.substituents = list(dict.fromkeys([item.text() ...
flexible
{ "blob_id": "849db3a92e0544661dd465b3e7f6949f8de5633b", "index": 5099, "step-1": "<mask token>\n\n\nclass SelectSubsDialog(QDialog):\n <mask token>\n\n def enable_save_buttons(self):\n self.confirm_button.setEnabled(True)\n self.save_as_set_button.setEnabled(True)\n\n def get_substituents(...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(dr_items): with open('calls.csv', 'w', encoding='UTF8') as csv_file: csv_writer = csv.writer(csv_file) csv_header = ['dr_sid', 'date_start', 'number_src', 'number_dst', 'direction', 'duration...
flexible
{ "blob_id": "8262d8b5bbb156eccae021c1c9333d3cd1a6260f", "index": 9030, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(dr_items):\n with open('calls.csv', 'w', encoding='UTF8') as csv_file:\n csv_writer = csv.writer(csv_file)\n csv_header = ['dr_sid', 'date_start', 'number_src', 'n...
[ 0, 1, 2, 3 ]
from django.db import models # Create your models here. class Remedio(models.Model): nome = models.CharField(max_length=100, unique=True, help_text='Nome') valor = models.FloatField(null=False, help_text='Valor') detalhe = models.CharField(max_length=500, null=True) foto = models.ImageField(upload_to='...
normal
{ "blob_id": "07cce6802ab3259dbc78ab86a8dd6d6a4a617c7e", "index": 5242, "step-1": "<mask token>\n\n\nclass Remedio(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Remedio(models.Model):\n <mask token>\n <mask t...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class PillListView(ListView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class PillDetailView(DetailView): model = Pills templ...
flexible
{ "blob_id": "3c193decc4a1f284de953003fbba434d6e798b24", "index": 2827, "step-1": "<mask token>\n\n\nclass PillListView(ListView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass PillDetailView(DetailView):\n model = Pills\n template_nam...
[ 3, 6, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @decorator def coroutine(f, *a, **kw): """This decorator starts the coroutine for us.""" i = f(*a, **kw) i.next() return i <|reserved_special_token_1|> <|reserved_special_token_0|> from decorator import decora...
flexible
{ "blob_id": "6bde0ce30f33b155cc4c9ce9aa2ea6a6c5a1231d", "index": 5472, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@decorator\ndef coroutine(f, *a, **kw):\n \"\"\"This decorator starts the coroutine for us.\"\"\"\n i = f(*a, **kw)\n i.next()\n return i\n", "step-3": "<mask token>\nfr...
[ 0, 1, 2, 3 ]
from django.contrib import admin from lesson.models import ProgrammingEnvironment, Language, Lesson, LessonHint # list_display - Show these fields for each model on the Admin site # search_fields - Allow searching in these fields # Register models for the Admin site class ProgrammingEnvironmentAdmin(admin.ModelAdmin)...
normal
{ "blob_id": "2500c3562819e4e85ce3cbc30e0ddf1b8437e0a2", "index": 6448, "step-1": "<mask token>\n\n\nclass LanguageAdmin(admin.ModelAdmin):\n <mask token>\n list_display = 'language_name', 'description', 'environment'\n filter_horizontal = ()\n list_filter = ()\n fieldsets = ()\n\n\nclass LessonAdm...
[ 8, 9, 12, 14, 15 ]
from .base import paw_test class warning_test(paw_test): def test_warning_badchars(self): self.paw.cset_lookup(self.badchar) self.assertEqual(1, self.paw.wcount)
normal
{ "blob_id": "b4c6075aabe833f6fe23471f608d928edd25ef63", "index": 372, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass warning_test(paw_test):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass warning_test(paw_test):\n\n def test_warning_badchars(self):\n self.paw.cset_lookup(s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Jav_ink: def __init__(self): self.parser_name = 'jav_ink' self.domain = 'https://www.jav.ink' self.album_flag = {} <|reserved_special_token_0|> def album2photos(self, album_url, album_html): photos = [] album_id = album_html.xpat...
flexible
{ "blob_id": "9fff345dedcfc7051a258bc471acf07aece95bcf", "index": 9319, "step-1": "<mask token>\n\n\nclass Jav_ink:\n\n def __init__(self):\n self.parser_name = 'jav_ink'\n self.domain = 'https://www.jav.ink'\n self.album_flag = {}\n <mask token>\n\n def album2photos(self, album_url,...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # @Author: Lich_Amnesia # @Email: alwaysxiaop@gmail.com # @Date: 2016-11-17 11:00:33 # @Last Modified time: 2016-11-17 11:00:34 # @FileName: 346.py class MovingAverage(object): def __init__(self, size): """ Initialize your data structure here. :type size: int ...
normal
{ "blob_id": "9e37b728d8045726aef7625fccc14111ecb0e1c8", "index": 5578, "step-1": "<mask token>\n", "step-2": "class MovingAverage(object):\n <mask token>\n <mask token>\n", "step-3": "class MovingAverage(object):\n\n def __init__(self, size):\n \"\"\"\n Initialize your data structure h...
[ 0, 1, 2, 3, 4 ]
# Find sum/count of Prime digits in a number
normal
{ "blob_id": "75217256d88c32ed1c502bc104c30092bf74382d", "index": 9791, "step-1": "# Find sum/count of Prime digits in a number", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
from keras.models import * from keras.layers import * from keras.optimizers import * from keras.callbacks import ModelCheckpoint, LearningRateScheduler from keras import backend as keras unet_feature_n = 512 unet_feature_nstep_size = 1e-4 unet_input_image_size = 128 def unet(pretrained_weights=None, input_size=(unet_...
normal
{ "blob_id": "b8d45a0028cb4e393ddca9dd6d246289328d1791", "index": 4044, "step-1": "<mask token>\n\n\ndef small_unet(pretrained_weights=False, patch_size=128):\n input_ = Input((patch_size, patch_size, 1))\n skips = []\n output = input_\n for shape, filters in zip([5, 3, 3, 3, 3, 3, 3], [16, 32, 64, 64...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> for row in range(7): for col in range(5): if col == 0 or row % 3 == 0: print('*', end=' ') else: print(' ', end=' ') print() <|reserved_special_token_1|> for row in range(7): for col in range(5): ...
flexible
{ "blob_id": "634c826d30b22c6061531c514914e9ca62b21605", "index": 7158, "step-1": "<mask token>\n", "step-2": "for row in range(7):\n for col in range(5):\n if col == 0 or row % 3 == 0:\n print('*', end=' ')\n else:\n print(' ', end=' ')\n print()\n", "step-3": "for r...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def book_add(request): if request.user.is_authenticated: context = {} if request.method == 'GET': form = BookCreateModelForm() context['form'] = form return render(request, 'addbook.html', context) elif request.method == 'POS...
flexible
{ "blob_id": "aba2a0a262c14f286c278f21ba42871410c174f0", "index": 953, "step-1": "<mask token>\n\n\ndef book_add(request):\n if request.user.is_authenticated:\n context = {}\n if request.method == 'GET':\n form = BookCreateModelForm()\n context['form'] = form\n re...
[ 4, 6, 7, 8, 10 ]
from itertools import takewhile import numpy as np from .rrt import TreeNode from .trajectory.linear import get_default_limits, solve_linear from .trajectory.retime import spline_duration from .utils import argmin, negate, circular_difference, UNBOUNDED_LIMITS, get_distance, get_delta ASYMETRIC = True def asymmetr...
normal
{ "blob_id": "84febcc599aa97858ded3b6f803b6b76960878d4", "index": 7188, "step-1": "<mask token>\n\n\ndef asymmetric_extend(q1, q2, extend_fn, backward=False):\n if backward and ASYMETRIC:\n return reversed(list(extend_fn(q2, q1)))\n return extend_fn(q1, q2)\n\n\n<mask token>\n\n\ndef calculate_radius...
[ 7, 8, 10, 12, 13 ]
from __future__ import absolute_import from talin.quotations import register_xpath_extensions def init(): register_xpath_extensions()
normal
{ "blob_id": "c218428908c28a8c65bd72e66dcddaf7db1909d7", "index": 4325, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef init():\n register_xpath_extensions()\n", "step-3": "from __future__ import absolute_import\nfrom talin.quotations import register_xpath_extensions\n\n\ndef init():\n regi...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> default_app_config = 'assistant.additionalpage.apps.AdditionalPageAppConfig' <|reserved_special_token_1|> default_app_config = "assistant.additionalpage.apps.AdditionalPageAppConfig"
flexible
{ "blob_id": "0e2c71ab4f194af3c2ee65c2cbd6f36921eb587e", "index": 2079, "step-1": "<mask token>\n", "step-2": "default_app_config = 'assistant.additionalpage.apps.AdditionalPageAppConfig'\n", "step-3": "default_app_config = \"assistant.additionalpage.apps.AdditionalPageAppConfig\"\n", "step-4": null, "ste...
[ 0, 1, 2 ]
import pyttsx engine = pyttsx.init() rate = engine.getProperty('rate') engine.setProperty('rate', rate-55) engine.say('Hello , whats your name ?'); engine.say('I am mr. robot. What news would you like to listen to today ?'); #engine.say('Sally sells seashells by the seashore.') #engine.say('Sally sells seashells by the...
normal
{ "blob_id": "d638194a37dc503b7dfb5410abf264be67c3a4f0", "index": 4126, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine.setProperty('rate', rate - 55)\nengine.say('Hello , whats your name ?')\nengine.say('I am mr. robot. What news would you like to listen to today ?')\nengine.runAndWait()\n", "ste...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "d46cda5354640e1c87432d39a2e949d6db034edc", "index": 6413, "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 = [('rate', '000...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.1 on 2021-03-25 14:42 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="Experiment", fields=[ ...
normal
{ "blob_id": "b308d81fb8eab9f52aa0ad4f88e25d6757ef703a", "index": 1761, "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 ]
# Generated by Django 3.2.5 on 2021-08-05 23:59 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('lectures', '0003_auto_20210805_1954'), ] operations = [ migrations.RenameField( model_name='lecture', old_name='is_requird',...
normal
{ "blob_id": "e5bf4518f3834c73c3743d4c711a8d1a4ce3b944", "index": 6788, "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 = [('lectures', ...
[ 0, 1, 2, 3, 4 ]
#YET TO COMMENT. import numpy as np from functools import reduce class ProbabilityNetwork: def __init__(self,n,edges,probs): self.nodes=list(range(n)) self.edges=edges self.probs=probs def parents(self, node): return [a for a,b in edges if b==node] def ancestralOrder(self...
normal
{ "blob_id": "24fa41f916b54345e4647354f972bd22e130decf", "index": 4016, "step-1": "<mask token>\n\n\nclass ProbabilityNetwork:\n\n def __init__(self, n, edges, probs):\n self.nodes = list(range(n))\n self.edges = edges\n self.probs = probs\n\n def parents(self, node):\n return [a...
[ 6, 7, 9, 10, 11 ]
from .hailjwt import JWTClient, get_domain, authenticated_users_only __all__ = ['JWTClient', 'get_domain', 'authenticated_users_only']
normal
{ "blob_id": "39fb8d9f93be1e6c1ed2a425d14061737d643ab6", "index": 9330, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['JWTClient', 'get_domain', 'authenticated_users_only']\n", "step-3": "from .hailjwt import JWTClient, get_domain, authenticated_users_only\n__all__ = ['JWTClient', 'get_domai...
[ 0, 1, 2 ]
import numpy as np from django.contrib.auth import logout, login, authenticate from django.contrib.auth.decorators import login_required from django.core.mail import EmailMessage from django.shortcuts import render, redirect from django.template.loader import get_template from dashboard.notebook.creditcard import cred...
normal
{ "blob_id": "26bb5dc2679a4375d0950667ed02369df10857a8", "index": 8410, "step-1": "<mask token>\n\n\ndef contact(request):\n form_class = ContactForm\n if request.method == 'POST':\n form = form_class(data=request.POST)\n if form.is_valid():\n contact_name = request.POST.get('contac...
[ 7, 9, 11, 14, 16 ]
from nintendo.nex import backend, authentication, friends, matchmaking, common from nintendo.account import AccountAPI from nintendo.games import MK8, Friends import struct import logging logging.basicConfig(level=logging.INFO) #Device id can be retrieved with a call to MCP_GetDeviceId on the Wii U #Serial number ca...
normal
{ "blob_id": "43315abf9e096cdca89ed7f4de976d2706ff9c20", "index": 9234, "step-1": "<mask token>\n\n\ndef backend_login(title, use_auth_info, use_login_data, settings=None):\n api.set_title(title.TITLE_ID_EUR, title.LATEST_VERSION)\n nex_token = api.get_nex_token(title.GAME_SERVER_ID)\n auth_info = None\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def boxplot(values): """Calculate percentiles needed for a boxplot.""" percentiles = percentile(values, [0, 25, 50, 75, 100]) result = {'min_val': percentiles[0], 'q1_val': percentiles[1], 'mean_val': percentiles[2], 'q3_val': percentiles[3], 'max_val': percent...
flexible
{ "blob_id": "3472dc0c9d00c10ab0690c052e70fbf6a4bdb13d", "index": 7889, "step-1": "<mask token>\n\n\ndef boxplot(values):\n \"\"\"Calculate percentiles needed for a boxplot.\"\"\"\n percentiles = percentile(values, [0, 25, 50, 75, 100])\n result = {'min_val': percentiles[0], 'q1_val': percentiles[1],\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> TOTAL = 1306336 ONE = {'0': 1473, '1': 5936, '2': 3681, '3': 2996, '4': 2480, '5': 2494, '6': 1324, '7': 1474, '8': 1754, '9': 1740, 'a': 79714, 'b': 83472, 'c': 78015, 'd': 61702, 'e': 42190, 'f': 68530, 'g': 48942, 'h': 63661, 'i': 34947, 'j': 2...
flexible
{ "blob_id": "f254f93193a7cb7ed2e55e4481ed85821cafcd7b", "index": 4339, "step-1": "<mask token>\n", "step-2": "TOTAL = 1306336\nONE = {'0': 1473, '1': 5936, '2': 3681, '3': 2996, '4': 2480, '5': 2494,\n '6': 1324, '7': 1474, '8': 1754, '9': 1740, 'a': 79714, 'b': 83472, 'c':\n 78015, 'd': 61702, 'e': 4219...
[ 0, 1, 2 ]
# ------------------------------------------- # Created by: jasper # Date: 11/24/19 # -------------------------------------------- from os import path, mkdir class IOHandler: def __init__(self, directory, fName, data_instance): """Save the setup of a class instance or...
normal
{ "blob_id": "267276eab470b5216a2102f3e7616f7aecadcfe9", "index": 9428, "step-1": "<mask token>\n\n\nclass IOHandler:\n <mask token>\n\n def dump_data(self):\n \"\"\"save the data contained in data_instance, checking whether the\n directories already exist and asking whether to create them if ...
[ 3, 4, 5, 6, 7 ]
#! /user/bin/env python import requests from getpass import getpass import csv # Set up the variables with open("ACI PostMan Variable Values.csv", encoding='utf-8-sig') as csvfile: reader = csv.DictReader(csvfile) for row in reader: print(row) print("Let's configure the subnets...
normal
{ "blob_id": "bdc9856bfc61127d6bca31658b1faf3da09f5b86", "index": 161, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('ACI PostMan Variable Values.csv', encoding='utf-8-sig') as csvfile:\n reader = csv.DictReader(csvfile)\n for row in reader:\n print(row)\nprint(\"Let's configure th...
[ 0, 1, 2, 3, 4 ]
import requests import logging import json class Handler(object): def __init__(self): """ This class is used to handle interaction towards coffee interface. """ super(Handler, self).__init__() logging.warning('Initializing coffeeHandler....') # get an active token ...
normal
{ "blob_id": "00228facd19c72bebd9afbbe52597e390233d41e", "index": 5822, "step-1": "<mask token>\n\n\nclass Handler(object):\n <mask token>\n\n def get_rsp_from_url(self, url, params=None, method='get', data=None):\n logging.warning(\n 'when using method {}, header is:\\n {} \\n data is: \\...
[ 4, 6, 8, 9, 10 ]
from collections import OrderedDict import tcod.event from components import Entity, PaperDoll, Brain from components.enums import Intention from engine import GameScene from scenes.list_menu_scene import MenuAction, ListMenuScene from systems.utilities import set_intention, retract_intention def run(scene: GameS...
normal
{ "blob_id": "f1547e0893ce9c4661b546e49f3fc998745390d9", "index": 4397, "step-1": "<mask token>\n\n\ndef get_slots_query(scene: GameScene, entity: int):\n \"\"\"Return a query that resolves to entity's equipment slots and their equipped items.\"\"\"\n\n def query():\n paper_doll: PaperDoll = scene.cm...
[ 2, 3, 4, 5, 6 ]