code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while left_idx <= mid_idx and right_idx <= n - 1: if n_list[left_idx] < n_list[right_idx]: nn_list.append(n_list[left_idx]) left_idx += 1 elif n_list[left_idx] > n_list[right_idx]: nn_list.append(n_...
flexible
{ "blob_id": "fb5508b1b5aa36c4921358d6ca7f96fc7d565241", "index": 5104, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile left_idx <= mid_idx and right_idx <= n - 1:\n if n_list[left_idx] < n_list[right_idx]:\n nn_list.append(n_list[left_idx])\n left_idx += 1\n elif n_list[left_idx]...
[ 0, 1, 2, 3 ]
# bot.py import os import sqlite3 import json import datetime from dotenv import load_dotenv import discord from discord.ext import commands from discord.ext.commands import Bot from cogs.utils import helper as h intents = discord.Intents.default() intents.members = True load_dotenv() TOKEN = os.getenv('DISCORD_T...
normal
{ "blob_id": "849343561dd9bdcfc1da66c604e1bfa4aa10ddf3", "index": 5359, "step-1": "<mask token>\n\n\nclass LLKEventsBot(Bot):\n <mask token>\n\n async def on_ready(self):\n if not os.path.exists('db'):\n os.makedirs('db')\n if not os.path.exists('logs'):\n os.makedirs('lo...
[ 1, 2, 4, 5, 6 ]
#coding=utf-8 import requests,sys result_url=[] def main(): counts=open(sys.argv[1]).readlines() for line in open(sys.argv[1]): line=line.strip("\n") url=line try: #url="http://s6000.sgcc.com.cn/WebContent/s6000/main/index.jsp#no-back" r=requests.get(u...
normal
{ "blob_id": "96a4659f03879e051af95b5aa9c1e1364015fb86", "index": 8723, "step-1": "<mask token>\n\n\ndef main():\n counts = open(sys.argv[1]).readlines()\n for line in open(sys.argv[1]):\n line = line.strip('\\n')\n url = line\n try:\n r = requests.get(url, verify=True, timeo...
[ 1, 2, 3, 4, 5 ]
# ------------------------------------------------------------------------------------------------------ # Copyright (c) Leo Hanisch. All rights reserved. # Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information. # ---------------------------------------------------------...
normal
{ "blob_id": "917a291c7b62dee392d7411c3e039949d74d7af8", "index": 1375, "step-1": "<mask token>\n\n\nclass Nest:\n <mask token>\n <mask token>\n <mask token>\n\n def update_pos(self, new_position: Tuple[float, float]) ->None:\n \"\"\"\n If the new position's value is better than the old ...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def trainW2v(args): clazz = [['Accidents', 'Arts', 'Attacks', 'Economy', 'Miscellaneous', 'Politics', 'Science', 'Sports', 'undefined'], ['Accidents', 'Arts', 'Attacks', 'Economy', 'Miscellaneous', 'Politics'...
flexible
{ "blob_id": "3bc9c6a66f749858ea5801202b0ac80755c1b347", "index": 6493, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef trainW2v(args):\n clazz = [['Accidents', 'Arts', 'Attacks', 'Economy', 'Miscellaneous',\n 'Politics', 'Science', 'Sports', 'undefined'], ['Accidents', 'Arts',\n '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ProjectrolesConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ProjectrolesConfig(AppConfig): name = 'projectroles' <|reserved_special_token_1|> ...
flexible
{ "blob_id": "6a4585e0e2f5ebbd0f9a7fa203f76bb88ff9c2a0", "index": 2920, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProjectrolesConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ProjectrolesConfig(AppConfig):\n name = 'projectroles'\n", "step-4": "from django....
[ 0, 1, 2, 3 ]
import requests import json import pyttsx engine = pyttsx.init() engine.say('Hello from Eliq.') engine.runAndWait() power_value = 0 power_value_int = 0 prompt=0 Eliq_just_NOW ={} accesstoken = "xxxxxxxxxxxxxxxxxxxxxx" #Say warning for power use over this limmit in Watts level_warning = 2000 Eliq_request_string = (...
normal
{ "blob_id": "72abba6fa40441ab172bccb9065aaa0af5fefd64", "index": 7209, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine.say('Hello from Eliq.')\nengine.runAndWait()\n<mask token>\nprint(power_str)\nif power_value_int > level_warning:\n engine.say(power_str)\n engine.say('Warning.')\n engine...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Nest: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def update_pos(self, new_position: Tuple[float, float]) ->None: """ If the new position's value is better than the old one, update the nests position and val...
flexible
{ "blob_id": "917a291c7b62dee392d7411c3e039949d74d7af8", "index": 1375, "step-1": "<mask token>\n\n\nclass Nest:\n <mask token>\n <mask token>\n <mask token>\n\n def update_pos(self, new_position: Tuple[float, float]) ->None:\n \"\"\"\n If the new position's value is better than the old ...
[ 2, 3, 4, 5, 7 ]
from mathgraph3D.core.plot import * from mathgraph3D.core.functions import *
normal
{ "blob_id": "b58cc08f8f10220373fa78f5d7249bc883b447bf", "index": 6991, "step-1": "<mask token>\n", "step-2": "from mathgraph3D.core.plot import *\nfrom mathgraph3D.core.functions import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from HurdleRace import hurdleRace from ddt import ddt, data, unpack import unittest class test_AppendAndDelete3(unittest.TestCase): def test_hurdleRace(self): height = [1, 6, 3, 5, 2] k = 4 sum_too_high = hurdleRace(k, height) self.assertEqual(2, sum_too_high)
normal
{ "blob_id": "ea86a2a9068c316d3efcbcb165a8ef3d3516ba1b", "index": 4763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass test_AppendAndDelete3(unittest.TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass test_AppendAndDelete3(unittest.TestCase):\n\n def test_hurdleRace(self):\...
[ 0, 1, 2, 3 ]
import cv2 as cv from threading import Thread class Reader(Thread): def __init__(self, width, height, device=0): super().__init__(daemon=True) self._stream = cv.VideoCapture(device) self._stream.set(cv.CAP_PROP_FRAME_WIDTH, width) self._stream.set(cv.CAP_PROP_FRAME_HEIGHT, height)...
normal
{ "blob_id": "73bf31e43394c3f922b00b2cfcd5d88cc0e01094", "index": 2339, "step-1": "<mask token>\n\n\nclass Reader(Thread):\n <mask token>\n\n def __del__(self):\n self._frame = None\n self._stream.release()\n <mask token>\n\n def read(self):\n return self._frame\n", "step-2": "<...
[ 3, 4, 5, 6 ]
import json import os import ipdb from tqdm import tqdm import argparse from os import listdir from os.path import isfile, join import pickle import joblib from collections import Counter from shutil import copyfile import networkx as nx import spacy import nltk import numpy as np nltk.download('stopwords') nltk_stopw...
normal
{ "blob_id": "2da7892722afde5a6f87e3bd6d5763c895ac96c9", "index": 284, "step-1": "<mask token>\n\n\nclass Lang:\n\n def __init__(self):\n super(Lang, self).__init__()\n self.word2index = {}\n self.word2count = {}\n self.index2word = {}\n self.n_words = 0\n\n def index_word...
[ 5, 8, 9, 11, 13 ]
o = input() v = [] s = 0 for i in range(12): col = [] for j in range(12): col.append(float(input())) v.append(col) a = 1 for i in range(1, 12): for j in range(a): s += v[i][j] a+=1 if o == 'S': print("%.1f"%s) if o == 'M': print("%.1f"%(s/66))
normal
{ "blob_id": "0df20722fba6223c9d4fc9f72bfb399b479db6ac", "index": 7917, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n col = []\n for j in range(12):\n col.append(float(input()))\n v.append(col)\n<mask token>\nfor i in range(1, 12):\n for j in range(a):\n s ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Idea: <|reserved_special_token_0|> <|reserved_special_token_0|> def cmd(self): return 'intellij-idea-ultimate-edition %s' % self.folder <|reserved_special_token_1|> <|reserved_special_token_0|> class Idea: def __init__(self, folder): self.folde...
flexible
{ "blob_id": "90fc6e37e3988a2014c66913db61749509db2d53", "index": 1036, "step-1": "<mask token>\n\n\nclass Idea:\n <mask token>\n <mask token>\n\n def cmd(self):\n return 'intellij-idea-ultimate-edition %s' % self.folder\n", "step-2": "<mask token>\n\n\nclass Idea:\n\n def __init__(self, fold...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> files = ['arria2_ddr3.qip'] <|reserved_special_token_1|> files = [ "arria2_ddr3.qip" ]
flexible
{ "blob_id": "cad881dd29be16de8375b3ce6e4a437562a05097", "index": 5426, "step-1": "<mask token>\n", "step-2": "files = ['arria2_ddr3.qip']\n", "step-3": "files = [\n \"arria2_ddr3.qip\"\n ]\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import json import logging logger = logging.getLogger(__name__) from django.db.models import Q from channels_api.bindings import ResourceBinding from .models import LetterTransaction, UserLetter, TeamWord, Dictionary from .serializers import LetterTransactionSerializer, UserLetterSerializer, TeamWordSerializer cla...
normal
{ "blob_id": "c2e0f2eda6ef44a52ee4e192b8eb71bde0a69bff", "index": 8954, "step-1": "<mask token>\n\n\nclass TeamWordBinding(ResourceBinding):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def group_names(self, instance, action):\n return [str(instance.user....
[ 13, 14, 15, 17, 18 ]
import http.server import socketserver from http.server import BaseHTTPRequestHandler, HTTPServer import time import json import io import urllib import requests from lib.Emby_ws import xnoppo_ws from lib.Emby_http import * from lib.Xnoppo import * from lib.Xnoppo_TV import * import lib.Xnoppo_AVR import shutil import ...
normal
{ "blob_id": "2ff85ac059f160fcc6b39b4298e8216cbad77ab3", "index": 504, "step-1": "<mask token>\n\n\ndef get_version():\n return '2.01'\n\n\n<mask token>\n\n\ndef restart():\n print('restart')\n try:\n emby_wsocket.stop()\n except:\n sys.exit()\n sys.exit()\n print('fin restart')\n\...
[ 21, 24, 25, 27, 28 ]
<|reserved_special_token_0|> class Running(object): <|reserved_special_token_0|> def __init__(self, args, device_id): """ :param args: parser.parse_args() :param device_id: 0 or -1 """ self.args = args self.device_id = device_id self.model_flags = ['hid...
flexible
{ "blob_id": "3adb50a6375a73f786369dd22712a657b66f758e", "index": 8432, "step-1": "<mask token>\n\n\nclass Running(object):\n <mask token>\n\n def __init__(self, args, device_id):\n \"\"\"\n :param args: parser.parse_args()\n :param device_id: 0 or -1\n \"\"\"\n self.args ...
[ 7, 16, 17, 18, 24 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Beach', fields=[ ('id', models.AutoField(verbos...
normal
{ "blob_id": "9555e5f75e3045afff6da9228764fca542caf539", "index": 2448, "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 = []\n operat...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np import random import copy class Node(object): ''' Defines a Node Class for storing characteristics and CPT of each node ''' def __init__(self,name): self.parents = [] self.children = [] self.name = name self.cpt=[] self...
normal
{ "blob_id": "eb4bc008b7e68f8a6e80e837fa970d77a5ed3547", "index": 8218, "step-1": "<mask token>\n\n\nclass Node(object):\n \"\"\"\n Defines a Node Class for storing characteristics and CPT of each node\n \"\"\"\n\n def __init__(self, name):\n self.parents = []\n self.children = []\n ...
[ 12, 13, 15, 17, 20 ]
<|reserved_special_token_0|> def run_final_test_days(): sqs = [5] cams = [1] permutations = [(True, True, True)] permutations_names = ['all data perez'] for pidx, p in enumerate(permutations): for s in sqs: for c in cams: data = DataFrameSequenceMulti(False, p[0...
flexible
{ "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 ]
import tensorflow as tf from typing import Optional, Tuple, Union, Callable _data_augmentation = tf.keras.Sequential( [ tf.keras.layers.experimental.preprocessing.RandomFlip("horizontal"), tf.keras.layers.experimental.preprocessing.RandomRotation(0.2), ] ) def _freeze_model( model: tf.ker...
normal
{ "blob_id": "86d42716e05155f9e659b22c42635a8f5b8c4a60", "index": 753, "step-1": "<mask token>\n\n\ndef generate_model(base_model: tf.keras.Model, img_shape: Tuple[Optional[\n int], Optional[int], Optional[int]], freeze: Union[bool, int, float]=\n False, preprocess_input: Optional[Callable]=None, use_data_a...
[ 1, 2, 3, 4, 5 ]
#day11 n = int(input("Enter a number: ")) c = 0 a,b = 0, 1 list = [a, b] for i in range(2,n+1): c = a+b list.append(c) a,b = b, c print(n,"th fibonacci number is ",list[n])
normal
{ "blob_id": "255cdbce1f9f7709165b1a29362026ad92ba4712", "index": 2303, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, n + 1):\n c = a + b\n list.append(c)\n a, b = b, c\nprint(n, 'th fibonacci number is ', list[n])\n", "step-3": "n = int(input('Enter a number: '))\nc = 0\na, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(accuracy_score(true_labels, guesses)) print(recall_score(true_labels, guesses)) print(precision_score(true_labels, guesses)) print(f1_score(true_labels, guesses)) <|reserved_special_token_0|> print(confusion_matrix(true_labe...
flexible
{ "blob_id": "faa53db9dd581b6508fb9e4042ec86ebaf850e60", "index": 5320, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(accuracy_score(true_labels, guesses))\nprint(recall_score(true_labels, guesses))\nprint(precision_score(true_labels, guesses))\nprint(f1_score(true_labels, guesses))\n<mask token>\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def yolo(): root = 'Z:\\' name = '23367640.png' execution_path = os.getcwd() yolo_path = 'Z:\\yolo.h5' localdir = False detector = ObjectDetection() detector.setModelTypeAsYOLOv3() if localdir: detector.setModelPath(os.path.join(execution_path, yolo...
flexible
{ "blob_id": "c80ae9d2eb07fd716a80a5e2d7b5237925fda02c", "index": 5861, "step-1": "<mask token>\n\n\ndef yolo():\n root = 'Z:\\\\'\n name = '23367640.png'\n execution_path = os.getcwd()\n yolo_path = 'Z:\\\\yolo.h5'\n localdir = False\n detector = ObjectDetection()\n detector.setModelTypeAsYO...
[ 2, 3, 4, 5, 6 ]
import abc import numpy as np import ray from tqdm.autonotebook import tqdm from src.algorithm.info_theory.it_estimator import (CachingEstimator, MPCachingEstimator) from src.algorithm.utils import differ, independent_roll, union class FeatureSelector(metaclass=ab...
normal
{ "blob_id": "983473129bfd56138a615e0f5bdb1353e9c6d8af", "index": 6441, "step-1": "<mask token>\n\n\nclass FeatureSelector(metaclass=abc.ABCMeta):\n <mask token>\n\n def _setup(self):\n self.n_features = self.trajectories[0].shape[1] - 1\n self.id_reward = self.n_features\n self.set_rew...
[ 16, 18, 20, 22, 23 ]
# apport hook for oem-config; adds log file import os.path def add_info(report): if os.path.exists('/var/log/oem-config.log'): report['OemConfigLog'] = ('/var/log/oem-config.log',)
normal
{ "blob_id": "74b1cdcb1aaf6cde7e8ce3eeb73cd82689719b00", "index": 6404, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef add_info(report):\n if os.path.exists('/var/log/oem-config.log'):\n report['OemConfigLog'] = '/var/log/oem-config.log',\n", "step-3": "import os.path\n\n\ndef add_info...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class API: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "da66b254afb3a8fcd3783a38d8624caa917e58c3", "index": 652, "step-1": "<mask token>\n\n\nclass API:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 12, 15, 20, 23, 26 ]
# pylint: disable=missing-docstring,function-redefined import uuid from behave import given, then, when import requests from features.steps import utils from testsuite.oauth import authorize from testsuite import fhir ERROR_AUTHORIZATION_FAILED = 'Authorization failed.' ERROR_BAD_CONFORMANCE = 'Could not parse conf...
normal
{ "blob_id": "ef0c9f740f1ca0906aeb7a5c5e5d35baca189310", "index": 6128, "step-1": "<mask token>\n\n\n@given('I am logged in')\ndef step_impl(context):\n assert context.oauth is not None, ERROR_AUTHORIZATION_FAILED\n assert context.oauth.access_token is not None, ERROR_AUTHORIZATION_FAILED\n\n\n@given('I am ...
[ 9, 10, 12, 15, 17 ]
def has23(nums): this = nums[0] == 2 or nums[0] == 3 that = nums[1] == 2 or nums[1] == 3 return this or that
normal
{ "blob_id": "174c4c1ed7f2197e012644999cf23f5e82f4b7c3", "index": 3148, "step-1": "<mask token>\n", "step-2": "def has23(nums):\n this = nums[0] == 2 or nums[0] == 3\n that = nums[1] == 2 or nums[1] == 3\n return this or that\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1 ]
from collections import Counter import pandas as pd import string from collections import namedtuple, defaultdict import csv import sys import torch import numpy as np from sklearn.preprocessing import LabelEncoder from scipy.sparse import coo_matrix from tqdm import tqdm device = torch.device('cuda' if torch.cuda.is_...
normal
{ "blob_id": "613b060ee50b49417342cfa70b36f77d112dcc58", "index": 2951, "step-1": "<mask token>\n\n\ndef get_data():\n df = pd.read_csv('./data/filteredCorpus.csv')\n df_filt = df[df['outcome'] == True]\n df_filt = df_filt[df_filt['role'] == 'speaker']\n df_filt = df_filt[df_filt['source'] == 'human']...
[ 4, 5, 6, 7, 8 ]
import io import xlsxwriter import zipfile from django.conf import settings from django.http import Http404, HttpResponse from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.decorators import login_required from django.contrib import messages from django.views.generic...
normal
{ "blob_id": "a9ebd323d4b91c7e6a7e7179329ae80e22774927", "index": 4843, "step-1": "<mask token>\n\n\nclass PeriodoUpdateView(LoginRequiredMixin, UpdateView):\n <mask token>\n <mask token>\n <mask token>\n\n def get_form_kwargs(self, *args, **kwargs):\n kwargs = super(PeriodoUpdateView, self).ge...
[ 67, 76, 95, 101, 108 ]
from django.contrib import admin from django.urls import path, include from .views import hindex,galeria,mision_vision,direccion,registro,login,logout_vista,registro_insumo,admin_insumos urlpatterns = [ path('',hindex,name='HINDEX'), path('galeria/',galeria,name='GALE'), path('mision/',mision_vision,name=...
normal
{ "blob_id": "dff5a46c6f1eb715fe5e1eec87e42ceb295b0eae", "index": 4650, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', hindex, name='HINDEX'), path('galeria/', galeria,\n name='GALE'), path('mision/', mision_vision, name='MISION'), path(\n 'direccion/', direccion, name='UBICA...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python """ Plot EEG data. Usage: plotting.py [options] [<file>] Options: -h --help Show this screen. --version Show version. --center Center the data before plotting --sample-index=N Row index (indexed from one). --transpose Transpose data. --x...
normal
{ "blob_id": "5bd7160b6b2e283e221aeb0a6913e6d13511c1db", "index": 7073, "step-1": "<mask token>\n\n\nclass TopoPlot(object):\n <mask token>\n\n def __init__(self, data=None, axes=None):\n \"\"\"Setup defaults.\n\n Parameters\n ----------\n data : Pandas.Series or dict\n ...
[ 19, 22, 23, 25, 30 ]
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
normal
{ "blob_id": "f4b704a1416bfd6524340a68a20981957abf4340", "index": 9850, "step-1": "<mask token>\n\n\nclass KibbleESWrapper(object):\n <mask token>\n\n def __init__(self, ES):\n self.ES = ES\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def scroll(sel...
[ 17, 19, 23, 25, 28 ]
<|reserved_special_token_0|> @app.route('/') def hello(): return 'Flask setup' def sheets_row_writer(data_list): print('sheets method invoked') credentials = ServiceAccountCredentials.from_json_keyfile_name( 'mechnepal-test-54c4387178d9.json', scope) client = gspread.authorize(credentials) ...
flexible
{ "blob_id": "267cb37f2ccad5b02a809d9b85327eacd9a49515", "index": 1061, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return 'Flask setup'\n\n\ndef sheets_row_writer(data_list):\n print('sheets method invoked')\n credentials = ServiceAccountCredentials.from_json_keyfile_name(\n 'mec...
[ 5, 6, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(record): answer = [] db = {} chatting = [] for log in record: log_list = log.split() if log_list[0] == 'Enter': db[log_list[1]] = log_list[2] chatting.append([True, log_list[1]]) eli...
flexible
{ "blob_id": "3ffe16494eb45896563a2952f3bcf80fc19b2750", "index": 1226, "step-1": "<mask token>\n", "step-2": "def solution(record):\n answer = []\n db = {}\n chatting = []\n for log in record:\n log_list = log.split()\n if log_list[0] == 'Enter':\n db[log_list[1]] = log_lis...
[ 0, 1, 2, 3 ]
# 튜플(tuple) - 리스트와 구조가 비슷함 #변경, 삭제 할 수 없다. t = ('코스모스', '민들레', '국화') print(t) print(t[:2]) print(t[1:]) #del t[0] - 삭제 안됨 #t[2] ="매화" - 수정 안됨 t2 = (1, 2, 3) t3 = (4,) # 1개 추가하기 (쉼표를 붙임) print(t2) print(t3) print(t2 + t3) # 요소 더하기
normal
{ "blob_id": "45fcafdd30f890ddf5eaa090152fde2e2da4dbef", "index": 732, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(t)\nprint(t[:2])\nprint(t[1:])\n<mask token>\nprint(t2)\nprint(t3)\nprint(t2 + t3)\n", "step-3": "t = '코스모스', '민들레', '국화'\nprint(t)\nprint(t[:2])\nprint(t[1:])\nt2 = 1, 2, 3\nt3 = ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python from lemonpie import lemonpie from flask_debugtoolbar import DebugToolbarExtension def main(): lemonpie.debug = True lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False toolbar = DebugToolbarExtension(lemonpie) lemonpie.run('0.0.0.0') if __name__ == '__main__': main()
normal
{ "blob_id": "328c483bf59c6b84090e6bef8814e829398c5a56", "index": 6954, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n lemonpie.debug = True\n lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False\n toolbar = DebugToolbarExtension(lemonpie)\n lemonpie.run('0.0.0.0')\n\n\n<m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def dict_from_dataflow_generator(df): for sample in df.get_data(): yield sample[0] def split_lmdb_dataset(lmdb_input_path, lmdb_output_path1, lmdb_output_path2, split_ratio1, batch_size, shuffle, serialization_name, compression, compression_arg, max_num_samples=None)...
flexible
{ "blob_id": "a283fd1e4098ea8bb3cc3580438c90e5932ba22f", "index": 5852, "step-1": "<mask token>\n\n\ndef dict_from_dataflow_generator(df):\n for sample in df.get_data():\n yield sample[0]\n\n\ndef split_lmdb_dataset(lmdb_input_path, lmdb_output_path1,\n lmdb_output_path2, split_ratio1, batch_size, sh...
[ 5, 6, 7, 8, 9 ]
from queue import Queue class Node(): def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def array_to_tree_dfs(array): n = len(array) if n>0: root = Node(array[0]) def dfs(node, index): # if index >= n: ...
normal
{ "blob_id": "a52762fb13c04ced07a41a752578c4173d1eac42", "index": 8350, "step-1": "<mask token>\n\n\nclass Node:\n\n def __init__(self, value, left=None, right=None):\n self.value = value\n self.left = left\n self.right = right\n\n\n<mask token>\n\n\ndef tree_to_array_bfs(root):\n q = Q...
[ 4, 5, 6, 7, 8 ]
# Copyright 2008 Google Inc. # # 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,...
normal
{ "blob_id": "57d1fb805fce2ba75ea2962598e809ba35fd7eb6", "index": 3490, "step-1": "<mask token>\n\n\ndef _find_warnings(filename, lines, ast_list, static_is_optional):\n\n def print_warning(node, name):\n print(\"{}:{}: static data '{}'\".format(filename, lines.\n get_line_number(node.start),...
[ 2, 3, 4, 5, 6 ]
import json from flask import current_app, request, jsonify, make_response from flask_cors import cross_origin from alerta.auth.utils import is_authorized, create_token, get_customer from alerta.utils.api import absolute_url, deepmerge from . import auth try: import saml2 import saml2.entity import saml...
normal
{ "blob_id": "b233d212f3a6c453786dc54b2d43578e1faae417", "index": 7292, "step-1": "<mask token>\n\n\ndef spConfig():\n return saml2.config.Config()\n\n\ndef saml_client():\n saml2_config_default = {'entityid': absolute_url(), 'service': {'sp': {\n 'endpoints': {'assertion_consumer_service': [(absolut...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class PurchaseDetail(models.Model): PRODUCT_CHOICES = ('WOOD', 'Wood'), ('GLASS', 'Glass'), ('PLASTIC', 'Plastic'), ('LEATHER', 'Leather'), ('FABRIC', 'Fabric'), ('STEEL', 'Steel') purchase = models.ForeignKey(Purchase, on_delete=models.CASCADE) product_name = ...
flexible
{ "blob_id": "bb3c42c9f87a463b9f18601c9e3897b6d21351d5", "index": 7356, "step-1": "<mask token>\n\n\nclass PurchaseDetail(models.Model):\n PRODUCT_CHOICES = ('WOOD', 'Wood'), ('GLASS', 'Glass'), ('PLASTIC',\n 'Plastic'), ('LEATHER', 'Leather'), ('FABRIC', 'Fabric'), ('STEEL',\n 'Steel')\n purc...
[ 4, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MonitorLocation(Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: app_lab...
flexible
{ "blob_id": "1a4132358fa9bd4cd74970286ec8bb212b1857cd", "index": 5247, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MonitorLocation(Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n app_label = 'sentry'\n db_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .line_detection_research import score_pixel_v3p2
flexible
{ "blob_id": "305554fc86ddc116677b6d95db7d94d9f2213c41", "index": 5088, "step-1": "<mask token>\n", "step-2": "from .line_detection_research import score_pixel_v3p2\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def book(request): Book.objects.create(title=request.POST['b_title'], desc=request.POST[ 'b_desc']) return redirect('/') def author(request): context = {'the_auths': Author.objects.all()} return render(request, 'author.html', context) def auth(request): Aut...
flexible
{ "blob_id": "02bec34b138d53235dc944adeae8ccb8d6b3d340", "index": 4424, "step-1": "<mask token>\n\n\ndef book(request):\n Book.objects.create(title=request.POST['b_title'], desc=request.POST[\n 'b_desc'])\n return redirect('/')\n\n\ndef author(request):\n context = {'the_auths': Author.objects.all...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class ChangeEmail(forms.Form): <|reserved_special_token_0|> class ChangePassword(forms.Form): oldPassword = forms.CharField(required=True, min_length=8, max_length= 80, widget=forms.PasswordInput(attrs={'name': 'oldPassword'})) password1 = forms.CharField(required=Tr...
flexible
{ "blob_id": "503726cd2d70286189f4b8e02acaa3d5f6e29e12", "index": 8538, "step-1": "<mask token>\n\n\nclass ChangeEmail(forms.Form):\n <mask token>\n\n\nclass ChangePassword(forms.Form):\n oldPassword = forms.CharField(required=True, min_length=8, max_length=\n 80, widget=forms.PasswordInput(attrs={'n...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_parse_header(): print() for case_id, case in CASES: ss = SchemaSheet.from_dictreader(case) tc = ss.table_config info_cc = tc.columns[INFO] assert info_cc.name == INFO asse...
flexible
{ "blob_id": "25dc0395da1f1ac2ccd990151c3e5b250802b402", "index": 2749, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_parse_header():\n print()\n for case_id, case in CASES:\n ss = SchemaSheet.from_dictreader(case)\n tc = ss.table_config\n info_cc = tc.columns[INFO...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import folium ctx = '../data/' json = ctx + 'us-states.json' csv = ctx + 'US_Unemployment_Oct2012.csv' data = pd.read_csv(csv) m = folium.Map(location=[37, -102], zoom_start=5) m.choropleth(geo_data=json, name='choropleth', data=data, columns=['State', 'Unemployment'], Key_on='feature.id', fill_...
normal
{ "blob_id": "382cb55a6b849f0240276d8f45746e995b16d714", "index": 4455, "step-1": "<mask token>\n", "step-2": "<mask token>\nm.choropleth(geo_data=json, name='choropleth', data=data, columns=['State',\n 'Unemployment'], Key_on='feature.id', fill_color='YlGn', fill_opacity=\n 0.7, line_opacity=0.2, legend_...
[ 0, 1, 2, 3 ]
# cases where DictAchievement should unlock # >> CASE {'name': 'John Doe', 'age': 24} # >> CASE { 'name': 'John Doe', 'age': 24 } # >> CASE func({'name': 'John Doe', 'age': 24})
normal
{ "blob_id": "874fa2a6afdd04f3f2232a86f56d220447160ede", "index": 5167, "step-1": "<mask token>\n", "step-2": "{'name': 'John Doe', 'age': 24}\n{'name': 'John Doe', 'age': 24}\nfunc({'name': 'John Doe', 'age': 24})\n", "step-3": "# cases where DictAchievement should unlock\n\n# >> CASE\n{'name': 'John Doe', '...
[ 0, 1, 2 ]
import json import sys from os import listdir from os.path import isfile, join import params def encodeText(tweet_text): tweet_text = tweet_text.replace('\n',' ') return str(tweet_text) def parse_file(file_in, file_out): ptrFile_in = open(file_in, "r") ptrFile_out = open(file_out, "w", encoding=...
normal
{ "blob_id": "e3afaabc1f7f64b9189fc88dd478ed75e81f35e1", "index": 4564, "step-1": "<mask token>\n\n\ndef parse_file(file_in, file_out):\n ptrFile_in = open(file_in, 'r')\n ptrFile_out = open(file_out, 'w', encoding='utf-8')\n cleanLines = []\n for line in ptrFile_in:\n cleanLine = {}\n l...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> result_dir = 'results' data_dir = 'datasets' cache_dir = f'{ROOT_PATH}/data/cache' run_dir_ignore = ['results', 'datasets', 'cache'] use_treeconnect = False treeconnect_threshold = 1024 vgg16 = 'vgg16_zhang_perceptual.pkl' model =...
flexible
{ "blob_id": "cb904408486ad9ea8cc0c8ff2ec393e480309a57", "index": 2403, "step-1": "<mask token>\n", "step-2": "<mask token>\nresult_dir = 'results'\ndata_dir = 'datasets'\ncache_dir = f'{ROOT_PATH}/data/cache'\nrun_dir_ignore = ['results', 'datasets', 'cache']\nuse_treeconnect = False\ntreeconnect_threshold = 1...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('test 123123')
flexible
{ "blob_id": "c6d8b9faa610e817c449eee94d73c61cb62fa272", "index": 8878, "step-1": "<mask token>\n", "step-2": "print('test 123123')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def forc(X): Xi = X['Xi'] Yi = X['Yi'] Zi = X['Zi'] SEi = X['SEi'] Pi = X['Pi'] Hc1 = X['Hc1'] Hc2 = X['Hc2'] Hb1 = X['Hb1'] Hb2 = X['Hb2'] style = {'description_width': 'initial'} colorbar_widge = widgets.Checkbox(value=False, description= ...
flexible
{ "blob_id": "e5a4ae2ec0fab1ca8cdce229c69725ece2dcc476", "index": 8272, "step-1": "<mask token>\n\n\ndef forc(X):\n Xi = X['Xi']\n Yi = X['Yi']\n Zi = X['Zi']\n SEi = X['SEi']\n Pi = X['Pi']\n Hc1 = X['Hc1']\n Hc2 = X['Hc2']\n Hb1 = X['Hb1']\n Hb2 = X['Hb2']\n style = {'description_w...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Vocabulary(db.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...
flexible
{ "blob_id": "834469f9c6e065fb29dfe1fd3e421fbb752f5094", "index": 7708, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Vocabulary(db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Vocabulary(db.Model):\n _id = db.Column...
[ 0, 1, 2, 3 ]
import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('modi.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) #Write the for loop code h...
normal
{ "blob_id": "759ff4cc123e85bdc8c1457bb521cd35841956cd", "index": 482, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('img', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nface_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\neye_cascade = cv...
[ 0, 1, 2, 3, 4 ]
import numpy.random as rnd import numpy as np B=100000 N1=50 N2=50 p1mle=0.3 p2mle=0.4 taumle=p2mle-p1mle estimate=[] for i in range(B): p1=0.0 for j in range(N1): if(rnd.uniform(0,1)<p1mle): p1+=1 p1/=N1 p2=0.0 for j in range(N2): if(rnd.uniform(0,1)<p2mle): p2+=1 p2/=N2 estimate.append(p2-p...
normal
{ "blob_id": "0db0daf9bea254cffaec1280cd13b2d70368cd94", "index": 289, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(B):\n p1 = 0.0\n for j in range(N1):\n if rnd.uniform(0, 1) < p1mle:\n p1 += 1\n p1 /= N1\n p2 = 0.0\n for j in range(N2):\n if rnd.u...
[ 0, 1, 2, 3, 4 ]
"""This program displays a customizable list of items by priority value, with priority 1 being the highest. Allows the user to add, edit, mark complete, show completed (hidden), and remove items. Stores the list of items in a .txt file located where this program's main.py file is. All changes are automatically save...
normal
{ "blob_id": "168a12e6653a0526f29c163913def50147481154", "index": 632, "step-1": "<mask token>\n\n\nclass ListItem:\n \"\"\"A custom object that stores four pieces of data representing each\n entry in the todo list. Contains the text of the todo list entry,\n the priority of the entry, the group code (NY...
[ 8, 11, 12, 18, 24 ]
<|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 = [m...
flexible
{ "blob_id": "fa09937ce64952795ae27cb91bf2c52dfb3ef4da", "index": 4532, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
from flask import Blueprint, request, make_response from flask_expects_json import expects_json from server.validation.schemas import guest_calendar_schema from tools.for_db.work_with_booking_info import add_booking_info_and_get_uuid from tools.for_db.work_with_links import get_link from tools.build_response import bui...
normal
{ "blob_id": "75ef5dd2b82cf79819f18045559f9850c74bb55a", "index": 5565, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@guest_calendar_post.route('/calendars/<link_id>/bookings/', methods=['POST'])\n@expects_json(guest_calendar_schema)\ndef booking(link_id):\n request_body = request.get_json()\n ...
[ 0, 1, 2, 3 ]
import requests, vars def Cardid(name): query = {"key":vars.Key, "token":vars.Token, "cards":"visible"} execute = requests.request("GET", vars.BoardGetUrl, params=query).json() for row in execute['cards']: if row['name'] == name: cardID = 1 break else: ca...
normal
{ "blob_id": "68493acce71060799da8c6cb03f2ddffce64aa92", "index": 8970, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Cardid(name):\n query = {'key': vars.Key, 'token': vars.Token, 'cards': 'visible'}\n execute = requests.request('GET', vars.BoardGetUrl, params=query).json()\n for row in...
[ 0, 1, 2, 3 ]
import shell def executeUpgrade(): shell.executeCommand('pkg upgrade') def executeInstall(pkg_name): shell.executeCommand('pkg install ' + pkg_name) def executeRemove(pkg_name): shell.executeCommand('pkg remove ' + pkg_name) shell.executeCommand('pkg autoremove') def executeFindByName(name): ...
normal
{ "blob_id": "db55a603615c7d896569ada84f3110dd6c0ce45f", "index": 1250, "step-1": "<mask token>\n\n\ndef executeUpgrade():\n shell.executeCommand('pkg upgrade')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef executeUpgrade():\n shell.executeCommand('pkg upgrade')\n\n\n<mask token>\n\n\ndef execute...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # coding: utf-8 import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tensorflow as tf print(tf.__version__) print(tf.keras.__version__) print(tf.__path__) import numpy as np from tqdm import tqdm, tqdm_notebook from utils import emphasis import tensorflow.keras.backend as K from tensorflow....
normal
{ "blob_id": "08a0ab888886184f7447465508b6494b502821ea", "index": 8903, "step-1": "#!/usr/bin/env python\n# coding: utf-8\n\nimport os\nos.environ['CUDA_VISIBLE_DEVICES'] = '0'\nimport tensorflow as tf\nprint(tf.__version__)\nprint(tf.keras.__version__)\nprint(tf.__path__)\nimport numpy as np\n\nfrom tqdm import ...
[ 0 ]
from odoo import models, fields, api class Aceptar_letras_wizard(models.TransientModel): _name = 'aceptar_letras_wizard' _description = "Aceptar letras" def _get_letras(self): if self.env.context and self.env.context.get('active_ids'): return self.env.context.get('active_ids') ...
normal
{ "blob_id": "4ad3390f8f2c92f35acde507be7a7b713af997f2", "index": 5092, "step-1": "<mask token>\n\n\nclass Aceptar_letras_wizard(models.TransientModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @api.multi\n def aceptar_letras(self):\n active_ids = self.env.context.g...
[ 2, 3, 4, 5, 6 ]
"""PriceTrail URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
normal
{ "blob_id": "06627821c09d02543974a3c90664e84e11c980ed", "index": 7631, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^admin/', admin.site.urls), url('^logout/$', auth_views\n .logout, {'next_page': '/'}, name='logout'), url('^$', index_view, name\n ='index'), url('^login/$', lo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ReloadModelHandler(BaseHandler): def __init__(self, application, request, **kwargs): super(ReloadModelHandler, self).__init__(application, request, **kwargs ) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cla...
flexible
{ "blob_id": "a8ae59bb525c52ef852655f0ef1e32d96c8914d6", "index": 1356, "step-1": "<mask token>\n\n\nclass ReloadModelHandler(BaseHandler):\n\n def __init__(self, application, request, **kwargs):\n super(ReloadModelHandler, self).__init__(application, request, **kwargs\n )\n <mask token>\n...
[ 2, 3, 4, 5, 6 ]
# CS 5010 Project # Team Metro # Test the data cleaning import unittest from cleaning_data import dfClean # import the dataframe we created after cleaning the data class DataTypesTestCase(unittest.TestCase): # we will test that each column has the correct data type # note that there is a strange occurenc...
normal
{ "blob_id": "9d0727970c760a9a8123c5c07359ba5c538cea3c", "index": 5926, "step-1": "<mask token>\n\n\nclass DataTypesTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_is_rain_a_float(self):\n rain = dfClean.iloc[4908, 2]\n self.assertTrue(isinstance(rain, float))\n <...
[ 18, 19, 29, 31, 33 ]
def test(name,message): print("用户是:" , name) print("欢迎消息是:",message) my_list = ['孙悟空','欢迎来疯狂软件'] test(*my_list) print('*****') # ########################### def foo(name,*nums): print("name参数:",name) print("nums参数:",nums) my_tuple = (1,2,3) foo('fkit',*my_tuple) print('********') foo(*my_tuple) print(...
normal
{ "blob_id": "64fb006ea5ff0d101000dd4329b3d957a326ed1a", "index": 2387, "step-1": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n", "step-2": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n\n\ndef foo(name,...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def containsDuplicate(self, nums) ->bool: d = {} for elem in nums: if elem in d: r...
flexible
{ "blob_id": "89256a38208be92f87115b110edc986cebc95306", "index": 8440, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def containsDuplicate(self, nums) ->bool:\n d = {}\n for elem in nums:\n if elem in ...
[ 0, 1, 2, 3, 4 ]
#encoding=utf-8 import pytest from frame_project.实战2.main_page import MainPage class TestMian: def test_mian(self): MainPage().goto_marketpage().goto_search().search() if __name__ == '__main__': pytest.main(['test_case.py','-s','-v'])
normal
{ "blob_id": "e1751cc6f76f56e62cd02d61db65f1c27a4ff1b9", "index": 7351, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestMian:\n\n def test_mian(self):\n MainPage().goto_marketpage().goto_search().search()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass TestMian:\n\n de...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LabeledArray: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LabeledArray: @staticmethod def get_label_for_indexes_upto(input_data, input_label, input_index):...
flexible
{ "blob_id": "0dea8675d8050a91c284a13bcbce6fd0943b604e", "index": 5135, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LabeledArray:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LabeledArray:\n\n @staticmethod\n def get_label_for_indexes_upto(input_data, input_label, input_in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DongPhamTestCli(CLI): <|reserved_special_token_0|> def __init__(self, _mininet, _env): self.env = _env self.net = _mininet self._testCLI = {} CLI.__init__(self, _mininet) <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "7636925982434b12307383ba7b01f931f7ea6e24", "index": 5927, "step-1": "<mask token>\n\n\nclass DongPhamTestCli(CLI):\n <mask token>\n\n def __init__(self, _mininet, _env):\n self.env = _env\n self.net = _mininet\n self._testCLI = {}\n CLI.__init__(self, _mininet)\n ...
[ 10, 18, 21, 26, 27 ]
#!/usr/bin/env python # USAGE: day_22_01.py # Michael Chambers, 2017 class Grid: def __init__(self, startFile): # Load initial infected sites # Origin is top-left of input file self.infected = set() posx = 0 with open(startFile, 'r') as fo: for i, line in enumerate(fo): line = line.rstrip() posx...
normal
{ "blob_id": "f840624ec11679d576fbb80f8e753c59663a7ee2", "index": 9168, "step-1": "<mask token>\n\n\nclass ComplexGrid:\n\n def __init__(self, startFile):\n self.weakened = set()\n self.infected = set()\n self.flagged = set()\n posx = 0\n with open(startFile, 'r') as fo:\n ...
[ 6, 7, 11, 13, 14 ]
from django.shortcuts import render from rest_framework import status, viewsets , response from . import models from . import serializers # Create your views here. class TodoViewset(viewsets.ModelViewSet): queryset = models.Todo.objects.all() serializer_class = serializers.TodoSerializer
normal
{ "blob_id": "1c668cf6f145b85a09b248fefda46e928de64e41", "index": 5041, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TodoViewset(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TodoViewset(viewsets.ModelViewSet):\n queryset = models.Todo....
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 from __future__ import division, unicode_literals import unittest from monty.inspect import * class LittleCatA(object): pass class LittleCatB(LittleCatA): pass class LittleCatC(object): pass class LittleCatD(LittleCatB): pass class InspectTest(unittest.TestCase): def test_fu...
normal
{ "blob_id": "89605ff723d2f78e85cae458d576494718b5d456", "index": 1193, "step-1": "<mask token>\n\n\nclass InspectTest(unittest.TestCase):\n\n def test_func(self):\n self.assertTrue(find_top_pyfile())\n self.assertTrue(caller_name())\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 2, 5, 6, 9, 10 ]
def towers_of_hanoi(n, src, dest, temp,res): if n==1: s = 'disk 1 from ',src,'->',dest res.append(s) return towers_of_hanoi(n-1, src, temp, dest, res) s = 'disk ',n, ' from ',src,'->',dest res.append(s) towers_of_hanoi(n-1, temp, dest, src, res) return res def steps...
normal
{ "blob_id": "f23bfef2daf8fda4249435821dbc2e0b1846e3d6", "index": 9842, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef steps_in_tower_of_hanoi(no_of_disks):\n res = towers_of_hanoi(no_of_disks, 'A', 'C', 'B', [])\n return res\n\n\n<mask token>\n", "step-3": "def towers_of_hanoi(n, src, des...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_board_can_be_instatiated_with_any_set_of_pieces(): board = Board(initial_pieces={'a2': Pawn('white'), 'a6': Pawn('black')}) assert board.pieces_quantity() == 2 def test_piece_cant_capture_an_ally(): board = Board(initial_pieces={'e5': Pawn('white'), 'f3': Knight('wh...
flexible
{ "blob_id": "5f471fb75b1c4f6fc7aa4cb4f99f9c1a1a9f0ea1", "index": 8595, "step-1": "<mask token>\n\n\ndef test_board_can_be_instatiated_with_any_set_of_pieces():\n board = Board(initial_pieces={'a2': Pawn('white'), 'a6': Pawn('black')})\n assert board.pieces_quantity() == 2\n\n\ndef test_piece_cant_capture_a...
[ 3, 7, 9, 10, 11 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: in...
flexible
{ "blob_id": "b7c43f4242e38318c9e5423ea73e9d9d86759a53", "index": 4663, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def lengthOfLongestSubstring(self, s):\n \"\"\"\n :type s: str\n ...
[ 1, 2, 3, 4, 5 ]
import random def take_second(element): return element[1] import string def get_random_name(): name = "" for i in range(random.randint(5, 15)): name += random.choice(string.ascii_letters) return name imenik = [(777, "zejneba"), (324, "fahro"), (23, "fatih"), (2334, "muamer"), (435, "keri...
normal
{ "blob_id": "21ef8103a5880a07d8c681b2367c2beef727260f", "index": 6536, "step-1": "<mask token>\n\n\ndef take_second(element):\n return element[1]\n\n\n<mask token>\n\n\ndef get_random_name():\n name = ''\n for i in range(random.randint(5, 15)):\n name += random.choice(string.ascii_letters)\n r...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 import argparse import boutvecma import easyvvuq as uq import chaospy import os import numpy as np import time from dask.distributed import Client from dask_jobqueue import SLURMCluster import matplotlib.pyplot as plt if __name__ == "__main__": parser = argparse.ArgumentParser(description...
normal
{ "blob_id": "416f4c6bbd2f2b9562ab2d1477df4ebc45070d8d", "index": 5060, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='EasyVVUQ applied to BOUT++')\n parser.add_argument('--batch', '-b', help=\n 'Run on a batch (SLURM)...
[ 0, 1, 2, 3 ]
# coding: utf-8 # In[1]: import numpy as np import pandas as pd from sklearn.svm import SVR # In[2]: from sklearn.preprocessing import StandardScaler # In[3]: #import matplotlib.pyplot as plt # %matplotlib inline # In[90]: aapl = pd.read_csv('return_fcast.csv') # In[79]: y = aapl['return'] # In[80]: ...
normal
{ "blob_id": "4a8d203872a1e86c54142dea6cd04c1cac6bcfb2", "index": 5067, "step-1": "<mask token>\n", "step-2": "<mask token>\nregressor.fit(X, y)\n<mask token>\nX_test.shape\n<mask token>\ny_pred\n<mask token>\ny_pred\nfor i in range(len(y_pred)):\n print(y_pred[i])\n<mask token>\nVIX.iloc[40:2476]\n<mask tok...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render, HttpResponse, redirect from ..login.models import * from ..dashboard.models import * def display(request, id): context = {'job': Job.objects.get(id=int(id))} return render(request, 'handy_helper_exam/display.html', context)
normal
{ "blob_id": "f1fdba1c07a29aa22ee8d0dcbd6f902aa2e8b4c2", "index": 9342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef display(request, id):\n context = {'job': Job.objects.get(id=int(id))}\n return render(request, 'handy_helper_exam/display.html', context)\n", "step-3": "from django.short...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Wed Oct 3 16:04:19 2018 @author: khanhle """ # Create first network with Keras from keras.models import Sequential from keras.layers import Dense from keras.layers import Activation from keras.utils import np_utils from keras.layers.convolutional import Convolut...
normal
{ "blob_id": "721f23d2b6109194b8bca54b1cd04263e30cdf24", "index": 3964, "step-1": "<mask token>\n\n\ndef cnn_model():\n model = Sequential()\n model.add(ZeroPadding2D((1, 1), input_shape=(1, 20, window_sizes)))\n model.add(Convolution2D(32, nb_kernels, nb_kernels))\n model.add(Activation('relu'))\n ...
[ 1, 2, 3, 4, 5 ]
#!python3 import requests import time log_file = open("logfile.txt", "w") def generateLog(ctime1, request_obj): log_file.write(ctime1 + "\t") log_file.write("Status code: " + str(request_obj.status_code)) log_file.write("\n") def is_internet(): """Internet function""" print(time....
normal
{ "blob_id": "f229f525c610d9925c9300ef22208f9926d6cb69", "index": 9985, "step-1": "<mask token>\n\n\ndef generateLog(ctime1, request_obj):\n log_file.write(ctime1 + '\\t')\n log_file.write('Status code: ' + str(request_obj.status_code))\n log_file.write('\\n')\n\n\ndef is_internet():\n \"\"\"Internet ...
[ 2, 3, 4, 5, 6 ]
import argparse from ray.tune.config_parser import make_parser from ray.tune.result import DEFAULT_RESULTS_DIR EXAMPLE_USAGE = """ Training example: python ./train.py --run DQN --env CartPole-v0 --no-log-flatland-stats Training with Config: python ./train.py -f experiments/flatland_random_sparse_small/global...
normal
{ "blob_id": "79a8ff0000f3be79a62d693ed6bae7480673d970", "index": 6075, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_parser(parser_creator=None):\n parser = make_parser(parser_creator=parser_creator, formatter_class=\n argparse.RawDescriptionHelpFormatter, description=\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Unit(Atom, RelMeths, ArithMeths): is_positive = True is_commutative = True def __init__(self, name, abbrev): self.name = name self.abbrev = abbrev def tostr(self, level=0): return self.abbrev def __eq__(self, other): return isin...
flexible
{ "blob_id": "c0e1c0c4545777a669fac19900239ab9baade242", "index": 5993, "step-1": "<mask token>\n\n\nclass Unit(Atom, RelMeths, ArithMeths):\n is_positive = True\n is_commutative = True\n\n def __init__(self, name, abbrev):\n self.name = name\n self.abbrev = abbrev\n\n def tostr(self, le...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for key in my_dict: print('{} - {}'.format(key, my_dict[key])) <|reserved_special_token_1|> my_dict = {'one': '1', 'two': '2'} for key in my_dict: print('{} - {}'.format(key, my_dict[key]))
flexible
{ "blob_id": "1d524312cbd3b735850046131f31c03fdfa90bbc", "index": 483, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))\n", "step-3": "my_dict = {'one': '1', 'two': '2'}\nfor key in my_dict:\n print('{} - {}'.format(key, my_dict[key]))...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def similarity_metric(embedding1: numpy.ndarray, embedding2: numpy.ndarray ) ->float: return numpy.nan_to_num(1 - cosine(embedding1, embedding2), 0) <|reserved_special_token_1|> import numpy from scipy.spatial.distanc...
flexible
{ "blob_id": "ec9f27b4313f72ae6eb7e8280d47de226aeb6bb1", "index": 2270, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef similarity_metric(embedding1: numpy.ndarray, embedding2: numpy.ndarray\n ) ->float:\n return numpy.nan_to_num(1 - cosine(embedding1, embedding2), 0)\n", "step-3": "import ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @tf.function def train_discrepancy_1(main_data, main_labels, target_data): with tf.GradientTape(persistent=True) as tape: shared_main = [shared[i](main_data, training=True) for i in range( NUM_MODELS)] main_logits_1 = [main_classifier_1[i](shared_main[i], t...
flexible
{ "blob_id": "465d5baae8d5be77fbf3d550d10667da420a8fbe", "index": 8608, "step-1": "<mask token>\n\n\n@tf.function\ndef train_discrepancy_1(main_data, main_labels, target_data):\n with tf.GradientTape(persistent=True) as tape:\n shared_main = [shared[i](main_data, training=True) for i in range(\n ...
[ 1, 3, 4, 5, 7 ]
<|reserved_special_token_0|> class RecipeAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: model = Recipe def make_visible(self, request, queryset): queryset.update(visible...
flexible
{ "blob_id": "65bb3743ca569c295d85016c82c4f6f043778d3f", "index": 8848, "step-1": "<mask token>\n\n\nclass RecipeAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Recipe\n\n def make_visible(self, request, queryset):\n ...
[ 3, 5, 6, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ShortenConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ShortenConfig(AppConfig): default_auto_field = 'django.db...
flexible
{ "blob_id": "8c2920db7fc49d56aa8da6289cd22272ed3e3283", "index": 4402, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ShortenConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ShortenConfig(AppConfig):\n default_auto_field = 'django.db.models.BigA...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @DatasetReader.register('bertclassification') class ClassificationReader(DatasetReader): <|reserved_special_token_0|> @overrides def _read(self, file_path: str) ->Iterable[Instance]: file_path = cached_path(file_path) with open(file_path, 'r') as data_file: ...
flexible
{ "blob_id": "21172985bf36302f6b0b2101e353d9fbcafb0673", "index": 6653, "step-1": "<mask token>\n\n\n@DatasetReader.register('bertclassification')\nclass ClassificationReader(DatasetReader):\n <mask token>\n\n @overrides\n def _read(self, file_path: str) ->Iterable[Instance]:\n file_path = cached_...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): x = float(input('Coordenada x: ')) y = float(input('Coordenada y: ')) if 1 <= y <= 2 and -3 <= x <= 3: print('dentro') elif (4 <= y <= 5 or 6 <= x <= 7) and (-4 <= x <= -3 or -2 <= x <= -1 or 1 <= x <= 2 or 3 <= x <...
flexible
{ "blob_id": "06cb832c3adae95fcd1d1d2d0663641d3ac671ef", "index": 9132, "step-1": "<mask token>\n", "step-2": "def main():\n x = float(input('Coordenada x: '))\n y = float(input('Coordenada y: '))\n if 1 <= y <= 2 and -3 <= x <= 3:\n print('dentro')\n elif (4 <= y <= 5 or 6 <= x <= 7) and (-4...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def mk_dir_recursive(dir_path): if os.path.isdir(dir_path): return h, t = os.path.split(dir_path) if not os.path.isdir(h): mk_dir_recursive(h) new_path = join_paths(h, t) if not os.path.isdir(new_path): os.mkdir(new_path) <|reserved_special_to...
flexible
{ "blob_id": "9f4cd9ed8aea03f5908aef4a154d964f0810619b", "index": 9820, "step-1": "<mask token>\n\n\ndef mk_dir_recursive(dir_path):\n if os.path.isdir(dir_path):\n return\n h, t = os.path.split(dir_path)\n if not os.path.isdir(h):\n mk_dir_recursive(h)\n new_path = join_paths(h, t)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print((lambda myself: lambda n: IF(IS_ZERO(n))(lambda _: ONE)(lambda _: MULT(n)(myself(myself)(SUB1(n)))))(lambda myself: lambda n: IF(IS_ZERO( n))(lambda _: ONE)(lambda _: MULT(n)(myself(myself)(SUB1(n)))))(6)) <|reserv...
flexible
{ "blob_id": "f8601ed7ba7c2b8d2dd8d5f74f7b5ae8e99dad78", "index": 186, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint((lambda myself: lambda n: IF(IS_ZERO(n))(lambda _: ONE)(lambda _:\n MULT(n)(myself(myself)(SUB1(n)))))(lambda myself: lambda n: IF(IS_ZERO(\n n))(lambda _: ONE)(lambda _: MULT(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MyTestCase(TestCase): def test_mark_done(self): user = User.objects.create_user(email='user@…', username='user', password='somepasswd') todo = Todo(title='SomeTitle', description='SomeDescr...
flexible
{ "blob_id": "5c81ddbc8f5a162949a100dbef1c69551d9e267a", "index": 37, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MyTestCase(TestCase):\n\n def test_mark_done(self):\n user = User.objects.create_user(email='user@…', username='user',\n password='somepasswd')\n todo ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @csrf_exempt def TBGRApi(request, tbgrno=0): if request.method == 'GET': tbgrs = TBGR.objects.all() tbgrs_serializer = TBGRSerializer(tbgrs, many=True) return JsonResponse(tbgrs_serializer.data, safe=False) elif request.method == 'POST': tbgr_data =...
flexible
{ "blob_id": "e0c6fb414d87c0a6377538089226e37b044edc70", "index": 8383, "step-1": "<mask token>\n\n\n@csrf_exempt\ndef TBGRApi(request, tbgrno=0):\n if request.method == 'GET':\n tbgrs = TBGR.objects.all()\n tbgrs_serializer = TBGRSerializer(tbgrs, many=True)\n return JsonResponse(tbgrs_se...
[ 3, 4, 5, 7, 8 ]
# O(logn) T O(1) S def binarySearch(array, target): if len(array) == 0: return -1 else: return binarySearchR(array, target, 0, len(array) - 1) def binarySearchR(array, target, leftPointer, rightPointer): if leftPointer > rightPointer: return -1 else: midPointer = (leftP...
normal
{ "blob_id": "57d6b9e7f48d32e5d10bfd6a340ea56281f5d82d", "index": 1890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef binarySearchR(array, target, leftPointer, rightPointer):\n if leftPointer > rightPointer:\n return -1\n else:\n midPointer = (leftPointer + rightPointer) // 2\...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import scrapy import re class LeedsAcUkSpider(scrapy.Spider): name = 'leeds_ac_uk' allowed_domains = ['webprod3.leeds.ac.uk'] start_urls = ['http://webprod3.leeds.ac.uk/catalogue/dynmodules.asp?Y=201920&M=ANAT-3105'] def parse(self, response): item = {} item['Su...
normal
{ "blob_id": "fb4a95197882cc6fe72a5f3c2420a474d9cd97aa", "index": 7751, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LeedsAcUkSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n item = {}\n item['Subject'] = response.cs...
[ 0, 2, 3, 4, 5 ]