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|> def problem127(): GOAL = 120000 rad = {} for primes in genFactors(GOAL): rad[product(primes)] = set(primes), product(set(primes)) def relprime(s, t): return s & t == set() found = 0 total...
flexible
{ "blob_id": "646f6a0afc3dc129250c26270dda4355b8cea080", "index": 1003, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef problem127():\n GOAL = 120000\n rad = {}\n for primes in genFactors(GOAL):\n rad[product(primes)] = set(primes), product(set(primes))\n\n def relprime(s, t):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MostSpider(scrapy.Spider): <|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_to...
flexible
{ "blob_id": "3583ce664bc9f42ef8f751de8642997819e08e31", "index": 7793, "step-1": "<mask token>\n\n\nclass MostSpider(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 <mask token>\n\n def downloa...
[ 2, 4, 5, 6, 7 ]
import matplotlib; matplotlib.use('agg') import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit from uncertainties import ufloat #Holt Werte aus Textdatei I, U = np.genfromtxt('werte2.txt', unpack=True) #Definiert Funktion mit der ihr fitten wollt (hier eine Gerade) def f(x,...
normal
{ "blob_id": "4932a357cfd60cb65630345e75794ebf58b82c82", "index": 8696, "step-1": "<mask token>\n", "step-2": "<mask token>\nmatplotlib.use('agg')\n<mask token>\n\n\ndef f(x, A, B):\n return A * x + B\n\n\n<mask token>\nplt.plot(x_plot, f(x_plot, *params), 'k-', label='Anpassungsfunktion',\n linewidth=0.5...
[ 0, 2, 3, 4, 5 ]
<|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": "a5dff32dfbe93ba081144944381b96940da541ad", "index": 7802, "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 = [('doctor', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Before PCA', final_df) for i in pca_df.columns: final_df[i] = pca_df[i] print('After PCA', final_df) <|reserved_special_token_0|> final_df.iloc[:cut].to_csv('pca_stop_train_sig_wc.csv', header=False, index =False) f...
flexible
{ "blob_id": "f8bb2851192a53e94e503c0c63b17477878ad9a7", "index": 6926, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Before PCA', final_df)\nfor i in pca_df.columns:\n final_df[i] = pca_df[i]\nprint('After PCA', final_df)\n<mask token>\nfinal_df.iloc[:cut].to_csv('pca_stop_train_sig_wc.csv', h...
[ 0, 1, 2, 3, 4 ]
def merge_the_tools(string, k): # your code goes here num_sub_strings = len(string)/k #print num_sub_strings for idx in range(num_sub_strings): print "".join(set(list(string[idx * k : (idx + 1) * k])))
normal
{ "blob_id": "e95bda8be2294c295d89f1c035bc209128fa29c8", "index": 228, "step-1": "def merge_the_tools(string, k):\n # your code goes here\n num_sub_strings = len(string)/k\n #print num_sub_strings\n\n for idx in range(num_sub_strings):\n print \"\".join(set(list(string[idx * k : (idx + 1) * k])...
[ 0 ]
import os import cv2 import numpy as np from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from numpy import array import tensorflow as tf TRAIN_DIR = 'C:/Users/vgg/untitled/MNIST/trainingSet/' train_folder_list = array(os.listdir(TRAIN_DIR)) train_input = [] tr...
normal
{ "blob_id": "01339324ad1a11aff062e8b27efabf27c97157fb", "index": 9908, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor index in range(len(train_folder_list)):\n path = os.path.join(TRAIN_DIR, train_folder_list[index])\n path = path + '/'\n img_list = os.listdir(path)\n for img in img_list:...
[ 0, 1, 2, 3, 4 ]
# # Copyright 2016 The BigDL Authors. # # 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 ...
normal
{ "blob_id": "ce69f7b7cf8c38845bfe589c83fdd6e43ab50912", "index": 3708, "step-1": "<mask token>\n\n\nclass Adam(Optimizer):\n <mask token>\n\n def __init__(self, learningrate: float=0.001, learningrate_decay: float\n =0.0, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08\n ) ->None:\...
[ 19, 29, 33, 35, 41 ]
<|reserved_special_token_0|> def main(): r4m = Route4Me(API_KEY) route = r4m.route response = route.get_routes(limit=1, offset=0) if isinstance(response, dict) and 'errors' in response.keys(): print('. '.join(response['errors'])) else: route_id = response[0]['route_id'] pri...
flexible
{ "blob_id": "bc4684d255a46427f708d8ce8bda2e12fb8c8ffe", "index": 238, "step-1": "<mask token>\n\n\ndef main():\n r4m = Route4Me(API_KEY)\n route = r4m.route\n response = route.get_routes(limit=1, offset=0)\n if isinstance(response, dict) and 'errors' in response.keys():\n print('. '.join(respo...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from django.shortcuts import get_object_or_404 from rest_framework import serializers from tandlr.core.api.serializers import ModelSerializer from tandlr.users.models import DeviceUser, User, UserSettings from tandlr.utils.refresh_token import create_token class LoginSerializer(serializers.S...
normal
{ "blob_id": "01900c1d14a04ee43553c8602a07e0c6ecfabded", "index": 1803, "step-1": "<mask token>\n\n\nclass LogoutSerializer(ModelSerializer):\n <mask token>\n <mask token>\n\n\n class Meta:\n model = DeviceUser\n fields = ['device_user_token', 'device_os', 'is_active']\n <mask token>\n ...
[ 9, 11, 15, 17, 19 ]
#### про enumerate ##s = input() ##for index, letter in enumerate(s): ## print(index,':',letter) #### то же что и ##for i in range(len(s)): ## print (i,':', s[i]) #### номер начала каждого слова ##st = input() ##for index, symbol in enumerate(st): ## if symbol == ' ' and index != len(st)-1 or index == 0 or in...
normal
{ "blob_id": "f4bfef2ee78b87184cc72666fade949f8f931fc3", "index": 826, "step-1": "#### про enumerate\n##s = input()\n##for index, letter in enumerate(s):\n## print(index,':',letter)\n#### то же что и\n##for i in range(len(s)):\n## print (i,':', s[i])\n\n#### номер начала каждого слова\n##st = input()\n##for...
[ 1 ]
#! /usr/bin/env python import roslib roslib.load_manifest('learning_tf') import rospy import actionlib from geometry_msgs.msg import Twist from turtlesim.msg import Pose from goal.msg import moveAction, moveGoal if __name__ == '__main__': rospy.init_node('move_client') client = actionlib.SimpleActionClient('...
normal
{ "blob_id": "791935f63f7a0ab2755ad33369d2afa8c10dffbb", "index": 4708, "step-1": "<mask token>\n", "step-2": "<mask token>\nroslib.load_manifest('learning_tf')\n<mask token>\nif __name__ == '__main__':\n rospy.init_node('move_client')\n client = actionlib.SimpleActionClient('moveTo', turtlesim_)\n cli...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def word_count(phrase): phrase = re.sub('\\W+|_', ' ', phrase.lower(), flags=re.UNICODE) word_list = phrase.split() wordfreq = [word_list.count(p) for p in word_list] return dict(zip(word_list, wordfreq)) <|res...
flexible
{ "blob_id": "e12905efa0be7d69e2719c05b40d18c50e7e4b2e", "index": 4933, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef word_count(phrase):\n phrase = re.sub('\\\\W+|_', ' ', phrase.lower(), flags=re.UNICODE)\n word_list = phrase.split()\n wordfreq = [word_list.count(p) for p in word_list]...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(int(input())): imp = input() if bool(re.search('[a-zA-Z0-9]{10}', imp)) and bool(re.search( '([A-Z].*){2}', imp)) and bool(re.search('([0-9].*){3}', imp) ) and not bool(re.search('.*(.).*\\1'...
flexible
{ "blob_id": "3a5c8ee49c50820cea201c088acca32e018c1501", "index": 3715, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(int(input())):\n imp = input()\n if bool(re.search('[a-zA-Z0-9]{10}', imp)) and bool(re.search(\n '([A-Z].*){2}', imp)) and bool(re.search('([0-9].*){3}', imp)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def on_connect(client, userdata, flags, rc): print('Conectado (%s)' % client._client_id) client.subscribe(topic='unimet/#', qos=0) def ventasTIENDA(client, userdata, message): a = json.loads(message.payload) print(a) cur = conn.cursor() sql = ( 'INSERT IN...
flexible
{ "blob_id": "f1b36e3ce3189c8dca2e41664ac1a6d632d23f79", "index": 5078, "step-1": "<mask token>\n\n\ndef on_connect(client, userdata, flags, rc):\n print('Conectado (%s)' % client._client_id)\n client.subscribe(topic='unimet/#', qos=0)\n\n\ndef ventasTIENDA(client, userdata, message):\n a = json.loads(me...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python ''' State Machine for the Flare task ''' import roslib import rospy import actionlib from rospy.timer import sleep import smach import smach_ros from dynamic_reconfigure.server import Server import math import os import sys import numpy as np from bbauv_msgs.msg import * from bbauv_msgs.srv...
normal
{ "blob_id": "0bb2a6ebbf75fae3466c34a435a531fabdc07f62", "index": 2984, "step-1": "<mask token>\n\n\nclass Disengage(smach.State):\n\n def __init__(self, flare_task):\n smach.State.__init__(self, outcomes=['start_complete',\n 'complete_outcome', 'aborted'])\n self.flare = flare_task\n ...
[ 12, 13, 15, 16, 20 ]
# -*- coding: utf-8 -*- """ 测试如何使用python的pymongo模块操作MongoDB @author: hch @date : 2020/10/8 """ import logging import time import traceback from pprint import pprint from pymongo import MongoClient from pymongo.cursor import Cursor from pymongo.results import DeleteResult, InsertOneResult, UpdateResult class MongoT...
normal
{ "blob_id": "b46fe26f1a3c9e93e735b752e54132bd95408251", "index": 2451, "step-1": "<mask token>\n\n\nclass MongoTest:\n <mask token>\n try:\n client = MongoClient(\n 'mongodb://root:root@localhost:27017/test?authSource=admin')\n print('init mongo client:', client)\n except Except...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(len(bull_list)): bull_list.append(int(bull_str[i])) <|reserved_special_token_0|> while True: flag += 1 for i in range(len(bull_list)): if bull_list[i] == 1: for j in range(bull_list.i...
flexible
{ "blob_id": "4d30f4294a9f3aab8cae20dca9d280c53b37ed25", "index": 1471, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(bull_list)):\n bull_list.append(int(bull_str[i]))\n<mask token>\nwhile True:\n flag += 1\n for i in range(len(bull_list)):\n if bull_list[i] == 1:\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class DataManager(ABC): def __init__(self): self.__myHousekeeper = housekeeper.instance_class() self.__config_filename = 'tickers_config.json' self.__dir_list = ['Data', 'Tickers', 'Dummy1'] self.__upper_stages = 0 self.__tickers_config_list = ...
flexible
{ "blob_id": "e77e0791ddf211807566528e9532eebb54db43b5", "index": 5550, "step-1": "<mask token>\n\n\nclass DataManager(ABC):\n\n def __init__(self):\n self.__myHousekeeper = housekeeper.instance_class()\n self.__config_filename = 'tickers_config.json'\n self.__dir_list = ['Data', 'Tickers'...
[ 30, 34, 35, 40, 41 ]
<|reserved_special_token_0|> def getCursor(): cursor = db.cursor() return cursor class Classify(object): def __init__(self, **args): self.cl_name = args['cl_name'] self.cl_grade = args['cl_grade'] is None if 0 else args['cl_grade'] self.cl_fid = args['cl_fid'] if 'pictur...
flexible
{ "blob_id": "6d51a088ba81cfc64c2e2a03f98b0ee354eda654", "index": 4292, "step-1": "<mask token>\n\n\ndef getCursor():\n cursor = db.cursor()\n return cursor\n\n\nclass Classify(object):\n\n def __init__(self, **args):\n self.cl_name = args['cl_name']\n self.cl_grade = args['cl_grade'] is No...
[ 7, 8, 9, 10, 12 ]
# Mac File import platform import os def Mac(SystemArray = [], ProcessorArray = []): # System Info OSName = str() OSVersionMajor = str() OSArchitecture = str() # Processor Info command = '/usr/sbin/sysctl -n machdep.cpu.brand_string' ProcInfo = os.popen(command).read().strip() ProcNam...
normal
{ "blob_id": "f652fa6720582d50f57f04d82fb2f5af17859ebd", "index": 8211, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Mac(SystemArray=[], ProcessorArray=[]):\n OSName = str()\n OSVersionMajor = str()\n OSArchitecture = str()\n command = '/usr/sbin/sysctl -n machdep.cpu.brand_string'\n...
[ 0, 1, 2, 3 ]
from django.contrib import admin from .models import Profile, Address admin.site.register(Profile) admin.site.register(Address)
normal
{ "blob_id": "4cc6a9c48e174b33ed93d7bda159fcc3a7b59d4c", "index": 6727, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Profile)\nadmin.site.register(Address)\n", "step-3": "from django.contrib import admin\nfrom .models import Profile, Address\nadmin.site.register(Profile)\nadmin.sit...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class PeriodoUpdateView(LoginRequiredMixin, UpdateView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def get_form_kwargs(self, *args, **kwargs): kwargs = super(PeriodoUpdateView, self).get_form_kwargs(*args, **kwargs ...
flexible
{ "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 ]
<|reserved_special_token_0|> class CoordinatesDataParser: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CoordinatesDataParser: def __init__(self): return <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "7d5f41cfa2d5423c6db2678f1eb8160638b50c02", "index": 1835, "step-1": "<mask token>\n\n\nclass CoordinatesDataParser:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CoordinatesDataParser:\n\n def __init__(self):\n return\n <mask token>\n", "step-3": "<mask ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class LR(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> class RNN(nn.Module): def __init__(self, feature_nums, hidden_dims, bi_lstm, out_dims=1): super(RNN, self).__init__() self.feature_nums = feature_nums self.hidden_dims = h...
flexible
{ "blob_id": "2c2b075f9ea9e8d6559e44ad09d3e7767c48205e", "index": 6772, "step-1": "<mask token>\n\n\nclass LR(nn.Module):\n <mask token>\n <mask token>\n\n\nclass RNN(nn.Module):\n\n def __init__(self, feature_nums, hidden_dims, bi_lstm, out_dims=1):\n super(RNN, self).__init__()\n self.fea...
[ 7, 9, 10, 11, 12 ]
#-*- coding:utf-8 -*- from xml.etree import ElementTree from xml.etree.ElementTree import Element _exception = None import os class xmlSp: def addNode(self,parentNode,childNode): parentNode.append(childNode) def createChildNode(self,key,value,propertyMap={}): element...
normal
{ "blob_id": "0470f98247f8f835c0c052b01ddd7f1f7a515ab5", "index": 5509, "step-1": "<mask token>\n\n\nclass xmlSp:\n\n def addNode(self, parentNode, childNode):\n parentNode.append(childNode)\n\n def createChildNode(self, key, value, propertyMap={}):\n element = Element(key, propertyMap)\n ...
[ 12, 13, 15, 16, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Welcome to the Band Name Generator') <|reserved_special_token_0|> print('Your band name could be ', Band_name) <|reserved_special_token_1|> print('Welcome to the Band Name Generator') city = input('Which city did you grew up in?\n') pet = input('W...
flexible
{ "blob_id": "19962e94afdd3edf298b28b9954f479fefa3bba8", "index": 8656, "step-1": "<mask token>\n", "step-2": "print('Welcome to the Band Name Generator')\n<mask token>\nprint('Your band name could be ', Band_name)\n", "step-3": "print('Welcome to the Band Name Generator')\ncity = input('Which city did you ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Main: <|reserved_special_token_0|> def processaCSV(self, filename): with open(filename, 'r', encoding='ISO-8859-1') as input_file: self.concessao = {} self.expansao = {} for line in input_file.readlines(): attribut...
flexible
{ "blob_id": "c5f46be6d7214614892d227c76c75e77433a8fa9", "index": 9517, "step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n def processaCSV(self, filename):\n with open(filename, 'r', encoding='ISO-8859-1') as input_file:\n self.concessao = {}\n self.expansao = {}\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': args = argparse.Namespace() args.notray = False traylauncher.start(args) <|reserved_special_token_1|> import argparse import traylauncher if __name__ == '__main__': args = argparse.Nam...
flexible
{ "blob_id": "8faaf9eb2e78b7921dd1cac4772e2415671201c7", "index": 8481, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n args = argparse.Namespace()\n args.notray = False\n traylauncher.start(args)\n", "step-3": "import argparse\nimport traylauncher\nif __name__ == '_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('workRecord.txt') as fp: for line in fp.readlines(): idx = line.rfind('x', len(line) - 8, len(line)) if idx >= 0: sum += float(line.rstrip()[idx + 1:len(line)]) else: s...
flexible
{ "blob_id": "b838d2230cb3f3270e86807e875df4d3d55438cd", "index": 8891, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('workRecord.txt') as fp:\n for line in fp.readlines():\n idx = line.rfind('x', len(line) - 8, len(line))\n if idx >= 0:\n sum += float(line.rstrip()[...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-12-01 16:51 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('monitor', '0001_initial'), ] operations = [ migrations.RemoveField( ...
normal
{ "blob_id": "1573af9cdf4817acbe80031e22489386ea7899cf", "index": 4782, "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 = [('monitor', '...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import pylab as pl import pymc as mc import book_graphics reload(book_graphics) # <markdowncell> # Uniform points in an $n$-dimensional ball # ========================================= # # This notebook implements and compares samplers ...
normal
{ "blob_id": "8283bdab023e22bba3d8a05f8bda0014ee19adee", "index": 4286, "step-1": "<mask token>\n\n\nclass UniformBall(mc.Gibbs):\n\n def __init__(self, stochastic, others, verbose=None):\n self.others = others\n self.conjugate = True\n mc.Gibbs.__init__(self, stochastic, verbose)\n\n d...
[ 3, 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(t) print(t[:2]) print(t[1:]) <|reserved_special_token_0|> print(t2) print(t3) print(t2 + t3) <|reserved_special_token_1|> t = '코스모스', '민들레', '국화' print(t) print(t[:2]) print(t[1:]) t2 = 1, 2, 3 t3 = 4, print(t2) print(t3)...
flexible
{ "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 ]
from .base import Sort
normal
{ "blob_id": "de3a96d46b7eaf198b33efe78b21ef0207dcc609", "index": 8424, "step-1": "<mask token>\n", "step-2": "from .base import Sort\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class PlayerHand: <|reserved_special_token_0|> def __init__(self, concealed, exposed=None, initial_update=True): if isinstance(concealed, str): concealed = tiles.tiles(concealed) if isinstance(concealed, Counter): self._concealed = conceale...
flexible
{ "blob_id": "5b860144a592505fea3a8849f5f5429a39ab9053", "index": 7299, "step-1": "<mask token>\n\n\nclass PlayerHand:\n <mask token>\n\n def __init__(self, concealed, exposed=None, initial_update=True):\n if isinstance(concealed, str):\n concealed = tiles.tiles(concealed)\n if isin...
[ 18, 19, 21, 23, 25 ]
import json data = '{"var1": "harry", "var2":56}' parsed = json.loads(data) print(parsed['var1']) # data2 = {"channel_name": "Chill_Out", # "Cars": ["BMW", "Audi a8", "ferrari"], # "fridge": ("loki", "Aalu", "pasta"), # "isbad": False # } # jscomp = json.dumps(data2) # print(jscomp)
normal
{ "blob_id": "f0f9541eba29b4488c429c889f3b346d53d0239d", "index": 7193, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(parsed['var1'])\n", "step-3": "<mask token>\ndata = '{\"var1\": \"harry\", \"var2\":56}'\nparsed = json.loads(data)\nprint(parsed['var1'])\n", "step-4": "import json\ndata = '{\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> smodelsOutput = {'OutputStatus': {'sigmacut': 0.01, 'minmassgap': 5.0, 'maxcond': 0.2, 'ncpus': 1, 'file status': 1, 'decomposition status': 1, 'warnings': 'Input file ok', 'input file': 'inputFiles/scanExample/slha/100968509.slha', 'database vers...
flexible
{ "blob_id": "94d303716eac7fa72370435fe7d4d1cdac0cdc48", "index": 6151, "step-1": "<mask token>\n", "step-2": "smodelsOutput = {'OutputStatus': {'sigmacut': 0.01, 'minmassgap': 5.0,\n 'maxcond': 0.2, 'ncpus': 1, 'file status': 1, 'decomposition status': 1,\n 'warnings': 'Input file ok', 'input file':\n ...
[ 0, 1 ]
<|reserved_special_token_0|> def format(t): A = str(t // 600) tem = t // 10 tem = tem % 60 B = str(tem // 10) C = str(tem % 10) D = str(t % 10) return A + ':' + B + C + '.' + D <|reserved_special_token_0|> def reset(): global successcount, totalstopcount, count, F count = 0 ...
flexible
{ "blob_id": "bb198978ffc799bb43acf870467496e1dcc54d4b", "index": 3710, "step-1": "<mask token>\n\n\ndef format(t):\n A = str(t // 600)\n tem = t // 10\n tem = tem % 60\n B = str(tem // 10)\n C = str(tem % 10)\n D = str(t % 10)\n return A + ':' + B + C + '.' + D\n\n\n<mask token>\n\n\ndef res...
[ 4, 5, 6, 7, 10 ]
import dash import dash_html_components as html app = dash.Dash(__name__) app.layout = html.H1("Hello dashboard") if __name__ == "__main__": app.run_server(debug=False, port=8080, host="127.0.0.1")
normal
{ "blob_id": "b66f588149d160c119f9cc24af3acb9f64432d6e", "index": 6014, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run_server(debug=False, port=8080, host='127.0.0.1')\n", "step-3": "<mask token>\napp = dash.Dash(__name__)\napp.layout = html.H1('Hello dashboard')\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(s) <|reserved_special_token_1|> s = 'Daum KaKao' s = s[5:] + ' ' + s[:4] print(s) <|reserved_special_token_1|> s = 'Daum KaKao' # s_split = s.split() # s = s_split[1] + ' ' + s_split[0] s = s[5:] + ' ' + s[:4] print(s)
flexible
{ "blob_id": "32c62bb8b6e4559bb7dfc67f4311bc8e71e549c9", "index": 6942, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s)\n", "step-3": "s = 'Daum KaKao'\ns = s[5:] + ' ' + s[:4]\nprint(s)\n", "step-4": "s = 'Daum KaKao'\n# s_split = s.split()\n# s = s_split[1] + ' ' + s_split[0]\ns = s[5:] + ' ...
[ 0, 1, 2, 3 ]
import time from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtSql import * from PyQt5.QtWidgets import * from qgis.core import QgsFeature, QgsGeometry, QgsProject from shapely import wkb print(__name__) # Function definition def TicTocGenerator(): # Generator that returns time differences ti...
normal
{ "blob_id": "73ff1444b5ab1469b616fe449ee6ab93acbbf85a", "index": 918, "step-1": "import time\nfrom PyQt5.QtCore import *\nfrom PyQt5.QtGui import *\nfrom PyQt5.QtSql import *\nfrom PyQt5.QtWidgets import *\nfrom qgis.core import QgsFeature, QgsGeometry, QgsProject\nfrom shapely import wkb\n\nprint(__name__)\n\n\...
[ 0 ]
# coding=utf-8 # __author__ = 'liwenxuan' import random chars = "1234567890ABCDEF" ids = ["{0}{1}{2}{3}".format(i, j, k, l) for i in chars for j in chars for k in chars for l in chars] def random_peer_id(prefix="F"*8, server_id="0000"): """ 用于生成随机的peer_id(后四位随机) :param prefix: 生成的peer_id的前八位, 测试用prefix为...
normal
{ "blob_id": "c77ca4aa720b172d75aff2ceda096a4969057a00", "index": 9735, "step-1": "# coding=utf-8\n# __author__ = 'liwenxuan'\n\nimport random\n\nchars = \"1234567890ABCDEF\"\nids = [\"{0}{1}{2}{3}\".format(i, j, k, l) for i in chars for j in chars for k in chars for l in chars]\n\n\ndef random_peer_id(prefix=\"F...
[ 0 ]
<|reserved_special_token_0|> def register(request): if request.method == 'GET': return render(request, 'home/home.html') else: name = request.POST['name'] username = request.POST['uname'] email = request.POST['email'] password = request.POST['password'] if name ...
flexible
{ "blob_id": "4cb601d7fc4023e145c6d510d27507214ddbd2d3", "index": 809, "step-1": "<mask token>\n\n\ndef register(request):\n if request.method == 'GET':\n return render(request, 'home/home.html')\n else:\n name = request.POST['name']\n username = request.POST['uname']\n email = r...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def permissao(): editor = False for row in session.auth.user_groups: grupo = session.auth.user_groups[row] if grupo == 'gerenciador' or grupo == 'administrador': editor = True return editor <|reserved_special_token_1|...
flexible
{ "blob_id": "70de2bed00aabe3805c3a19da004713d4109568a", "index": 9036, "step-1": "<mask token>\n", "step-2": "def permissao():\n editor = False\n for row in session.auth.user_groups:\n grupo = session.auth.user_groups[row]\n if grupo == 'gerenciador' or grupo == 'administrador':\n ...
[ 0, 1, 2 ]
#!/usr/bin/python import sys, os, glob, numpy wd = os.path.dirname(os.path.realpath(__file__)) sys.path.append(wd + '/python_speech_features') from features import mfcc, logfbank import scipy.io.wavfile as wav DIR = '/home/quiggles/Desktop/513music/single-genre/classify-me/subset' OUTDIR = wd + '/songdata/subset' #...
normal
{ "blob_id": "cca1a491e2a48b4b0c7099a6c54e528158ef30bb", "index": 5189, "step-1": "<mask token>\n\n\ndef getMFCC(rate, sig):\n mfcc_feat = mfcc(sig, rate)\n return numpy.concatenate(getQuartileMeans(mfcc_feat))\n\n\ndef getLogFBank(rate, sig):\n logfbank_feat = logfbank(sig, rate)\n return numpy.conca...
[ 3, 7, 8, 9, 10 ]
def postfix(expression): operators, stack = '+-*/', [] for item in expression.split(): if item not in operators: stack.append(item) else: operand_1, operand_2 = stack.pop(), stack.pop() stack.append(str(eval(operand_2 + item + operand_1))) return int(float...
normal
{ "blob_id": "3ae0149af78216d6cc85313ebaa6f7cd99185c05", "index": 531, "step-1": "<mask token>\n", "step-2": "def postfix(expression):\n operators, stack = '+-*/', []\n for item in expression.split():\n if item not in operators:\n stack.append(item)\n else:\n operand_1,...
[ 0, 1 ]
<|reserved_special_token_0|> def generate_questions(n): for _ in range(n): x = random.randint(11, 100) print(x) inp = int(input()) if inp == x ** 2: continue else: print('Wrong! the right answer is: {}'.format(x ** 2)) <|reserved_special_token_0|> ...
flexible
{ "blob_id": "e98f28199075e55ddad32d9127f917c982e1e29d", "index": 8167, "step-1": "<mask token>\n\n\ndef generate_questions(n):\n for _ in range(n):\n x = random.randint(11, 100)\n print(x)\n inp = int(input())\n if inp == x ** 2:\n continue\n else:\n pr...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_iam_token(iam_url, oauth_token): response = post(iam_url, json={'yandexPassportOauthToken': oauth_token}) json_data = json.loads(response.text) if json_data is not None and 'iamToken' in json_data: return json_data['iamToken'] return None <|reserved_speci...
flexible
{ "blob_id": "360063940bb82defefc4195a5e17c9778b47e9e5", "index": 792, "step-1": "<mask token>\n\n\ndef get_iam_token(iam_url, oauth_token):\n response = post(iam_url, json={'yandexPassportOauthToken': oauth_token})\n json_data = json.loads(response.text)\n if json_data is not None and 'iamToken' in json...
[ 1, 2, 3, 5, 6 ]
# coding:utf-8 def application(env,handle_headers): status="200" response_headers=[ ('Server','') ] return ""
normal
{ "blob_id": "8c318d7152bfdf2bc472258eb87dfa499b743193", "index": 797, "step-1": "<mask token>\n", "step-2": "def application(env, handle_headers):\n status = '200'\n response_headers = [('Server', '')]\n return ''\n", "step-3": "# coding:utf-8\n\n\ndef application(env,handle_headers):\n status=\"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Ui_Form1(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.setupUi(self) if os.path.exists(os.getcwd() + '\\settings.ini') and os.path.getsize( os.getcwd() + '\\settings.ini') > 0: with open(os.getcwd() + '\\se...
flexible
{ "blob_id": "cef4568b4568bceeedca6d57c0ccacfaae67c061", "index": 147, "step-1": "<mask token>\n\n\nclass Ui_Form1(QtGui.QWidget):\n\n def __init__(self):\n QtGui.QWidget.__init__(self)\n self.setupUi(self)\n if os.path.exists(os.getcwd() + '\\\\settings.ini') and os.path.getsize(\n ...
[ 15, 20, 21, 22, 28 ]
#!/usr/bin/env python # coding: utf-8 import numpy as np import copy import sys def mutate(genotype_in, mut_matrix): genotype_out = np.zeros(8) for i in range(8): rand_vec = np.random.choice(8, size=int(genotype_in[i]), p=mut_matrix[i,:]) genotype_out+=np.bincount(rand_vec, minlength=8) r...
normal
{ "blob_id": "9065842a8e90c833278547310f027bc63c7a9a47", "index": 7557, "step-1": "<mask token>\n\n\ndef mutate(genotype_in, mut_matrix):\n genotype_out = np.zeros(8)\n for i in range(8):\n rand_vec = np.random.choice(8, size=int(genotype_in[i]), p=\n mut_matrix[i, :])\n genotype_ou...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> def press(key): logging.info(key) def work(): with Listener(on_press=press) as listener: listener.join() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logging.basicConfig(format='%(asctime)s:%(message)s') <|reserved_special_t...
flexible
{ "blob_id": "3dc2d9a5e37ce1f546c0478de5a0bb777238ad00", "index": 4306, "step-1": "<mask token>\n\n\ndef press(key):\n logging.info(key)\n\n\ndef work():\n with Listener(on_press=press) as listener:\n listener.join()\n\n\n<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(format='%(ascti...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.index, name='index'), path('sign', views.sign, name='sign'), path('reset_password/', auth_views.PasswordResetView. as_view(template_name='password_reset.html'), name='password_reset'), pat...
flexible
{ "blob_id": "7e35c35c8ef443155c45bdbff4ce9ad07b99f144", "index": 9983, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('sign', views.sign,\n name='sign'), path('reset_password/', auth_views.PasswordResetView.\n as_view(template_name='password_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_application_name(default=_marker, prompt=True): global _selected_app result = None try: result = fileoperations.get_config_setting('global', 'application_name' ) except NotInitializedError: if prompt: result = _get_applicatio...
flexible
{ "blob_id": "653c8db6741a586694d91bd9928d8326cce9e41d", "index": 6373, "step-1": "<mask token>\n\n\ndef get_application_name(default=_marker, prompt=True):\n global _selected_app\n result = None\n try:\n result = fileoperations.get_config_setting('global', 'application_name'\n )\n e...
[ 2, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Mon Jan 22 20:21:16 2018 @author: Yijie """ #Q4: #(1) yours = ['Yale','MIT','Berkeley'] mine = ['Harvard','CAU','Stanford'] ours1 = mine + yours ours2=[] ours2.append(mine) ours2.append(yours) print(ours1) print(ours2) # Difference:the print out results indicate that the list 'o...
normal
{ "blob_id": "bf65d4a4e066e3e06b888d4b9ed49e10e66b4e78", "index": 8145, "step-1": "<mask token>\n", "step-2": "<mask token>\nours2.append(mine)\nours2.append(yours)\nprint(ours1)\nprint(ours2)\n<mask token>\nprint(ours1)\nprint(ours2)\n", "step-3": "<mask token>\nyours = ['Yale', 'MIT', 'Berkeley']\nmine = ['...
[ 0, 1, 2, 3 ]
# from suiron.core.SuironIO import SuironIO # import cv2 # import os # import time # import json # import numpy as np # suironio = SuironIO(serial_location='/dev/ttyUSB0', baudrate=57600, port=5050) # if __name__ == "__main__": # while True: # # suironio.record_inputs() # print('turn90') # suiro...
normal
{ "blob_id": "bf8ffe603b7c1e90deed6a69500ea5b7671e7270", "index": 879, "step-1": "<mask token>\n\n\ndef visualize_data(filename, width=72, height=48, depth=3, cnn_model=None):\n \"\"\"\n When cnn_model is specified it'll show what the cnn_model predicts (red)\n as opposed to what inputs it actually recei...
[ 1, 2, 3, 4, 5 ]
# ------------------------------------------------------------ # calclex.py # # tokenizer for a simple expression evaluator for # numbers and +,-,*,/ # ------------------------------------------------------------ import ply.lex as lex # Regular expression rules for simple tokens t_PLUS = r'\+' t_MINUS = r'-'...
normal
{ "blob_id": "1530f1711be6313b07df680721daf4cb0a84edc0", "index": 5502, "step-1": "# ------------------------------------------------------------\n# calclex.py\n#\n# tokenizer for a simple expression evaluator for\n# numbers and +,-,*,/\n# ------------------------------------------------------------\nimport ply.l...
[ 0 ]
<|reserved_special_token_0|> class MongoTest: <|reserved_special_token_0|> try: client = MongoClient( 'mongodb://root:root@localhost:27017/test?authSource=admin') print('init mongo client:', client) except Exception as e: logging.exception(e) @classmethod def g...
flexible
{ "blob_id": "b46fe26f1a3c9e93e735b752e54132bd95408251", "index": 2451, "step-1": "<mask token>\n\n\nclass MongoTest:\n <mask token>\n try:\n client = MongoClient(\n 'mongodb://root:root@localhost:27017/test?authSource=admin')\n print('init mongo client:', client)\n except Except...
[ 6, 7, 8, 9, 10 ]
import unittest from unittest.mock import ANY, MagicMock, call from streamlink import Streamlink from streamlink.plugins.funimationnow import FunimationNow from tests.plugins import PluginCanHandleUrl class TestPluginCanHandleUrlFunimationNow(PluginCanHandleUrl): __plugin__ = FunimationNow should_match = [ ...
normal
{ "blob_id": "266add60be2b6c2de5d53504cbabf754aa62d1b0", "index": 9806, "step-1": "<mask token>\n\n\nclass TestPluginFunimationNow(unittest.TestCase):\n\n def test_arguments(self):\n from streamlink_cli.main import setup_plugin_args\n session = Streamlink()\n parser = MagicMock()\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class MemorizeFormatter(Formatter): """Customize the Formatter to record used and unused kwargs.""" def __init__(self): """Initialize the MemorizeFormatter.""" Formatter.__init__(self) self._used_kwargs = {} self._unused_kwargs = {} def check_...
flexible
{ "blob_id": "773fc4660def134410eca92886b2629be6977f74", "index": 4095, "step-1": "<mask token>\n\n\nclass MemorizeFormatter(Formatter):\n \"\"\"Customize the Formatter to record used and unused kwargs.\"\"\"\n\n def __init__(self):\n \"\"\"Initialize the MemorizeFormatter.\"\"\"\n Formatter._...
[ 10, 11, 12, 13, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.home, name='VitaminSHE-home'), path('signup/', views.signup, name='VitaminSHE-signup'), path('login/', views.login, name='VitaminSHE-login'), path('healthcheck/', views.healthcheck, name= ...
flexible
{ "blob_id": "33aa5c5ab75a26705875b55baf61f7f996cb69cd", "index": 1280, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home, name='VitaminSHE-home'), path('signup/',\n views.signup, name='VitaminSHE-signup'), path('login/', views.login,\n name='VitaminSHE-login'), path(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestTicketFunctions1(unittest.TestCase): def setUp(self): self.required_keys = constants.IMPORT_TABLE_STRUCTURE['required'] self.optional_keys = constants.IMPORT_TABLE_STRUCTURE['optional'] self.keywords = constants.IMPORT_TABLE_STRUCTURE['keywords'] ...
flexible
{ "blob_id": "d8ba2557e20920eaadd2fd35f0ebdf1b4a5b33da", "index": 9010, "step-1": "<mask token>\n\n\nclass TestTicketFunctions1(unittest.TestCase):\n\n def setUp(self):\n self.required_keys = constants.IMPORT_TABLE_STRUCTURE['required']\n self.optional_keys = constants.IMPORT_TABLE_STRUCTURE['opt...
[ 22, 24, 27, 39, 40 ]
from sqlalchemy import Column, ForeignKey from sqlalchemy.types import Integer, Text, String, DateTime, Float from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship Model = declarative_base() class User(Model): __tablename__ = "users" id = Column(Integer, ...
normal
{ "blob_id": "e73c4a99c421b3eca08c941ff1f83cb03faee97d", "index": 2558, "step-1": "<mask token>\n\n\nclass User(Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Product(Model):\n __tablename__ = 'products'\n id = Column(Integer, p...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> df_filtro.groupby('Dia')['Quantidade de pessoas'].mean().plot(x='Dia', y= 'Quantidade de pessoas') <|reserved_special_token_1|> <|reserved_special_token_0|> mongo_client = MongoClient('localhost', 27018) mongo_db = mongo_cl...
flexible
{ "blob_id": "9d4559a363c4fd6f9a22dc493a7aaa0a22386c21", "index": 8071, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf_filtro.groupby('Dia')['Quantidade de pessoas'].mean().plot(x='Dia', y=\n 'Quantidade de pessoas')\n", "step-3": "<mask token>\nmongo_client = MongoClient('localhost', 27018)\nmong...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(L5) <|reserved_special_token_0|> print(L5) print(L5[1:4]) L5.append(30) print(L5) L5.remove(30) print(L5) <|reserved_special_token_0|> print(L6[1::2]) print(L6[::2]) <|reserved_special_token_1|> L5 = [0] * 10 print(L5) L5...
flexible
{ "blob_id": "052824082854c5f7721efb7faaf5a794e9be2789", "index": 6517, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(L5)\n<mask token>\nprint(L5)\nprint(L5[1:4])\nL5.append(30)\nprint(L5)\nL5.remove(30)\nprint(L5)\n<mask token>\nprint(L6[1::2])\nprint(L6[::2])\n", "step-3": "L5 = [0] * 10\nprint...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import datetime from urllib import parse import scrapy from scrapy import Request from BrexitNews.items import BrexitNewsItem def check_url(url): if url is not None: url = url.strip() if url != '' and url != 'None': return True return False class Theguar...
normal
{ "blob_id": "8180dac5d33334d7f16ab6bef41f1fe800879ca7", "index": 2255, "step-1": "<mask token>\n\n\nclass TheguardianSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def article(self, response):\n brexit_news = BrexitNewsItem()\n title = response...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import tensorflow as tf from yolov3 import * from predict import predict from load import Weight_loader class Yolo(Yolov3): sess = tf.Session() def __init__(self, input=None, weight_path=None, is_training=False): self.is_training = is_training try: self...
normal
{ "blob_id": "f3d34379cc7fbfe211eeebec424112f3da0ab724", "index": 7999, "step-1": "<mask token>\n\n\nclass Yolo(Yolov3):\n <mask token>\n <mask token>\n <mask token>\n\n def freeze(self):\n graph_def = tf.graph_util.convert_variables_to_constants(sess=self.\n sess, input_graph_def=tf...
[ 3, 4, 6, 7, 8 ]
# -*- coding: utf-8 -*- # Item pipelines import logging import hashlib from wsgiref.handlers import format_date_time import time import itertools import psycopg2 from psycopg2.extensions import AsIs from psycopg2.extras import Json import requests from scrapy import signals from scrapy.pipelines.files import FilesPip...
normal
{ "blob_id": "d08e4c85890dab7cb421fa994ef1947d8919d58f", "index": 8547, "step-1": "<mask token>\n\n\nclass UpYunStore(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, uri):\n assert uri.startswith('upyun://')\n self.session = requests.Session()\n self.b...
[ 7, 8, 11, 14, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): if r[i] - b[i] == 1: x += 1 elif r[i] - b[i] == -1: y += 1 if x == 0: print(-1) else: print(y // x + min(y % x + 1, 1)) <|reserved_special_token_1|> n = int(input()) r = list(m...
flexible
{ "blob_id": "7aa6bba8483082354a94ed5c465e59a0fc97fe23", "index": 1248, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n if r[i] - b[i] == 1:\n x += 1\n elif r[i] - b[i] == -1:\n y += 1\nif x == 0:\n print(-1)\nelse:\n print(y // x + min(y % x + 1, 1))\n", "s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def match_regex(filename, regex): with open(filename) as file: lines = file.readlines() for line in reversed(lines): match = re.match(regex, line) if match: regex = yield match.groups()[0] <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "a36a553342cfe605a97ddc0f636bbb73b683f6a6", "index": 1239, "step-1": "<mask token>\n\n\ndef match_regex(filename, regex):\n with open(filename) as file:\n lines = file.readlines()\n for line in reversed(lines):\n match = re.match(regex, line)\n if match:\n regex ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def banner(): os.system('clear') os.system('cat banner/banner.txt') print('') print('SSHSploit Framework v1.0') print('------------------------') print('') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def banner(): ...
flexible
{ "blob_id": "caf83d35ce6e0bd4e92f3de3a32221705a529ec1", "index": 9467, "step-1": "<mask token>\n\n\ndef banner():\n os.system('clear')\n os.system('cat banner/banner.txt')\n print('')\n print('SSHSploit Framework v1.0')\n print('------------------------')\n print('')\n\n\n<mask token>\n", "st...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> @app.route('/') def index(): return render_template('a.html') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def index(): return render_template('a.html') @app.route('/insert', methods=['POST']) def insert(): fir...
flexible
{ "blob_id": "af9430caff843242381d7c99d76ff3c964915700", "index": 6753, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('a.html')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('a.html')\n\n\n@app.route('/insert...
[ 1, 2, 3, 4, 5 ]
from objet import Objet class Piece(Objet): """ Représente une piece qui permet d'acheter dans la boutique """ def ramasser(self, joueur): joueur.addPiece() def depenser(self,joueur): joueur.depenserPiece() def description(self): return "Vous avez trouvé une piece...
normal
{ "blob_id": "b6898b923e286c66673df1e07105adf789c3151c", "index": 6335, "step-1": "<mask token>\n\n\nclass Piece(Objet):\n <mask token>\n\n def ramasser(self, joueur):\n joueur.addPiece()\n\n def depenser(self, joueur):\n joueur.depenserPiece()\n <mask token>\n", "step-2": "<mask token...
[ 3, 4, 5, 6, 7 ]
import tweepy import time import twitter_credentials as TC auth = tweepy.OAuthHandler(TC.CONSUMER_KEY, TC.CONSUMER_SECRET) auth.set_access_token(TC.ACCESS_TOKEN, TC.ACCESS_TOKEN_SECRET) api = tweepy.API(auth) count = 1 # Query to get 50 tweets with either Indiana or Weather in them for tweet in tweepy.Cursor(api.sea...
normal
{ "blob_id": "4da1a97c2144c9aaf96e5fe6508f8b4532b082d4", "index": 7861, "step-1": "<mask token>\n", "step-2": "<mask token>\nauth.set_access_token(TC.ACCESS_TOKEN, TC.ACCESS_TOKEN_SECRET)\n<mask token>\nfor tweet in tweepy.Cursor(api.search, q='Indiana OR Weather').items(50):\n print(str(count) + '. ' + twee...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "36bdd6f7c130914856ddf495c50f928405c345aa", "index": 6646, "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 = [('mocbackend'...
[ 0, 1, 2, 3, 4 ]
import sys, os def resource_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.p...
normal
{ "blob_id": "5fb3905abf958f0a8be41cd6ad07efb2a0cf6c66", "index": 7542, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef resource_path(relative_path):\n \"\"\" Get absolute path to resource, works for dev and for PyInstaller \"\"\"\n try:\n base_path = sys._MEIPASS\n except Exception...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/env python from game_calc import * def game(screen, clock): running = True time = 0 WHITE = (255,255,255) BLUE = (0,0,205) upper_border = pygame.Rect(12,44,1000,20) right_border = pygame.Rect(992,60,20,648) left_border = pygame.Rect(12,60,20,648) down_border = pygame.Rect(12...
normal
{ "blob_id": "83815acb0520c1f8186b0b5c69f8597b1b6a552a", "index": 8051, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef game(screen, clock):\n running = True\n time = 0\n WHITE = 255, 255, 255\n BLUE = 0, 0, 205\n upper_border = pygame.Rect(12, 44, 1000, 20)\n right_border = pygam...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # # looping.py # # Copyright 2012 Jelle Smet <development@smetj.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of ...
normal
{ "blob_id": "8c86c0969c47a59db5bd147d3e051a29118d6bf2", "index": 9855, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# looping.py\n# \n# Copyright 2012 Jelle Smet <development@smetj.net>\n# \n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello Workls!') <|reserved_special_token_1|> print ("Hello Workls!")
flexible
{ "blob_id": "c52d1c187edb17e85a8e2b47aa6731bc9a41ab1b", "index": 561, "step-1": "<mask token>\n", "step-2": "print('Hello Workls!')\n", "step-3": "print (\"Hello Workls!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from twitter.MyStreamListener import MyStreamListener import tweepy from threading import Thread class TwitterWorker(Thread): def __init__(self): Thread.__init__(self) CONSUMER_KEY = 'IwZZeJHjLXq55ewwQwD0SogHU' CONSUMER_SECRET = '80kELQhDGNvLNFfNZ7qliIbzAoA3tsgQ...
normal
{ "blob_id": "c475e095571b211693e66583637442edbf72c260", "index": 7741, "step-1": "<mask token>\n\n\nclass TwitterWorker(Thread):\n <mask token>\n\n def run(self):\n streamListener = MyStreamListener()\n self.stream = tweepy.Stream(auth=self.api.auth, listener=streamListener\n )\n ...
[ 2, 3, 4, 5, 6 ]
from datetime import datetime from app.commands import backfill_performance_platform_totals, backfill_processing_time # This test assumes the local timezone is EST def test_backfill_processing_time_works_for_correct_dates(mocker, notify_api): send_mock = mocker.patch("app.commands.send_processing_time_for_start_...
normal
{ "blob_id": "fcb1285648f6728e3dad31ad4b602fa4e5c5b422", "index": 9230, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_backfill_totals_works_for_correct_dates(mocker, notify_api):\n send_mock = mocker.patch(\n 'app.commands.send_total_sent_notifications_to_performance_platform')\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> AuthorPath = 'data/Author.csv' PaperPath = 'buff/Paper.TitleCut.csv' PaperAuthorPath = 'data/PaperAuthor.csv' AffilListPath = 'buff/AffilList2.csv' StopwordPath = 'InternalData/en.lst'
flexible
{ "blob_id": "690e7cc9047b3a445bf330524df52e2b359f1f13", "index": 958, "step-1": "<mask token>\n", "step-2": "AuthorPath = 'data/Author.csv'\nPaperPath = 'buff/Paper.TitleCut.csv'\nPaperAuthorPath = 'data/PaperAuthor.csv'\nAffilListPath = 'buff/AffilList2.csv'\nStopwordPath = 'InternalData/en.lst'\n", "step-3...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if openFileDialog.ShowModal() == wx.ID_CANCEL: raise ValueError('HDF5 file is not selected') <|reserved_special_token_0|> del app with h5py.File(hist_filename, 'r') as F: for histogram in F['histograms'].values(): ...
flexible
{ "blob_id": "c4898f3298c2febed476f99fe08bc5386527a47e", "index": 9344, "step-1": "<mask token>\n", "step-2": "<mask token>\nif openFileDialog.ShowModal() == wx.ID_CANCEL:\n raise ValueError('HDF5 file is not selected')\n<mask token>\ndel app\nwith h5py.File(hist_filename, 'r') as F:\n for histogram in F[...
[ 0, 1, 2, 3, 4 ]
from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, HttpResponseServerError from django.shortcuts import render from django.template import RequestContext import json import datetime ...
normal
{ "blob_id": "d583661accce8c058f3e6b8568a09b4be1e58e4e", "index": 4877, "step-1": "<mask token>\n\n\ndef lookup_and_render(request):\n try:\n dbres = esgfDatabaseManager.lookupUserSubscriptions(request.user)\n except Exception as e:\n error_cond = str(e)\n print(traceback.print_exc())\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class ChunkProcessor: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChunkProcessor: <|reserved_special_token_0|> def chunkify(self, img_file, product_name, ch...
flexible
{ "blob_id": "303e1b95c2ca60041a34b8c09e013849112a108d", "index": 3475, "step-1": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n\n def chunkify(self, img_file, product_name, chunk_size=2...
[ 1, 2, 3, 5, 6 ]
def domain_sort_key(domain): """Key to sort hosts / domains alphabetically, by domain name.""" import re domain_expr = r'(.*\.)?(.*\.)(.*)' # Eg: (www.)(google.)(com) domain_search = re.search(domain_expr, domain) if domain_search and domain_search.group(1): # sort by domain name and then...
normal
{ "blob_id": "c581d9714681e22c75b1eeb866ea300e87b883f1", "index": 2972, "step-1": "<mask token>\n", "step-2": "def domain_sort_key(domain):\n \"\"\"Key to sort hosts / domains alphabetically, by domain name.\"\"\"\n import re\n domain_expr = '(.*\\\\.)?(.*\\\\.)(.*)'\n domain_search = re.search(doma...
[ 0, 1, 2, 3, 4 ]
from Domain.Librarie import vanzare_obiect, get_id, get_titlu, get_gen, get_pret, get_tip_reducere def inverse_create(lst_vanzari, id_carte): new_vanzari = [] for carte in lst_vanzari: if get_id(carte) != id_carte: new_vanzari.append(carte) return new_vanzari def get_by_id(id, lista):...
normal
{ "blob_id": "498d07421d848332ad528ef3d3910d70312b5f55", "index": 2606, "step-1": "<mask token>\n\n\ndef get_by_id(id, lista):\n \"\"\"\n ia vanzarea cu id-ul dat dintr-o lista\n :param id: id-ul vanzarii - string\n :param lista: lista de vanzari\n :return: vanzarea cu id-ul dat sau None daca nu ex...
[ 4, 5, 6, 7, 8 ]
from dataclasses import dataclass from typing import Optional @dataclass class Music(object): url: str title: Optional[str] = None
normal
{ "blob_id": "2506c5b042f04d1490ba2199a71e38829d4a0adc", "index": 5738, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclass\nclass Music(object):\n url: str\n title: Optional[str] = None\n", "step-3": "from dataclasses import dataclass\nfrom typing import Optional\n\n\n@dataclass\nclass ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): seed = 8912312 np.random.seed(8912312) u = 0 sigma = 1 cdf = nur.gaussian_cdf num_samples = np.logspace(1, 5, num=50) sample_size = int(100000.0) my_k = np.zeros(50) my_p = np.zero...
flexible
{ "blob_id": "0158141832423b567f252e38640e384cdf340f8b", "index": 7105, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n seed = 8912312\n np.random.seed(8912312)\n u = 0\n sigma = 1\n cdf = nur.gaussian_cdf\n num_samples = np.logspace(1, 5, num=50)\n sample_size = int(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_route_distance(routes, source, dest): if source + ':' + dest in routes: return routes[source + ':' + dest] else: return routes[dest + ':' + source] <|reserved_special_token_0|> <|reserved_special_token_1|> def add_route_distance(routes, cities, source)...
flexible
{ "blob_id": "810e9e4b18ff8cb388f9e16607b8ab3389a9831d", "index": 7402, "step-1": "<mask token>\n\n\ndef get_route_distance(routes, source, dest):\n if source + ':' + dest in routes:\n return routes[source + ':' + dest]\n else:\n return routes[dest + ':' + source]\n\n\n<mask token>\n", "step...
[ 1, 2, 3, 4, 5 ]
from rest_framework import serializers from core.models import Curriculo class CurriculoSerializer(serializers.ModelSerializer): class Meta: model = Curriculo fields = ('id','name', 'description','image','create_at','update_at')
normal
{ "blob_id": "029f4f015f558dbd4d6096b00c53f5f0fe69883d", "index": 1322, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CurriculoSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Curriculo\n fields = 'id', 'name', 'description', 'image', 'create_at', 'update_at...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def setup_fake_data() ->None: clear_db() fake_users = [User(username='sunmi', registration_status= RegistrationStatus.Registered, selected_fiat_currency=FiatCurrency. USD, selected_language='en', password...
flexible
{ "blob_id": "a6bd10723bd89dd08605f7a4abf17ccf9726b3f5", "index": 8937, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef setup_fake_data() ->None:\n clear_db()\n fake_users = [User(username='sunmi', registration_status=\n RegistrationStatus.Registered, selected_fiat_currency=FiatCurrenc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CNN(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CNN(nn.Module): def __init__(self, fragment_length, conv_layers_num, conv_kernel_size, pool_kernel_size, fc_size, conv_...
flexible
{ "blob_id": "415a6cf1c3f633a863851a4a407d416355398b39", "index": 7732, "step-1": "<mask token>\n\n\nclass CNN(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CNN(nn.Module):\n\n def __init__(self, fragment_length, conv_layers_num, conv_kernel_size,\n pool_kernel...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Signup(Auth): <|reserved_special_token_0|> <|reserved_special_token_0|> class UserViewSet(APIView): authentication_classes = [CustomBearerAuthentication] permission_classes = [IsAuthenticated] def get(self, request, format=None): queryset = User.object...
flexible
{ "blob_id": "b2eb2d006d6285947cc5392e290af50f25a9f566", "index": 4724, "step-1": "<mask token>\n\n\nclass Signup(Auth):\n <mask token>\n <mask token>\n\n\nclass UserViewSet(APIView):\n authentication_classes = [CustomBearerAuthentication]\n permission_classes = [IsAuthenticated]\n\n def get(self, ...
[ 12, 14, 16, 18, 22 ]
<|reserved_special_token_0|> class Logger: <|reserved_special_token_0|> def __init__(self, filepath): """ Constructor :param filepath: """ self.filepath = filepath self.logger = logging.getLogger('util') self.logger.setLevel(logging.DEBUG) self....
flexible
{ "blob_id": "45d57f8392b89776f9349c32b4bb2fa71a4aaa83", "index": 8610, "step-1": "<mask token>\n\n\nclass Logger:\n <mask token>\n\n def __init__(self, filepath):\n \"\"\"\n Constructor\n :param filepath:\n \"\"\"\n self.filepath = filepath\n self.logger = logging....
[ 2, 3, 4, 5, 6 ]
<|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": "b7687240413441e1d3ed0085e5953f8089cbf4c9", "index": 9303, "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 = [('goods', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(response.text) <|reserved_special_token_1|> <|reserved_special_token_0|> url = 'http://39.108.188.34:9090/spider/zhongdengdengji.go' input = {'timelimit': '1年', 'title': 'GD20190305001', 'maincontractno': 'YT201812280...
flexible
{ "blob_id": "ad024a2001dc6a6fa3a2a9c1b51f79132e914897", "index": 7592, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.text)\n", "step-3": "<mask token>\nurl = 'http://39.108.188.34:9090/spider/zhongdengdengji.go'\ninput = {'timelimit': '1年', 'title': 'GD20190305001', 'maincontractno':\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class InstitutionViewSet(viewsets.ModelViewSet): <|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|> <|res...
flexible
{ "blob_id": "4c43c181dbba1680e036750a2a2ea1185bbe91da", "index": 3218, "step-1": "<mask token>\n\n\nclass InstitutionViewSet(viewsets.ModelViewSet):\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 def get_permi...
[ 5, 8, 10, 11, 13 ]
class Person: <|reserved_special_token_0|> def get_name(self): return self.name def greet(self): print(f'こんにちは。私は{self.name}です。') <|reserved_special_token_0|> <|reserved_special_token_1|> class Person: def set_name(self, name): self.name = name def get_name(self): ...
flexible
{ "blob_id": "321dc411b003949a6744216a13c59c70d919a675", "index": 8402, "step-1": "class Person:\n <mask token>\n\n def get_name(self):\n return self.name\n\n def greet(self):\n print(f'こんにちは。私は{self.name}です。')\n\n\n<mask token>\n", "step-2": "class Person:\n\n def set_name(self, name)...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class JobGroupManager(object): <|reserved_special_token_0|> def GetJobGroup(self, group_id): with self._lock: for group in self.all_job_groups: if group.id == group_id: return group return None <|reserved_spe...
flexible
{ "blob_id": "720ec6c222659a13d4a0f3cf9096b70ce6e2b2b3", "index": 175, "step-1": "<mask token>\n\n\nclass JobGroupManager(object):\n <mask token>\n\n def GetJobGroup(self, group_id):\n with self._lock:\n for group in self.all_job_groups:\n if group.id == group_id:\n ...
[ 3, 6, 7, 8, 9 ]