code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
__author__ = 'tcaruso' # !/usr/bin/env python # -*- coding: utf-8 -*- import glob import fnmatch import os import sys import warnings from shutil import rmtree from setuptools import find_packages, setup, Command from collections import namedtuple try: from pip._internal.req import parse_requirements except Impo...
normal
{ "blob_id": "58438a1fb0b9e620717ba262c25a43bfbf6b8824", "index": 8100, "step-1": "<mask token>\n\n\nclass UploadCommand(Command):\n <mask token>\n description = 'Build and publish the package.'\n user_options = []\n\n def initialize_options(self):\n pass\n\n def finalize_options(self):\n ...
[ 6, 7, 9, 10, 11 ]
import os #defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":50} defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":"...
normal
{ "blob_id": "a826f33361ec59824f3c4a83d01e94c6b307b0a9", "index": 9144, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor condition in conditions:\n print(condition)\n command = ['./nk_oee -MODES_RESOLUTION 10 -SEED', seed]\n dir_name = []\n for var in defaults:\n if var not in conditi...
[ 0, 1, 2, 3, 4 ]
from lilaclib import * def pre_build(): newver = _G.newver.removeprefix('amd-drm-fixes-') for line in edit_file('PKGBUILD'): if line.startswith('_tag'): line = "_tag='amd-drm-fixes-" + newver + "'" print(line) newver2 = newver.replace("-",".") update_pkgver_and_pkgrel(newver2) def post_...
normal
{ "blob_id": "32eff306444966fab47815fcbae4aefb6769d29b", "index": 9684, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef post_build():\n git_add_files('PKGBUILD')\n git_commit()\n update_aur_repo()\n", "step-3": "<mask token>\n\n\ndef pre_build():\n newver = _G.newver.removeprefix('amd...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def scan_files(dir, pattern): fileList = [] for root, subFolders, files in os.walk(dir): for file in files: if fnmatch.fnmatch(file, pattern): fileList.append(os.path.join(root, file)) return fileList <|reserved_special_token_0|> <|reser...
flexible
{ "blob_id": "187c2a56ba9360b89c8ded09861091e2deedf32e", "index": 7783, "step-1": "<mask token>\n\n\ndef scan_files(dir, pattern):\n fileList = []\n for root, subFolders, files in os.walk(dir):\n for file in files:\n if fnmatch.fnmatch(file, pattern):\n fileList.append(os.pa...
[ 1, 2, 3, 4, 5 ]
from django.conf.urls import url, include from django.contrib import admin from rest_framework_swagger.views import get_swagger_view schema_view = get_swagger_view(title='Pastebin API') urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^doc_u/', schema_view), url(r'^', include('o.urls', )), url(...
normal
{ "blob_id": "891588327046e26acb9a691fa8bb9a99420712d6", "index": 913, "step-1": "<mask token>\n", "step-2": "<mask token>\nschema_view = get_swagger_view(title='Pastebin API')\nurlpatterns = [url('^admin/', admin.site.urls), url('^doc_u/', schema_view),\n url('^', include('o.urls')), url('^api/', include('r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AlignmentProfile: def __init__(self, width, df, identifier): self.ident = identifier self.profile = np.zeros((5, width)) self.repre_sq = '' self.seq_alignments = None self.seq_align_counter = -1 self.calculate_profile(df) def...
flexible
{ "blob_id": "7ae328bcfdec2d17fceb5d707f13cf495fde4469", "index": 7490, "step-1": "<mask token>\n\n\nclass AlignmentProfile:\n\n def __init__(self, width, df, identifier):\n self.ident = identifier\n self.profile = np.zeros((5, width))\n self.repre_sq = ''\n self.seq_alignments = No...
[ 5, 7, 8, 9, 11 ]
<|reserved_special_token_0|> class UpdateProduct(GenericAPIView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get(self, request, *args, **kwargs): data = self.get_queryset() extract_sp = self.extract_filter_data(Product_Specification.obje...
flexible
{ "blob_id": "47e9b73fc7f6b3c8295e78d0cdb5aa51ca4c5f8d", "index": 8140, "step-1": "<mask token>\n\n\nclass UpdateProduct(GenericAPIView):\n <mask token>\n <mask token>\n <mask token>\n\n def get(self, request, *args, **kwargs):\n data = self.get_queryset()\n extract_sp = self.extract_fil...
[ 11, 13, 16, 17, 19 ]
import os from flask import Flask, jsonify, request, abort, make_response from flask_sqlalchemy import SQLAlchemy from .models import User from .config import app_config app = Flask(__name__) app.config.from_object(app_config[os.getenv('FLASK_ENV', 'production')]) db = SQLAlchemy(app) @app.route('/api/v1/users/<int:u...
normal
{ "blob_id": "f4519fa82ffc6bf945c7bb36d3761a708a06f641", "index": 5933, "step-1": "<mask token>\n\n\n@app.route('/api/v1/users/<int:user_id>', methods=['GET'])\ndef get_user(user_id):\n try:\n user = User.query.filter_by(id=user_id).first()\n return jsonify({'user': user.serialize})\n except:\...
[ 4, 6, 7, 8 ]
from django.db import models from django.contrib.auth.models import User # Create your models here. class Post(models.Model): title = models.CharField(max_length=40) content = models.TextField() date_published = models.DateTimeField(auto_now=True) author = models.ForeignKey(User, on_delete=models.CASCA...
normal
{ "blob_id": "1257b90781a213ca8e07f67a33b8e847d0525653", "index": 9354, "step-1": "<mask token>\n\n\nclass Comment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.user.username\n\n\nclass Comment_to_comment(models.Model):\n u...
[ 7, 10, 11, 12, 13 ]
import numpy as np er = ['why','who','how','where','which','what','when','was','were','did','do','does','is','are','many','much'] qst = [] txt = None ans = None fnd = [] def chek_qst(qst): global er for h in er: for i in qst: if i == h: qst.remove(i) # qst ...
normal
{ "blob_id": "d30129248f5245560ee0d3ee786e118427e169d7", "index": 4616, "step-1": "<mask token>\n\n\ndef search_word(qst):\n global txt\n for h in qst:\n temp = []\n for n, l in enumerate(txt):\n if [n for i, j in enumerate(l) if h in j] != []:\n temp.append(n)\n ...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def fit(x, iters=1000, eps=1e-06): """ Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation. :param x: 1d-ndarray of samples from an (unknown) distribution. Each value must satisfy x > 0. :param iters: Maximum number of iterations ...
flexible
{ "blob_id": "b10d3d8d0ded0d2055c1abdaf40a97abd4cb2cb8", "index": 1631, "step-1": "<mask token>\n\n\ndef fit(x, iters=1000, eps=1e-06):\n \"\"\"\n Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation.\n :param x: 1d-ndarray of samples from an (unknown) distributio...
[ 1, 2, 3, 4, 5 ]
"""Scans all files in this project for FIXME and TODO comments and writes them to todos.txt has to be invoked while being in myLambda/ and not in e.g. myLambda/src""" import sys import os import re files = [] searchFiles = [] # get all subdirs and its files for root, dirs, f in os.walk('./'): files.append((root, f)) ...
normal
{ "blob_id": "3bc6091d822fa197dcce3cd75fa9755dc9f93592", "index": 7520, "step-1": "\"\"\"Scans all files in this project for FIXME and TODO comments and writes them to todos.txt\nhas to be invoked while being in myLambda/ and not in e.g. myLambda/src\"\"\"\nimport sys\nimport os\nimport re\nfiles = []\nsearchFile...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', Home.as_view(), name='home'), path('signup', Signup .as_view(), name='signup'), path('login', Login.as_view(), name='login')] <|reserved_special_token_1|> from django.urls import path from .views.hom...
flexible
{ "blob_id": "979a387e29867818ffad7291511ff0be40dee118", "index": 1938, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', Home.as_view(), name='home'), path('signup', Signup\n .as_view(), name='signup'), path('login', Login.as_view(), name='login')]\n", "step-3": "from django.url...
[ 0, 1, 2, 3 ]
import os import time import pickle from configparser import ConfigParser from slackbot import bot from slackbot.bot import Bot from slackbot.bot import listen_to from elasticsearch_dsl.connections import connections from okcom_tokenizer.tokenizers import CCEmojiJieba, UniGram from marginalbear_elastic.query import p...
normal
{ "blob_id": "3630f83e7e6a10f42e96f8bd6fa9714232d9176b", "index": 4552, "step-1": "<mask token>\n\n\n@listen_to('(.*)')\ndef receive_question(message, question_string):\n if message._body['channel'] == SLACK_CHANNEL:\n try:\n query_ccjieba = ccjieba.cut(question_string.strip())\n q...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def removdup(): train = pd.read_csv('C:\\Users\\Lenovo\\zqrbtest\\data.csv') train = train['titlec'] train = set(train) data = pd.DataFrame(list(train), columns=['titlec']) data.to_csv('redup.csv', index=False, encoding='utf_8_sig') <|reserved_special_token_0|> <|r...
flexible
{ "blob_id": "6f3aa4e1309745265bb9d79df5f5a352e54493f9", "index": 6313, "step-1": "<mask token>\n\n\ndef removdup():\n train = pd.read_csv('C:\\\\Users\\\\Lenovo\\\\zqrbtest\\\\data.csv')\n train = train['titlec']\n train = set(train)\n data = pd.DataFrame(list(train), columns=['titlec'])\n data.to...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(UserProfileInfo) <|reserved_special_token_1|> from django.contrib import admin from basic_app.models import UserProfileInfo admin.site.register(UserProfileInfo) <|reserved_special_token_1|> from django.co...
flexible
{ "blob_id": "624212a1d73ff3a3b3092ffa27912a6ae25a2484", "index": 6826, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(UserProfileInfo)\n", "step-3": "from django.contrib import admin\nfrom basic_app.models import UserProfileInfo\nadmin.site.register(UserProfileInfo)\n", "step-4": ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Rouge(Character): def special_attack1(self, opponent, hitdamage_callback, specatt_callback): pass def special_attack2(self, opponent, hitdamage_callback, specatt_callback): pass <|reserved_special_token_0|> def regen_resource(self): pass ...
flexible
{ "blob_id": "36991c3191ba48b1b9dbd843e279f8fe124f1339", "index": 73, "step-1": "<mask token>\n\n\nclass Rouge(Character):\n\n def special_attack1(self, opponent, hitdamage_callback, specatt_callback):\n pass\n\n def special_attack2(self, opponent, hitdamage_callback, specatt_callback):\n pass...
[ 5, 6, 7, 8, 9 ]
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
normal
{ "blob_id": "932502c93dd7dfc095adfe2ab88b4404396d9845", "index": 8680, "step-1": "<mask token>\n\n\nclass TestIetAdmDriver(tf.TargetDriverFixture):\n <mask token>\n\n def test_get_target(self):\n tmp_file = six.StringIO()\n tmp_file.write(\n \"\"\"tid:1 name:iqn.2010-10.org.opensta...
[ 3, 7, 8, 9, 12 ]
#Charlie Quinn if.py #Check < in an 'if' statement #use a 'while' loop to make testing easier def income_input(prompt_message): prompt = prompt_message + ' ' temp = input(prompt) #get input from user return float(temp) do_again = 'y' while do_again =='y': income = income_input("\nHow much did ...
normal
{ "blob_id": "d5acde6c6139833c6631a2d88a181cd019d3d2da", "index": 5747, "step-1": "<mask token>\n", "step-2": "def income_input(prompt_message):\n prompt = prompt_message + ' '\n temp = input(prompt)\n return float(temp)\n\n\n<mask token>\n", "step-3": "def income_input(prompt_message):\n prompt =...
[ 0, 1, 2, 3, 4 ]
import queue import sys import logging from superai.common import InitLog logger = logging.getLogger(__name__) # 2维到1维 def hwToidx(x: int, y: int, weight: int): return y * weight + x # 1维到2维 def idxTohw(idx, weight: int): return [idx % weight, idx // weight] # 10x10 cell idx 到 [x,y] def idxToXY(idx, cel...
normal
{ "blob_id": "b6d8a918659f733919fe3bb4be9037e36ad32386", "index": 272, "step-1": "<mask token>\n\n\nclass Graph:\n\n def __init__(self, V: int, W: int):\n self.V = V\n self.E = 0\n self.adj = []\n self.W = W\n for i in range(V):\n nears = []\n self.adj.a...
[ 14, 17, 18, 19, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'authors' urlpatterns = [path('polls/', PollsList.as_view()), path('polls/create', PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsView.as_view( )), path('answers/', PollsAnswer.as_view())] <|reserve...
flexible
{ "blob_id": "64ac007faeebe0e71ba0060e74fa07154e6291e2", "index": 6053, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'authors'\nurlpatterns = [path('polls/', PollsList.as_view()), path('polls/create',\n PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsView.as_view(\n )), path('...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def convert(o): if isinstance(o, np.generic): return o.item() raise TypeError <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def convert(o): if isinstance(o, np.generic): return o.item() raise TypeError <|res...
flexible
{ "blob_id": "7057b882ca1ce2c08e9ba7add5f115636b9b319e", "index": 8745, "step-1": "<mask token>\n\n\ndef convert(o):\n if isinstance(o, np.generic):\n return o.item()\n raise TypeError\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef convert(o):\n if isinstance(o, np.generic):\n ret...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # encoding: utf-8 import multiprocessing import time import sys def daemon(): p = multiprocessing.current_process() print('Starting:', p.name, p.pid) sys.stdout.flush() time.sleep(2) print('Exiting :', p.name, p.pid) sys.stdout.flush() def non_daemon(): p = multipr...
normal
{ "blob_id": "9bb6fd6fbe212bdc29e2d1ec37fa6ec6ca9a9469", "index": 1060, "step-1": "<mask token>\n\n\ndef daemon():\n p = multiprocessing.current_process()\n print('Starting:', p.name, p.pid)\n sys.stdout.flush()\n time.sleep(2)\n print('Exiting :', p.name, p.pid)\n sys.stdout.flush()\n\n\n<mask ...
[ 2, 5, 6, 7, 8 ]
import data import sub_vgg19 import time import tensorflow as tf model_syn = sub_vgg19.vgg19_syn model_asy = sub_vgg19.vgg19_asy train_x = data.train_x train_y = data.train_y test_x = data.test_x test_y = data.test_y def input_fn(images, labels, epochs, batch_size): data = tf.data.Dataset.from_tensor_slices((ima...
normal
{ "blob_id": "ef6f91af5f500745fdcc23947a7e1764061c608c", "index": 2368, "step-1": "<mask token>\n\n\ndef input_fn(images, labels, epochs, batch_size):\n data = tf.data.Dataset.from_tensor_slices((images, labels))\n data = data.repeat(epochs).batch(batch_size)\n return data\n\n\n<mask token>\n", "step-2...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 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] == "previous": boss.active_tab_manager.next_tab(-1) boss.active_tab.neighboring_window(args[1]) handle_result.no_ui...
normal
{ "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 ]
import re import cgi import os import urllib import urllib2 from time import sleep from google.appengine.api import taskqueue from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db from google.appengine.api import urlfetch from google.ap...
normal
{ "blob_id": "c8a6a8633f863e0350157346106a747096d26939", "index": 9912, "step-1": "<mask token>\n\n\nclass lexicon0(db.Model):\n word = db.StringProperty(required=True)\n known = db.StringListProperty(indexed=False)\n\n\n<mask token>\n\n\ndef getjp(before, wordlist, after):\n global REQUESTURL\n wordl...
[ 13, 14, 17, 21, 22 ]
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): # (119ms) def isSubtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool...
normal
{ "blob_id": "5ac4dd62d8e56c7baf38f9fe9f8b4a5034f1cb80", "index": 192, "step-1": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# self.val = x\n# self.left = None\n# self.right = None\n\nclass Solution(object):\n# (119ms)\n def isSubtree(...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def swap(a, b): print(a, b) <|reserved_special_token_0|> <|reserved_special_token_1|> def swap(a, b): print(a, b) <|reserved_special_token_0|> print('the vaalues after swaping the variables are below:') print('the value of a is : ', a) print('t...
flexible
{ "blob_id": "4fbe4d474e10e08eafee3bcc6173f8cd6b797dde", "index": 3203, "step-1": "<mask token>\n", "step-2": "def swap(a, b):\n print(a, b)\n\n\n<mask token>\n", "step-3": "def swap(a, b):\n print(a, b)\n\n\n<mask token>\nprint('the vaalues after swaping the variables are below:')\nprint('the value of ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> doc.updateStatus() if script.run_script(doc, script.id) != False: if doc.naming('richiesta') != 'integrazione': doc.sendThisMail('rigetta') script.run_script(doc, script.id, suffix='post') <|reserved_special_toke...
flexible
{ "blob_id": "096d82e1f9e8832f6605d23c8bb324e045b6b14f", "index": 7393, "step-1": "<mask token>\n", "step-2": "<mask token>\ndoc.updateStatus()\nif script.run_script(doc, script.id) != False:\n if doc.naming('richiesta') != 'integrazione':\n doc.sendThisMail('rigetta')\n script.run_script(doc, scri...
[ 0, 1, 2, 3 ]
import datetime import json import re import time import discord from utils.ext import standards as std, checks, context, logs DISCORD_INVITE = '(discord(app\.com\/invite|\.com(\/invite)?|\.gg)\/?[a-zA-Z0-9-]{2,32})' EXTERNAL_LINK = '((https?:\/\/(www\.)?|www\.)[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6})' EVE...
normal
{ "blob_id": "10c9566503c43e806ca89e03955312c510092859", "index": 5346, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findWord(word):\n return re.compile('\\\\b({0})\\\\b'.format(word), flags=re.IGNORECASE).search\n\n\nasync def managePunishment(ctx, punishment, reason):\n await ctx.message...
[ 0, 2, 3, 4, 5 ]
import numpy as np import csv class PriceTracker: def __init__(self): pass def getValue(self, i): pass class CsvTracker: def __init__(self, csv_file): self.current_row = 61 self.csv_file_content = [] self.csv_file = csv.reader(csv_file, delimiter =',') fo...
normal
{ "blob_id": "eb827998f1ba75ffb95751ddb2b31d4d0e54358b", "index": 8273, "step-1": "import numpy as np\nimport csv\n\nclass PriceTracker:\n\n def __init__(self):\n pass\n\n def getValue(self, i):\n pass\n\n\nclass CsvTracker:\n def __init__(self, csv_file):\n self.current_row = 61\n ...
[ 0 ]
# SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2020 ifm electronic gmbh # # THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. # """ This module provides the recording control GUI service for the nexxT framework. """ import logging from pathlib import Path from nexxT.Qt.QtCore import Qt, QStorageInf...
normal
{ "blob_id": "3e4771d074218fb0a77332ee61a4cc49f1c301b7", "index": 9356, "step-1": "<mask token>\n\n\nclass MVCRecordingControlGUI(MVCRecordingControlBase):\n <mask token>\n\n def __init__(self, config):\n assertMainThread()\n super().__init__(config)\n self._directory = str(Path('.').ab...
[ 6, 8, 9, 12, 15 ]
__author__ = "Sarah Hazell Pickering (sarah.pickering@anu.edu.au)" __date__ = "2018-11-15" """ QC and Trimming with fastp Trimming and QC with fastp. Then subsampling of reads via seqtk. Now starts with a sample/sample.file structure. Number of reads to sample is can be supplied via pairs_to_sample ...
normal
{ "blob_id": "655e6531dc21dcdf8fa827184444cee483492b81", "index": 7715, "step-1": "__author__ = \"Sarah Hazell Pickering (sarah.pickering@anu.edu.au)\"\n__date__ = \"2018-11-15\"\n\n\"\"\" QC and Trimming with fastp\n\n Trimming and QC with fastp.\n Then subsampling of reads via seqtk.\n\n Now starts wit...
[ 0 ]
<|reserved_special_token_0|> class Test(unittest.TestCase): <|reserved_special_token_0|> def test(self): workflow_input = {'result_type': 'posts'} wf = WeiboOnline() r = wf.run(workflow_input) print(json.dumps(r, ensure_ascii=False, indent=2)) def tearDown(self): ...
flexible
{ "blob_id": "7088f7233b67dcb855482a76d304aacc1a26abad", "index": 3790, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def test(self):\n workflow_input = {'result_type': 'posts'}\n wf = WeiboOnline()\n r = wf.run(workflow_input)\n print(json.dumps(...
[ 3, 4, 5, 6 ]
from tkinter import * import psycopg2 import sys import pprint import Base_de_datos import MergeSort class Cliente: def __init__(self,id=None,nombre=None): self.id=id self.nombre=nombre def ingresar(self): self.ventanaIngresar= Toplevel() self.ventanaIngresa...
normal
{ "blob_id": "63d9aa55463123f32fd608ada83e555be4b5fe2c", "index": 6946, "step-1": "<mask token>\n\n\nclass Cliente:\n <mask token>\n <mask token>\n\n def BD(self):\n conectar = Base_de_datos.BaseDeDatos()\n comando = (\"INSERT INTO public.cliente(id, nombre) VALUES('\" + self\n ....
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def read_lookup_table(hole_cards, lookup_table): """ Reads the preflop lookup table preflop_EHSs.txt. Args: hole_cards: list of int (deuces cards) lookup_table: read from preflop_EHSs.txt Return:...
flexible
{ "blob_id": "8503998fc881f47dc695d3ea4c7f56fa65a96e8a", "index": 2874, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef read_lookup_table(hole_cards, lookup_table):\n \"\"\"\n Reads the preflop lookup table preflop_EHSs.txt.\n Args: \n hole_cards: list of int (deuces cards)\n ...
[ 0, 1, 2 ]
#!/usr/bin/env python from django import template from django.conf import settings from django.utils.html import format_html register = template.Library() @register.simple_tag def website_title(): return settings.WEBSITE_TITLE def split_page(result_obj): """ 分页模块,后台传入一个分页结果集就可以 :param result_obj: ...
normal
{ "blob_id": "c2c51dcd05c21e91e591de25fc2de034c88c48a1", "index": 9052, "step-1": "<mask token>\n\n\ndef split_page(result_obj):\n \"\"\"\n 分页模块,后台传入一个分页结果集就可以\n :param result_obj:\n :return:\n \"\"\"\n return_str = '<nav>'\n return_str += \"<ul class='pagination pull-right'>\"\n if resul...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class BusRoute(Base): <|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 BusRoutePos(Base): __tablename__ = 'bus_route_pos' id...
flexible
{ "blob_id": "9e896d935cc57e580ed46cd501b41053bbaab38f", "index": 6490, "step-1": "<mask token>\n\n\nclass BusRoute(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BusRoutePos(Base):\n __tablename__ = 'bus_route_pos'\n id = Column...
[ 12, 15, 16, 17, 19 ]
<|reserved_special_token_0|> def cut_rod2(price, n): val = [(0) for x in range(n + 1)] val[0] = 0 for i in range(1, n + 1): max_val = -1 for j in range(i): max_val = max(max_val, price[j] + val[i - j - 1]) val[i] = max_val return val[n] <|reserved_special_token_0|...
flexible
{ "blob_id": "9cca73ebdf2b05fe29c14dc63ec1b1a7c917b085", "index": 6508, "step-1": "<mask token>\n\n\ndef cut_rod2(price, n):\n val = [(0) for x in range(n + 1)]\n val[0] = 0\n for i in range(1, n + 1):\n max_val = -1\n for j in range(i):\n max_val = max(max_val, price[j] + val[i ...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.add_collection(coll) db.add_collection(coll2) pickle.dump(db, open('')) <|reserved_special_token_1|> <|reserved_special_token_0|> console = Console() doc = FourierDocument({'bar': 'eggs', 'xyz': 'spam'}) doc2 = FourierDocume...
flexible
{ "blob_id": "f15f96658130ac9bba748a518371ad80d9772fbc", "index": 4121, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.add_collection(coll)\ndb.add_collection(coll2)\npickle.dump(db, open(''))\n", "step-3": "<mask token>\nconsole = Console()\ndoc = FourierDocument({'bar': 'eggs', 'xyz': 'spam'})\ndoc...
[ 0, 1, 2, 3, 4 ]
# flush in poker def IsContinuous(numbers): if not numbers or len(numbers) < 1 : return False numbers.sort() number_of_zero = 0 number_of_gap = 0 for i in range(len(numbers)): if numbers[i] == 0: number_of_zero += 1 small = number_of_zero big = small + 1 whi...
normal
{ "blob_id": "68a776d7fccc8d8496a944baff51d2a862fc7d31", "index": 1259, "step-1": "<mask token>\n", "step-2": "def IsContinuous(numbers):\n if not numbers or len(numbers) < 1:\n return False\n numbers.sort()\n number_of_zero = 0\n number_of_gap = 0\n for i in range(len(numbers)):\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def write_csv(url, recursive=False, writer=None, token=''): response = fetch(url) if recursive: write_rows(writer, response) cursor = next_cursor(response) if cursor is not None: print(f'next cursor exists...{cursor}') ret = urlparse...
flexible
{ "blob_id": "b47f15a79f7a82304c2be6af00a5854ff0f6ad3e", "index": 6987, "step-1": "<mask token>\n\n\ndef write_csv(url, recursive=False, writer=None, token=''):\n response = fetch(url)\n if recursive:\n write_rows(writer, response)\n cursor = next_cursor(response)\n if cursor is not Non...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for word in words: if word_dict.has_key(word): word_dict[word.lower()] = max(word_dict[word.lower()], words.count( word.lower()) + words.count(word.upper()) + words.count(word)) else: word_dict[...
flexible
{ "blob_id": "addab37cb23abead2d9f77a65336cd6026c52c68", "index": 8559, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in words:\n if word_dict.has_key(word):\n word_dict[word.lower()] = max(word_dict[word.lower()], words.count(\n word.lower()) + words.count(word.upper()) + w...
[ 0, 1, 2, 3, 4 ]
import sys sys.stdin = open("sample_input_17.txt","r") T = int(input()) def code(N): # 암호코드가 있는 열의 위치를 찾음 code = [] for i in range(N-4): for j in range(49,53): if S[i][j] == "1" : code = S[i] return code def code_s(code): # 암호코드의 행 위치를 찾아 슬라이싱 for x in ...
normal
{ "blob_id": "b739c1de6c008158ee3806bed9fa2865eb484b4f", "index": 5596, "step-1": "<mask token>\n\n\ndef code(N):\n code = []\n for i in range(N - 4):\n for j in range(49, 53):\n if S[i][j] == '1':\n code = S[i]\n return code\n\n\ndef code_s(code):\n for x ...
[ 3, 4, 5, 6, 7 ]
n = int(input()) a = [int(e) for e in input().split()] ans = [0] * n for i in range(n): s = a[i] ans[s - 1] = i + 1 print(*ans)
normal
{ "blob_id": "f74e2e6b59330bd63fee9192e74a72178abc1cab", "index": 8195, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n s = a[i]\n ans[s - 1] = i + 1\nprint(*ans)\n", "step-3": "n = int(input())\na = [int(e) for e in input().split()]\nans = [0] * n\nfor i in range(n):\n s = ...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- import scrapy import MySQLdb import openpyxl from scrapy.crawler import CrawlerProcess import sys class AllabolaSpider(scrapy.Spider): name = 'allabola' allowed_domains = ['https://www.allabolag.se'] start_urls = [] #'https://www.allabolag.se/7696250484/befattningar' host =...
normal
{ "blob_id": "d60a2100127db859162890204655d313cdc2a4a5", "index": 4614, "step-1": "<mask token>\n\n\nclass AllabolaSpider(scrapy.Spider):\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 f.write('fn,ln,zip,ct,st,co...
[ 2, 4, 5, 6, 8 ]
from django.shortcuts import render from rest_framework.response import Response from .serializers import * from rest_framework import generics, status class HistoryMyList(generics.ListCreateAPIView): serializer_class = HistorySer queryset = History.objects.all() class HistoryListView(generics.GenericAPIVie...
normal
{ "blob_id": "8edca4c50e48734073e80de85088964837247696", "index": 2597, "step-1": "<mask token>\n\n\nclass HistoryListView(generics.GenericAPIView):\n <mask token>\n\n def post(self, request):\n serializer_class = self.serializer_class(data=request.data)\n serializer_class.is_valid(raise_excep...
[ 8, 9, 11, 12 ]
from django.urls import path from . import views # url configuration for view.index function app_name = 'movies' urlpatterns = [ path('', views.index, name='index'), # represents a root of this app path('<int:movie_id>', views.detail, name='detail') ]
normal
{ "blob_id": "5aaac757b766b0143ca3ea54d8fc4b8936160ec7", "index": 5090, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'movies'\nurlpatterns = [path('', views.index, name='index'), path('<int:movie_id>',\n views.detail, name='detail')]\n", "step-3": "from django.urls import path\nfrom . im...
[ 0, 1, 2, 3 ]
def group(arr): low, mid, high = 0, 0, len(arr)-1 while mid <= high: print(arr) if arr[mid] == 'R' : arr[low], arr[mid] = arr[mid], arr[low] low += 1 mid += 1 elif arr[mid] == 'G': mid += 1 else: arr[high], ar...
normal
{ "blob_id": "8ad47bf292e0046550cc0ef6f6bb75cf179ebd4b", "index": 7477, "step-1": "<mask token>\n", "step-2": "def group(arr):\n low, mid, high = 0, 0, len(arr) - 1\n while mid <= high:\n print(arr)\n if arr[mid] == 'R':\n arr[low], arr[mid] = arr[mid], arr[low]\n low +...
[ 0, 1, 2, 3, 4 ]
#coding=utf-8 import urllib.parse import json '''转化从charles复制下来的字串,转为json格式''' def to_str(body_str): '''检查需要转化的str是否符合标准''' if not body_str == '': par = body_str.split("&") # print(par) _temp = [] try: for each in par: if "=" not in each: ...
normal
{ "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|> <|reserved_special_token_1|> ii = [('LeakWTI2.py', 6)]
flexible
{ "blob_id": "997b68e42547b8f8a1059776c55c3ad16df494da", "index": 1468, "step-1": "<mask token>\n", "step-2": "ii = [('LeakWTI2.py', 6)]\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
animal = 'cat' def f(): global animal animal = 'dog' print('local_scope:', animal) print('local:', locals()) f() print('global_scope:', animal) print('global:', locals())
normal
{ "blob_id": "4f3908e12102cfd58737952803c710772e960b0e", "index": 2385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f():\n global animal\n animal = 'dog'\n print('local_scope:', animal)\n print('local:', locals())\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef f():\n gl...
[ 0, 1, 2, 3 ]
def addnumber(i,j): sum= i+j print(sum) num1 = int(input("Enter 1st number")) num2 = int(input("Enter 2nd number")) z = addnumber(num1,num2)
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def train(hp): os.makedirs(hp.out_dir, exist_ok=True) device = torch.device('cuda' if hp.use_cuda else 'cpu') dataset = SVHN(root='svhn', split='train', download=True, transform= ToTensor()) eval_dataset ...
flexible
{ "blob_id": "43db8ed10face1c668aeadd3cbc5b13f87fb0126", "index": 4997, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train(hp):\n os.makedirs(hp.out_dir, exist_ok=True)\n device = torch.device('cuda' if hp.use_cuda else 'cpu')\n dataset = SVHN(root='svhn', split='train', download=True, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Convolution_Layer(Layer): def __init__(self, shape, mean, stddev): super(Convolution_Layer, self).__init__(shape, mean, stddev) def feed_forward(self, input_data, stride): conv = tf.nn.conv2d(input_data, self.weights, stride, padding='VALID') output...
flexible
{ "blob_id": "ed246f2887f19ccf922a4d386918f0f0771fb443", "index": 5106, "step-1": "<mask token>\n\n\nclass Convolution_Layer(Layer):\n\n def __init__(self, shape, mean, stddev):\n super(Convolution_Layer, self).__init__(shape, mean, stddev)\n\n def feed_forward(self, input_data, stride):\n con...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.show() <|reserved_special_token_1|> import Individual import Grupal import matplotlib.pyplot as plt import pandas as pd plt.show()
flexible
{ "blob_id": "bb1caf4d04c8a42279afa0ac586ced991e0dff84", "index": 4574, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.show()\n", "step-3": "import Individual\nimport Grupal\nimport matplotlib.pyplot as plt\nimport pandas as pd\nplt.show()\n", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
import pickle import numpy as np in_dir = "C:\\Users\\ganga\\Github\\Generative-Models\\Project\\Data\\Dynamics\\" out_dir = f"C:\\Users\\ganga\\Github\\Generative-Models\\Project\\Data\\Dynamics\\" # Read frames train_frames = pickle.load( open(in_dir +'\\train_frames.pkl' , 'rb' )) test_frames = pickle.load( open(...
normal
{ "blob_id": "e048170775c589cf0a9fb3d54c72dab4df3f1bcb", "index": 7558, "step-1": "<mask token>\n\n\ndef sigmoid(x):\n return 0.5 * (1 + np.tanh(0.5 * x))\n\n\ndef bernoulli_array(prob_array, dim):\n sample = np.zeros(dim)\n uni_sample = np.random.uniform(0, 1, dim)\n diff = uni_sample - prob_array\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dbindexer.autodiscover() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dbindexer.autodiscover() urlpatterns = patterns('harvester.views', url('^$', 'home', name='home'), url('^settin...
flexible
{ "blob_id": "9fc9d766915bcefde4f0ba5c24cb83e33fc66272", "index": 1094, "step-1": "<mask token>\n", "step-2": "<mask token>\ndbindexer.autodiscover()\n<mask token>\n", "step-3": "<mask token>\ndbindexer.autodiscover()\nurlpatterns = patterns('harvester.views', url('^$', 'home', name='home'),\n url('^settin...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __version__ = '0.90.03'
flexible
{ "blob_id": "284e4f79748c17d44518f2ce424db5b1697373dc", "index": 3156, "step-1": "<mask token>\n", "step-2": "__version__ = '0.90.03'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from DHT_Python import dht22 from oled96 import oled from PiBlynk import Blynk # read data using pin 4 instance = dht22.DHT22(pin=4) token = "---token---" blynk = Blynk(token) def cnct_cb(): print ("Connected: ") blynk.on_connect(cnct_cb) def _funCb(ACT): result = instance.read() if result.is_valid(): strTe...
normal
{ "blob_id": "e95ebb2aa6526e3bf3789da17d144e71cdb49aca", "index": 2712, "step-1": "<mask token>\n\n\ndef cnct_cb():\n print('Connected: ')\n\n\n<mask token>\n\n\ndef _funCb(ACT):\n result = instance.read()\n if result.is_valid():\n strTemp = '%.2f' % result.temperature\n strHumi = '%.2f' % ...
[ 2, 3, 4, 5, 6 ]
from page_objects import PageObject, PageElement class MainPage(PageObject): level_menu_opened = False level_menu_created = False css_input = PageElement(css='input.input-strobe') level_text_span = PageElement(css='span.level-text') instruction_h2 = PageElement(css='h2.order') enter_button = P...
normal
{ "blob_id": "c6cf085330f47ffb139c5acc91d91e9758f5396a", "index": 274, "step-1": "<mask token>\n\n\nclass MainPage(PageObject):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, webdriver, root_uri=None):\n ...
[ 6, 7, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> fig.tight_layout() fig.subplots_adjust(wspace=0.05) <|reserved_special_token_0|> for year in years: train = get(year, features, index) train = pre(train) for method in methods: ax = axes[i, j] Z = linka...
flexible
{ "blob_id": "8279f8a80d96a7231e35100d2c39fa5e1f34f5f5", "index": 9777, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.tight_layout()\nfig.subplots_adjust(wspace=0.05)\n<mask token>\nfor year in years:\n train = get(year, features, index)\n train = pre(train)\n for method in methods:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class location_accommodation(models.AbstractModel): <|reserved_special_token_0|> <|reserved_special_token_0|> @api.multi def render_html(self, docids, data=None): report = self.env['report']._get_report_from_name( 'sg_accommodation.view_location_report...
flexible
{ "blob_id": "ac99c19294661657d383b036c9ab83e7b610cb7d", "index": 6896, "step-1": "<mask token>\n\n\nclass location_accommodation(models.AbstractModel):\n <mask token>\n <mask token>\n\n @api.multi\n def render_html(self, docids, data=None):\n report = self.env['report']._get_report_from_name(\...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 2.2.6 on 2019-11-05 02:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('drchrono', '0011_patient_cell_phone'), ] operations = [ migrations.AddField( model_name='appointment', name='date', ...
normal
{ "blob_id": "0c7f2412fe9a83d70d41fbc4bbaf135e6bc4149a", "index": 8129, "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 = [('drchrono', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def makeoutput(path): if os.path.exists(path): pass else: os.mkdir(path) def mailinglist_cookies(mailinglist, password): try: cookie_request = requests.post(URL + ADMIN + mailinglist, data={ 'adminpw': password}) cookie_request.rai...
flexible
{ "blob_id": "0e337ce21450e0fdb7688183d0542ebf902a9614", "index": 1293, "step-1": "<mask token>\n\n\ndef makeoutput(path):\n if os.path.exists(path):\n pass\n else:\n os.mkdir(path)\n\n\ndef mailinglist_cookies(mailinglist, password):\n try:\n cookie_request = requests.post(URL + ADM...
[ 4, 5, 6, 7, 8 ]
# website = urlopen("https://webservices.ulm.edu/forms/forms-list") # data = bs(website, "lxml") # forms = data.findAll("span", {"class": "file"}) # forms_list = [] # names = [] # for f in forms: # forms_list.append(f.find("a")["href"]) # names.append(f.get_text()) # # print(forms_list) # for f in forms_list:...
normal
{ "blob_id": "a61f351391ca1b18359323fd9e49f1efa4c7513c", "index": 4007, "step-1": "<mask token>\n\n\ndef main():\n website = input('Enter the website you want to download file from: ')\n div = input('Enter the div/span (be as specific as you can): ')\n classTag = input('Enter the class/id tag you want to...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for file in glob.glob(pwd + '/*spectrum.json'): subj_name = os.path.basename(file)[0:6] subj_list.append(subj_name) df_dict[os.path.basename(file)[0:6]] = pd.read_json(file) <|reserved_special_token_0|> for tract in al...
flexible
{ "blob_id": "f78f8f560b7eb70232658be762e2058535a68122", "index": 9086, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file in glob.glob(pwd + '/*spectrum.json'):\n subj_name = os.path.basename(file)[0:6]\n subj_list.append(subj_name)\n df_dict[os.path.basename(file)[0:6]] = pd.read_json(file...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2, N + 1): s.add(i) for num in sorted(s): k = num + num while k <= N: if k in s: s.remove(k) k += num print('Primes:', end=' ') for num in sorted(s): print(num, end=' ') ...
flexible
{ "blob_id": "bf5422792533f85967a5573d9e6f370a7967a914", "index": 120, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, N + 1):\n s.add(i)\nfor num in sorted(s):\n k = num + num\n while k <= N:\n if k in s:\n s.remove(k)\n k += num\nprint('Primes:', end=' ...
[ 0, 1, 2, 3 ]
from telethon import events from var import Var from pathlib import Path from ub.config import Config import re, logging, inspect, sys, json, os from asyncio import create_subprocess_shell as asyncsubshell, subprocess as asyncsub from os import remove from time import gmtime, strftime from traceback import format_exc f...
normal
{ "blob_id": "4b672ad420bb67b8e2726102939ed6d369683150", "index": 7267, "step-1": "<mask token>\n\n\ndef load_module(shortname):\n if shortname.startswith('__'):\n pass\n elif shortname.endswith('_'):\n import ub.events\n import sys\n import importlib\n from pathlib import...
[ 4, 7, 9, 13, 15 ]
s=int(input()) print(s+2-(s%2))
normal
{ "blob_id": "0412369f89842e2f55aa115e63f46a1b71a0f322", "index": 2685, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s + 2 - s % 2)\n", "step-3": "s = int(input())\nprint(s + 2 - s % 2)\n", "step-4": "s=int(input())\nprint(s+2-(s%2))", "step-5": null, "step-ids": [ 0, 1, 2, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def shift(v, i, j): if i <= j: return v store = v[i] for k in range(0, i - j - 1): v[i - k] = v[i - k - 1] v[j] = store return v def insertion(v): for i in range(1, len(v)): j = i while v[i] < v[j - 1] and j > 0: j = j ...
flexible
{ "blob_id": "35288c9ad4d3550003e3c2f9e9034f4bce1df830", "index": 3626, "step-1": "<mask token>\n\n\ndef shift(v, i, j):\n if i <= j:\n return v\n store = v[i]\n for k in range(0, i - j - 1):\n v[i - k] = v[i - k - 1]\n v[j] = store\n return v\n\n\ndef insertion(v):\n for i in rang...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> [1.5780628845471506e-10, -1.411490597458207e-12, -2.483949940281473e-13, 5.026488748046414e-11, -1.6612576871621329e-10, -1.6989844545344268e-15, 8.109443782655016e-16, 2.404048022255995e-05, -1.9859378185800262e-06, ...
flexible
{ "blob_id": "bdf3cb1830021b10d6c8966b3341fd9297d9a371", "index": 2045, "step-1": "<mask token>\n", "step-2": "<mask token>\n[1.5780628845471506e-10, -1.411490597458207e-12, -2.483949940281473e-13, \n 5.026488748046414e-11, -1.6612576871621329e-10, -1.6989844545344268e-15,\n 8.109443782655016e-16, 2.40404...
[ 0, 1, 2, 3 ]
# from dataclasses import InitVar, dataclass # standard library imports from math import floor # third-party imports import gym import torch from torch.nn import Conv2d, Linear, MaxPool2d, Module, ModuleList, ReLU, Sequential from torch.nn import functional as F # local imports from tmrl.nn import TanhNormalLayer fro...
normal
{ "blob_id": "6f6d3fbb9a6a118e0f4026a7f9054b90b8cf2fca", "index": 5677, "step-1": "<mask token>\n\n\nclass BigCNN(Module):\n\n def __init__(self, h_in, w_in, channels_in):\n super(BigCNN, self).__init__()\n self.h_out, self.w_out = h_in, w_in\n self.conv1 = Conv2d(channels_in, 64, 8, strid...
[ 14, 16, 19, 22, 24 ]
<|reserved_special_token_0|> class MyAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> class CalcResultAdmin(MyAdmin): list_display = 'result', 'message', 'time' search_fields = 'result', 'message', 'time' <|reserved_special_token_0|> <|reserved_special_token_1|>...
flexible
{ "blob_id": "e2573a5dc507e9aeb811fbc254129aeb6e54cc0b", "index": 2483, "step-1": "<mask token>\n\n\nclass MyAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n\n\nclass CalcResultAdmin(MyAdmin):\n list_display = 'result', 'message', 'time'\n search_fields = 'result', 'message', 'time'\n\n\n<mask...
[ 3, 4, 5, 6, 8 ]
<|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": "b92497396e711d705760db547b43cc65beba6cfd", "index": 6172, "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 = [('sandbox_rep...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 5 10:04:05 2019 @author: cristina """ import numpy as np from itertools import chain from numpy import linalg as LA diag = LA.eigh import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 13}) import time pi = np.pi exp = np.exp t1 = tim...
normal
{ "blob_id": "f2ad95574b65b4d3e44b85c76f3a0150a3275cec", "index": 2356, "step-1": "<mask token>\n\n\ndef LDOS_up(omega, E, u, Damping):\n t = sum(u ** 2 / (omega - E + 1.0j * Damping))\n tt = -1 / pi * np.imag(t)\n return tt\n\n\ndef LDOS_down(omega, E, v, Damping):\n t = sum(v ** 2 / (omega + E + 1.0...
[ 2, 3, 4, 5, 6 ]
import sys from bs4 import BeautifulSoup def get_classes(html): """ returns a list of classes and titles, parsing through 'html' """ # elements = html.find_all("span", "code") # titles = html.find_all("span", "title") # classes = [] # for i in range(len(elements)): # item = element...
normal
{ "blob_id": "9bb8e0f732eac474dbc01c374f9c74178f65dc36", "index": 3063, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_classes(html):\n \"\"\"\n returns a list of classes and titles, parsing through 'html'\n \"\"\"\n", "step-3": "import sys\nfrom bs4 import BeautifulSoup\n\n\ndef ge...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ConfigLoader: <|reserved_special_token_0|> def __init__(self, level): self._log = Logger('configloader', level) self._log.info('ready.') def configure(self, filename='config.yaml'): """ Read and return configuration from the specified YA...
flexible
{ "blob_id": "3a6038cb80548b98fc7e4a328092f1dc1ffd6dfd", "index": 1154, "step-1": "<mask token>\n\n\nclass ConfigLoader:\n <mask token>\n\n def __init__(self, level):\n self._log = Logger('configloader', level)\n self._log.info('ready.')\n\n def configure(self, filename='config.yaml'):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> _all__ = ['minning_algo'] <|reserved_special_token_1|> _all__ = ["minning_algo"]
flexible
{ "blob_id": "5a7b68648898818e0db47f225f3d4b0972cd5b99", "index": 7521, "step-1": "<mask token>\n", "step-2": "_all__ = ['minning_algo']\n", "step-3": "_all__ = [\"minning_algo\"]\n\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class CNP(torch.nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> class ANP(torch.nn.Module): def __init__(self, in_dim, hidden_dim, query_dim, out_dim, en_layer, dec_layer, nhead): super(ANP, self).__init__() if en_layer == 1: ...
flexible
{ "blob_id": "82c3bde5746d04c126a93851844f775e7ce65f4b", "index": 9442, "step-1": "<mask token>\n\n\nclass CNP(torch.nn.Module):\n <mask token>\n <mask token>\n\n\nclass ANP(torch.nn.Module):\n\n def __init__(self, in_dim, hidden_dim, query_dim, out_dim, en_layer,\n dec_layer, nhead):\n sup...
[ 7, 8, 9, 10, 13 ]
import PySimpleGUI as sg class TelaLisatrClientes(): def __init__(self): self.__window = None def init_components(self, lista_clientes): layout = [ [sg.Text('Dados do cliente')], [sg.Listbox(values=lista_clientes, size=(60, 10))], [sg.Submit()] ] ...
normal
{ "blob_id": "624b34d160ea6db4f5249544f1614a20f506ca9e", "index": 895, "step-1": "<mask token>\n\n\nclass TelaLisatrClientes:\n <mask token>\n\n def init_components(self, lista_clientes):\n layout = [[sg.Text('Dados do cliente')], [sg.Listbox(values=\n lista_clientes, size=(60, 10))], [sg....
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('guac_auth', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='guacamoleconnectiongroup', ...
normal
{ "blob_id": "7f63097265b1058785e90441f85b7f0088946717", "index": 7785, "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 = [('guac_auth',...
[ 0, 1, 2, 3, 4 ]
''' 简述:这里有四个数字,分别是:1、2、3、4 提问:能组成多少个互不相同且无重复数字的三位数?各是多少? ''' for x in range(1,5): for y in range(1,5): for z in range(1,5): if (x != y) & (x != z) & (y != z): print(x,y,z)
normal
{ "blob_id": "caac877bf6c42217ea41f51717f6a704a3a9774b", "index": 6838, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(1, 5):\n for y in range(1, 5):\n for z in range(1, 5):\n if (x != y) & (x != z) & (y != z):\n print(x, y, z)\n", "step-3": "''' 简述:这里有...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def auto_int(x): return int(x, 0) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def auto_int(x): return int(x, 0) def load_options(): global parsed_args base_parser = argparse.ArgumentParser(add_help=False) base_parser....
flexible
{ "blob_id": "3b381668dbb9b4e5a2e323dc4d6b5e3951736882", "index": 1804, "step-1": "<mask token>\n\n\ndef auto_int(x):\n return int(x, 0)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef auto_int(x):\n return int(x, 0)\n\n\ndef load_options():\n global parsed_args\n base_parser = argparse.Argum...
[ 1, 4, 5, 6, 7 ]
from armulator.armv6.bits_ops import add_with_carry, bit_not from armulator.armv6.enums import InstrSet from armulator.armv6.opcodes.opcode import Opcode class SubsPcLrThumb(Opcode): def __init__(self, instruction, imm32, n): super().__init__(instruction) self.imm32 = imm32 self.n = n ...
normal
{ "blob_id": "89376b2464dfb724197a1c1e164af8277e03ad59", "index": 2507, "step-1": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n\n def __init__(self, instruction, imm32, n):\n super().__init__(instruct...
[ 1, 2, 3, 4, 5 ]
year = int(input('西暦>')) if year % 4 == 0 and year % 100 != 0: print('閏年') pass elif year % 400 == 0: print('閏年') pass else: print('平年') pass
normal
{ "blob_id": "b381d1110e6a7570cd872d689a43aba2d2580a23", "index": 8449, "step-1": "<mask token>\n", "step-2": "<mask token>\nif year % 4 == 0 and year % 100 != 0:\n print('閏年')\n pass\nelif year % 400 == 0:\n print('閏年')\n pass\nelse:\n print('平年')\n pass\n", "step-3": "year = int(input('西暦>...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def register_int_signal_handler(): def stop_thread_handler(signum, frame): log.info('Received signal {0}. Will stop all task threads'.format( signum)) for _ in range(len(THREAD_STOP_FLAGS)): THREAD_STOP_FLAGS[_] = True if platform.platform(...
flexible
{ "blob_id": "fbd5400823a8148adf358a2acc58fde146a25313", "index": 2275, "step-1": "<mask token>\n\n\ndef register_int_signal_handler():\n\n def stop_thread_handler(signum, frame):\n log.info('Received signal {0}. Will stop all task threads'.format(\n signum))\n for _ in range(len(THREA...
[ 13, 16, 19, 20, 24 ]
from introduction import give_speech from staring import stare_at_people from dow_jones import visualize_dow_jones from art_critic import give_art_critiques from hipster import try_hipster_social_interaction from empathy import share_feelings_with_everyone from slapstick import perform_slapstick_humor from ending impor...
normal
{ "blob_id": "d218b72d1992a30ad07a1edca1caf04b7b1985f6", "index": 7834, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef performance():\n give_speech()\n visualize_dow_jones()\n give_art_critiques()\n stare_at_people()\n try_hipster_social_interaction()\n share_feelings_with_everyo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(connection, info, args, world): """Resets a users money""" money = shelve.open('money-%s.db' % world.hostnicks[connection.host], writeback=True) money[info['sender']] = {'money': 100000, 'maxmoney': ...
flexible
{ "blob_id": "95021cc01c0b85b512fd466797d4d128472773c3", "index": 2943, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(connection, info, args, world):\n \"\"\"Resets a users money\"\"\"\n money = shelve.open('money-%s.db' % world.hostnicks[connection.host],\n writeback=True)\n ...
[ 0, 1, 2, 3, 4 ]
import numpy as np def get_mask(mask): r = mask[:, :, 0] g = mask[:, :, 1] return r // (r.max() or 1) * -1 + g // (g.max() or 1) def calculate_brightness(image): weights = np.array([0.299, 0.587, 0.114]) brightness_matrix = (image*weights).sum(axis=2) return brightness_matrix def calculate...
normal
{ "blob_id": "7130a382784955780a3f258c81ce05c61915af56", "index": 5000, "step-1": "<mask token>\n\n\ndef get_mask(mask):\n r = mask[:, :, 0]\n g = mask[:, :, 1]\n return r // (r.max() or 1) * -1 + g // (g.max() or 1)\n\n\n<mask token>\n\n\ndef extend(image, mask):\n brightness = calculate_brightness(i...
[ 3, 6, 7, 9, 10 ]
a = input() b = [] ind = [] for i in a: if i.isalpha(): b.append(i) else: ind.append(a.index(i)) c = list(reversed(b)) for i in ind: c.insert(i, a[i]) print(''.join(c))
normal
{ "blob_id": "8fedaeb13fde117cf6b7ace23b59c26e4aab2bc2", "index": 4492, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n if i.isalpha():\n b.append(i)\n else:\n ind.append(a.index(i))\n<mask token>\nfor i in ind:\n c.insert(i, a[i])\nprint(''.join(c))\n", "step-3": "a ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): K, S = read_ints() total = 0 for X in range(K + 1): if S - X < 0: break Y_min = max(S - X - K, 0) ...
flexible
{ "blob_id": "46b1fc975fbeedcafaa66c85c378e2249a495647", "index": 8827, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef read_ints():\n return list(map(int, input().strip().split(' ')))\n\n\ndef solve():\n K, S = read_ints()\n total = 0\n for X in range(K + 1):\n if S - X < 0:\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='TF_Speech', version='0.2.0', extras_require={'tensorflow': [ 'tensorflow'], 'tensorflow with gpu': ['tensorflow-gpu']}) <|reserved_special_token_1|> <|reserved_special_token_0|> from setuptools import setup setu...
flexible
{ "blob_id": "97ebdeada3d797a971b5c3851b75f9754595f67c", "index": 358, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='TF_Speech', version='0.2.0', extras_require={'tensorflow': [\n 'tensorflow'], 'tensorflow with gpu': ['tensorflow-gpu']})\n", "step-3": "<mask token>\nfrom setuptools impo...
[ 0, 1, 2, 3 ]
### # This Python module contains commented out classifiers that I will no longer # be using ### from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import BaggingClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.neighbors import KNeighborsClassifier # Using Decision trees...
normal
{ "blob_id": "5029f3e2000c25d6044f93201c698773e310d452", "index": 3391, "step-1": "<mask token>\n", "step-2": "from sklearn.tree import DecisionTreeClassifier\nfrom sklearn.ensemble import BaggingClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\...
[ 0, 1, 2 ]
<|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": "e307bcc28526081141f1f2204c225d8e5f0100a8", "index": 9015, "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 = [('HMS', '0009...
[ 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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "d65d85b4573728ed32ccf987459d5a228e2a8897", "index": 5196, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def RepresentsInt(s): try: int(s) return True except ValueError: return False <|reserved_special_token_0|> def drawOneEllipse(aoi, img, draw): if DEBUG: print('Ellipse centered at [{0}, {1}] with {2} {3}'.format(aoi[0], aoi[1], a...
flexible
{ "blob_id": "833053a5a75636267feaad5ddaa21dce1de34038", "index": 5319, "step-1": "<mask token>\n\n\ndef RepresentsInt(s):\n try:\n int(s)\n return True\n except ValueError:\n return False\n\n\n<mask token>\n\n\ndef drawOneEllipse(aoi, img, draw):\n if DEBUG:\n print('Ellipse ...
[ 6, 8, 12, 13, 17 ]
from multiprocessing import Pool from pathlib import Path import os import re import json import string import math import GLOBALS stopWords = {"a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "bel...
normal
{ "blob_id": "19f17044d48c8cc0f9d366cde7edc846ff343462", "index": 2598, "step-1": "<mask token>\n\n\ndef search(query, finalIndexPath):\n listOfDicts = list()\n queryList = set()\n tempList = query.strip().lower().replace(\"'\", '').split(' ')\n for word in tempList:\n if word not in stopWords:...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Page(webapp.RequestHandler): def get(self): if users.get_current_user(): url = users.create_logout_url(self.request.uri) linktext = 'Logout' user = users.get_current_user() else: url = users.create_login_url(self.r...
flexible
{ "blob_id": "64ed3c512894902f85d619020b78338e228dddb6", "index": 4380, "step-1": "<mask token>\n\n\nclass Page(webapp.RequestHandler):\n\n def get(self):\n if users.get_current_user():\n url = users.create_logout_url(self.request.uri)\n linktext = 'Logout'\n user = user...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def load_json(file_name='data.json'): with open(file_name, 'r') as json_fp: json_data = json_fp.read() data_arr = json.loads(json_data) return data_arr <|reserved_special_token_0|> <|reserved_spec...
flexible
{ "blob_id": "63068a15d750abb29398d687495d6001ba17ab8a", "index": 9435, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef load_json(file_name='data.json'):\n with open(file_name, 'r') as json_fp:\n json_data = json_fp.read()\n data_arr = json.loads(json_data)\n return data_arr...
[ 0, 1, 2, 3, 4 ]