code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# -*- coding: utf-8 -*- """ Created on Tue Jul 11 11:11:32 2017 @author: lindseykitchell """ import pandas as pd import numpy as np from scipy.stats.stats import pearsonr import matplotlib.pylab as plt import glob import os pwd = os.getcwd() df_dict = {} subj_list = [] for file in glob.glob(pwd + "/*spectrum.json")...
normal
{ "blob_id": "f78f8f560b7eb70232658be762e2058535a68122", "index": 9086, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file in glob.glob(pwd + '/*spectrum.json'):\n subj_name = os.path.basename(file)[0:6]\n subj_list.append(subj_name)\n df_dict[os.path.basename(file)[0:6]] = pd.read_json(file...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 2.0.5 on 2019-06-12 08:03 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('doctor', '0257_merge_20190524_1533'), ('doctor', '0260_merge_20190604_1428'), ] operations = [ ]
normal
{ "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|> class ModelSaver(Callback): """ Keras callback subclass which defines a saving procedure of the model being trained : after each epoch, the last model is saved under the name 'after_random.cnn'. The best model is saved with the name 'best_model.cnn'. The model after random...
flexible
{ "blob_id": "f8635c815b375dc77e971d4ea0f86547215ab2f9", "index": 7987, "step-1": "<mask token>\n\n\nclass ModelSaver(Callback):\n \"\"\"\n Keras callback subclass which defines a saving procedure of the model being trained : after each epoch,\n the last model is saved under the name 'after_random.cnn'. ...
[ 6, 7, 8, 10, 13 ]
<|reserved_special_token_0|> class my_model: <|reserved_special_token_0|> def make_model(self, param): """makes the model""" self.lr = param[0][0] dr = param[0][1] layer_units0 = param[0][2] layer_units1 = param[0][3] layer_units2 = param[0][4] def lea...
flexible
{ "blob_id": "d015a1b27a3a9e7f5e6614da752137064000b905", "index": 239, "step-1": "<mask token>\n\n\nclass my_model:\n <mask token>\n\n def make_model(self, param):\n \"\"\"makes the model\"\"\"\n self.lr = param[0][0]\n dr = param[0][1]\n layer_units0 = param[0][2]\n layer...
[ 3, 4, 5, 6, 7 ]
import argparse def wrong_subtraction(n, k): output = n for i in range(k): string_n = str(output) if string_n[len(string_n) - 1] == '0': output = int(string_n[:-1]) else: output -= 1 return output # d = "Do the wrong subtraction as per https://codeforces.com...
normal
{ "blob_id": "166a8cd0e09fbec739f43019659eeaf98b1d4fa4", "index": 4446, "step-1": "<mask token>\n\n\ndef wrong_subtraction(n, k):\n output = n\n for i in range(k):\n string_n = str(output)\n if string_n[len(string_n) - 1] == '0':\n output = int(string_n[:-1])\n else:\n ...
[ 1, 2, 3, 4, 5 ]
import os from googleapiclient.discovery import build import httplib2 from oauth2client import gce from oauth2client.appengine import AppAssertionCredentials from oauth2client.file import Storage __author__ = 'ekampf' import json import logging import apiclient.errors from apiclient import http as apiclient_request...
normal
{ "blob_id": "10d5eef304a3d293441169ebde1f7859537c4b6e", "index": 9847, "step-1": "import os\nfrom googleapiclient.discovery import build\nimport httplib2\nfrom oauth2client import gce\nfrom oauth2client.appengine import AppAssertionCredentials\nfrom oauth2client.file import Storage\n\n__author__ = 'ekampf'\n\n\n...
[ 0 ]
import numpy as np import matplotlib.pyplot as plt import scipy.stats as stats XZ_MESH = np.meshgrid( np.linspace(0, 1, 100), np.linspace(0.5, 1, 100) ) XZ_GRID = np.append( XZ_MESH[0].reshape(-1, 1), XZ_MESH[1].reshape(-1, 1), 1 ) QI_MESH = np.meshgrid( np.linspace(0, 1, 100), np.linspace(0, 1, 100) ) Q...
normal
{ "blob_id": "05badb45c2249dc52b72a46779a8e619cd8a3ca9", "index": 7088, "step-1": "<mask token>\n\n\ndef get_pdf(kde, grid, resample=False, N=10000):\n if resample:\n x, y = kde.resample(N)\n kde = stats.kde.gaussian_kde(np.column_stack((x, y)).T)\n return kde(grid.T).reshape(100, 100)\n\n\nde...
[ 7, 9, 10, 11, 13 ]
<|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": "52da8608e43b2d8dfe00f0956a1187fcf2e7b1ff", "index": 41, "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 = [('DHOPD', '0015...
[ 0, 1, 2, 3, 4 ]
from django.apps import AppConfig class GerenciaLedsConfig(AppConfig): name = 'gerencia_leds'
normal
{ "blob_id": "0754103c2d8cef0fd23b03a8f64ade8f049bce48", "index": 4890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GerenciaLedsConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GerenciaLedsConfig(AppConfig):\n name = 'gerencia_leds'\n", "step-4": "from django...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def notify(msg): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: if not s.connect_ex(('localhost', 9001)): s.sendall(bytes(msg, 'utf8')) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_json(text): ...
flexible
{ "blob_id": "6f99b4e4204e85c78f9c02a5cd53cd76f52c022c", "index": 617, "step-1": "<mask token>\n\n\ndef notify(msg):\n with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n if not s.connect_ex(('localhost', 9001)):\n s.sendall(bytes(msg, 'utf8'))\n\n\n<mask token>\n", "step-2": "<m...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # @Time : 2020/3/4 10:34 # @Author : YYLin # @Email : 854280599@qq.com # @File : Skip_GAN.py from Dataload import load_anime_old, save_images, load_CelebA from Srresnet_Model import Generator_srresnet, Discriminator_srresnet import tensorflow as tf import numpy as np import sys...
normal
{ "blob_id": "d3b00a8d410248aedb1c43354e89ccc298b56a3c", "index": 7693, "step-1": "<mask token>\n\n\nclass Skip_GAN(object):\n\n def __init__(self, sess, epoch, batch_size, dataset_name, result_dir,\n z_dim, y_dim, checkpoint_dir, num_resblock, Cycle_lr, Class_weight,\n Resnet_weight):\n s...
[ 2, 3, 4, 5, 6 ]
from abc import abstractmethod class BaseButton: @abstractmethod def render(self): pass @abstractmethod def on_click(self): pass class WindowsButton(BaseButton): def render(self): print("Render window button") def on_click(self): print("On click") class Ht...
normal
{ "blob_id": "003976d850e371e01e6d0a307d3cf366f962c53d", "index": 4358, "step-1": "<mask token>\n\n\nclass HtmlButton(BaseButton):\n\n def render(self):\n print('Render html button')\n <mask token>\n\n\nclass BaseDialog:\n\n @abstractmethod\n def create_button(self) ->BaseButton:\n pass\...
[ 14, 15, 19, 23, 24 ]
<|reserved_special_token_0|> class NetworkAdapter(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: db_table = 'cmdb_acc_network_adapter' verbose_name = u'配件网卡表' verbose_name_plural = u'配件网卡表' class NetworkCable(models.Model): cat = models...
flexible
{ "blob_id": "6bd423223e1ec2bb3a213158ac6da3a6483b531f", "index": 4914, "step-1": "<mask token>\n\n\nclass NetworkAdapter(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'cmdb_acc_network_adapter'\n verbose_name = u'配件网卡表'\n verbose_name_plural = u'配件网卡表'\...
[ 15, 17, 18, 19, 27 ]
#Author: AKHILESH #This program illustrates the advanced concepts of inheritance #Python looks up for method in following order: Instance attributes, class attributes and the #from the base class #mro: Method Resolution order class Data(object): def __init__(self, data): self.data = data def getData(s...
normal
{ "blob_id": "153a33b85cf8b3ef9c742f05b460e94e0c684682", "index": 1000, "step-1": "class Data(object):\n <mask token>\n <mask token>\n\n\nclass Time(Data):\n\n def getTime(self):\n print('Time:', self.data)\n\n\n<mask token>\n", "step-2": "class Data(object):\n\n def __init__(self, data):\n ...
[ 3, 4, 5, 6, 7 ]
class Graph: def __init__(self, num_vertices): self.adj_list = {} for i in range(num_vertices): self.adj_list[i] = [] def add_vertice(self, source): self.adj_list[source] = [] def add_edge(self, source, dest): self.adj_list[source].append(dest) def print_g...
normal
{ "blob_id": "ae5ec7919b9de4fbf578547c31837add32826f60", "index": 7448, "step-1": "class Graph:\n\n def __init__(self, num_vertices):\n self.adj_list = {}\n for i in range(num_vertices):\n self.adj_list[i] = []\n\n def add_vertice(self, source):\n self.adj_list[source] = []\n...
[ 5, 6, 7, 8 ]
""" Created on Wed Nov 6 13:03:42 2019 @author: antonio.blago """ #%% Connect to database import sqlite3 conn = sqlite3.connect('Portfolio_dividens.db') c = conn.cursor() from sqlalchemy import create_engine #suport pd.dataframe to sql table #import mysqlclient engine = create_engine("sqlite:///Portf...
normal
{ "blob_id": "cee77a97503cca517d03ce7cce189974da282a03", "index": 2500, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(inspect_tables) == 0:\n for k, t in enumerate(tickers):\n ticker_data = pd.DataFrame()\n try:\n ticker_data = wb.DataReader(t, data_source='yahoo', star...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ConnectWindow: <|reserved_special_token_0|> def startScreen(self): """This function creates the board and intializes the board count for each column""" self.background = Rectangle(Point(0, 0), Point(690, 590)) self.background.setFill('blue') ...
flexible
{ "blob_id": "abbad57e945d2195021948a0e0838c6bfd9c6a1e", "index": 769, "step-1": "<mask token>\n\n\nclass ConnectWindow:\n <mask token>\n\n def startScreen(self):\n \"\"\"This function creates the board and intializes the board count for each column\"\"\"\n self.background = Rectangle(Point(0,...
[ 2, 8, 10, 11, 16 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 10 11:08:59 2020 @author: rishi """ # --------- Global Variables ----------- # Will hold our game board data board = ["-" for i in range(1,26)] # Lets us know if the game is over yet game_still_going = True # Tells us who the winner is winner = ...
normal
{ "blob_id": "605e088beed05c91b184e26c4a5d2a97cb793759", "index": 2909, "step-1": "<mask token>\n\n\ndef display_board():\n print('\\n')\n print(board[0] + ' | ' + board[1] + ' | ' + board[2] + ' | ' + board[3] +\n ' | ' + board[4] + ' 1 | 2 | 3 | 4 | 5')\n print(board[5] + ' | ' + board[6] + ...
[ 7, 9, 11, 12, 13 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.17 on 2021-04-09 06:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lkft', '0021_reportjob_finished_successfully'), ] operations = [ migration...
normal
{ "blob_id": "787397473c431d2560bf8c488af58e976c1864d0", "index": 6730, "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 = [('lkft', '002...
[ 0, 1, 2, 3, 4 ]
balance=42 annualInterestRate=0.20 monthlyPaymentRate=0.04 monthlyir = annualInterestRate/12 rb=balance for i in range(12): mp = monthlyPaymentRate * rb rb=rb-mp rb=rb+rb*monthlyir print('remaining balance: ',round(rb,2))
normal
{ "blob_id": "1429524b0ae3b679bc3d4386dd17ed50b0fff381", "index": 146, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n mp = monthlyPaymentRate * rb\n rb = rb - mp\n rb = rb + rb * monthlyir\nprint('remaining balance: ', round(rb, 2))\n", "step-3": "balance = 42\nannualInter...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class manualSelecter(featureSelection): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class markerSelecter_tt(featureSelection): """ for labeled data only select cluster marker as feature """ def __init__(self, nu...
flexible
{ "blob_id": "c972f732553f27261d2a4a03e6e353f2e1b5f5d3", "index": 8256, "step-1": "<mask token>\n\n\nclass manualSelecter(featureSelection):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass markerSelecter_tt(featureSelection):\n \"\"\"\n for labeled data only\n select cluster marker as fe...
[ 9, 11, 21, 23, 25 ]
# python3 from random import randint def partition3(array, left, right): pivot = array[right] begin = left - 1 end = left - 1 for j in range(left, right): if array[j] < pivot: begin += 1 array[begin], array[j] = array[j], array[begin] end += 1 i...
normal
{ "blob_id": "a2fc9d947c75eaaaeafcd92750c99f4cfcdb9d7d", "index": 4517, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef partition3(array, left, right):\n pivot = array[right]\n begin = left - 1\n end = left - 1\n for j in range(left, right):\n if array[j] < pivot:\n be...
[ 0, 2, 3, 4, 5 ]
""" Simple neural network using pytorch """ import torch import torch.nn as nn # Prepare the data # X represents the amount of hours studied and how much time students spent sleeping X = torch.tensor(([2, 9], [1, 5], [3, 6]), dtype=torch.float) # 3 X 2 tensor # y represent grades. y = torch.tensor(([92], [100], [89]...
normal
{ "blob_id": "2d5e7c57f58f189e8d0c7d703c1672ea3586e4ac", "index": 6771, "step-1": "<mask token>\n\n\nclass Neural_Network(nn.Module):\n <mask token>\n\n def __init__(self, input_size=2, output_size=1, hidden_size=3):\n super(Neural_Network, self).__init__()\n self.input_size = input_size\n ...
[ 9, 10, 12, 13, 14 ]
<|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": "5f2110bcab465a85ad7db1b0e01a882b3ed305a5", "index": 2876, "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 = [('ashesiunder...
[ 0, 1, 2, 3, 4 ]
# 홍준이는 요즘 주식에 빠져있다. 그는 미래를 내다보는 눈이 뛰어나, 날 별로 주가를 예상하고 언제나 그게 맞아떨어진다. 매일 그는 아래 세 가지 중 한 행동을 한다. # 1. 주식 하나를 산다. # 2. 원하는 만큼 가지고 있는 주식을 판다. # 3. 아무것도 안한다. # 홍준이는 미래를 예상하는 뛰어난 안목을 가졌지만, 어떻게 해야 자신이 최대 이익을 얻을 수 있는지 모른다. 따라서 당신에게 날 별로 주식의 가격을 알려주었을 때, 최대 이익이 얼마나 되는지 계산을 해달라고 부탁했다. # 예를 들어 날 수가 3일이고 날 별로 주가가 10, 7, 6일 때, 주...
normal
{ "blob_id": "d3f6fb612e314ee2b86f6218719ecac2cc642c59", "index": 2992, "step-1": "# 홍준이는 요즘 주식에 빠져있다. 그는 미래를 내다보는 눈이 뛰어나, 날 별로 주가를 예상하고 언제나 그게 맞아떨어진다. 매일 그는 아래 세 가지 중 한 행동을 한다.\n\n# 1. 주식 하나를 산다.\n# 2. 원하는 만큼 가지고 있는 주식을 판다.\n# 3. 아무것도 안한다.\n\n# 홍준이는 미래를 예상하는 뛰어난 안목을 가졌지만, 어떻게 해야 자신이 최대 이익을 얻을 수 있는지 모른다. 따라서 당신에게...
[ 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run_test(): marks = 3 events, query = get_test_events_query(marks=marks) beta = th.rand([marks, marks]) get_r_terms(events=events, beta=beta) <|reserved_special_token_0|> <|reserved_special_token_1|> <|r...
flexible
{ "blob_id": "2681bd9fe93a4d61214b7c45e5d73097ab73dc07", "index": 5486, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_test():\n marks = 3\n events, query = get_test_events_query(marks=marks)\n beta = th.rand([marks, marks])\n get_r_terms(events=events, beta=beta)\n\n\n<mask token>...
[ 0, 1, 2, 3 ]
"""lendbooks URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/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": "9e950f6fe895cfd497e94139397e8a0f19725dc0", "index": 1902, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns += [url('^api-auth/', include('rest_framework.urls', namespace=\n 'rest_framework'))]\n", "step-3": "<mask token>\nurlpatterns = [url('^admin/', admin.site.urls), url('^'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class recomend(AsyncJsonWebsocketConsumer): async def connect(self): await self.accept() while True: df = pandas.read_csv(dataDir + 'Readings.csv', sep='\\t') recommendation1 = float(df['Recommendation1'][len(df) - 1]) recommendatio...
flexible
{ "blob_id": "466ffbd1f25423e4209fa7331d8b824b2dd3cd70", "index": 4031, "step-1": "<mask token>\n\n\nclass recomend(AsyncJsonWebsocketConsumer):\n\n async def connect(self):\n await self.accept()\n while True:\n df = pandas.read_csv(dataDir + 'Readings.csv', sep='\\\\t')\n r...
[ 6, 7, 8, 10, 13 ]
# Generated by Django 2.2.2 on 2021-01-23 04:11 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('task', '0022_taskrecycle_create_date'), ] operations = [ migrations.RemoveField( model_name='ansibleextravars', name='playbo...
normal
{ "blob_id": "d5beff74e3746c77cbaf6b8233b822ed1a86701e", "index": 316, "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 = [('task', '0022...
[ 0, 1, 2, 3, 4 ]
from rest_framework import viewsets from .serializers import UserSerializer from .models import UserCustom class UserViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. """ queryset = UserCustom.objects.all() serializer_class = UserSerializer
normal
{ "blob_id": "fadf16792822926cb7b7386291e52ce44693baf8", "index": 2053, "step-1": "<mask token>\n\n\nclass UserViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass UserViewSet(viewsets.ModelViewSet):\n <mask token>\n queryset = UserCu...
[ 1, 2, 3, 4 ]
from abc import abstractmethod from suzieq.shared.sq_plugin import SqPlugin class InventoryAsyncPlugin(SqPlugin): """Plugins which inherit this class will have methods 'run' Once the controller check that the object inherit this class, it launches a new task executing the run method. """ async d...
normal
{ "blob_id": "8b49aa63cc6e4490b7b22cd304dbba132962c870", "index": 9049, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass InventoryAsyncPlugin(SqPlugin):\n <mask token>\n\n async def run(self):\n \"\"\"Background task to launch in order to execute the plugin\"\"\"\n try:\n ...
[ 0, 1, 2, 3 ]
<|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": "a90db2073d43d54cbcc04e3000e5d0f2a2da4a55", "index": 5281, "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 = [('index', '00...
[ 0, 1, 2, 3, 4 ]
from django.apps import AppConfig class BoletoGerenciaNetConfig(AppConfig): name = 'boletogerencianet'
normal
{ "blob_id": "c2069113f322c97e953fba6b9d21b90a8b13a066", "index": 2308, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BoletoGerenciaNetConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BoletoGerenciaNetConfig(AppConfig):\n name = 'boletogerencianet'\n", "step-4"...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-07-31 18:38 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('product', '0007_auto_20170731_1812'), ] operations...
normal
{ "blob_id": "ae82ecadb61fd87afbc83926b9dc9d5f7e8c35a0", "index": 4194, "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 = [('product', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def tt(X, y, sample): X_train, X_valid, y_train, y_valid = train_test_split(X, y, train_size= sample, random_state=1) return {'X_train': X_train, 'X_valid': X_valid, 'y_train': y_train, 'y_valid': y_valid} <|reserved_special_token_1|> <|reserved_special_token_0|...
flexible
{ "blob_id": "1b773f2ca01f07d78d2d7edc74cd2df6630aa97a", "index": 4968, "step-1": "<mask token>\n\n\ndef tt(X, y, sample):\n X_train, X_valid, y_train, y_valid = train_test_split(X, y, train_size=\n sample, random_state=1)\n return {'X_train': X_train, 'X_valid': X_valid, 'y_train': y_train,\n ...
[ 1, 2, 3, 4, 5 ]
listtuple = [(1, 2), (2, 3), (3, 4), (4, 5)] dictn = dict(listtuple) print(dictn)
normal
{ "blob_id": "85bc304c69dac8bb570f920f9f12f558f4844c49", "index": 8644, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dictn)\n", "step-3": "listtuple = [(1, 2), (2, 3), (3, 4), (4, 5)]\ndictn = dict(listtuple)\nprint(dictn)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
""" COMPARISON OPERATORS """ __author__ = 'Sol Amour - amoursol@gmail.com' __twitter__ = '@solamour' __version__ = '1.0.0' greaterThan = 10 > 5 # Is '10' greater than '5' ? Evaluates to True greaterThanOrEqualTo = 10 >= 10 # Is '10' greater than or equal to '10' # ? Evaluates to True lessThan = 5 < 10 # Is '5' les...
normal
{ "blob_id": "3b737aaa820da8f70a80480c6404e4d3a9d2262e", "index": 5602, "step-1": "<mask token>\n", "step-2": "<mask token>\n__author__ = 'Sol Amour - amoursol@gmail.com'\n__twitter__ = '@solamour'\n__version__ = '1.0.0'\ngreaterThan = 10 > 5\ngreaterThanOrEqualTo = 10 >= 10\nlessThan = 5 < 10\nlessThanOrEqualT...
[ 0, 1, 2 ]
from xai.brain.wordbase.adjectives._corporal import _CORPORAL #calss header class _CORPORALS(_CORPORAL, ): def __init__(self,): _CORPORAL.__init__(self) self.name = "CORPORALS" self.specie = 'adjectives' self.basic = "corporal" self.jsondata = {}
normal
{ "blob_id": "d2787f17a46cf0db9aeea82f1b97ee8d630fd28a", "index": 8932, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass _CORPORALS(_CORPORAL):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass _CORPORALS(_CORPORAL):\n\n def __init__(self):\n _CORPORAL.__init__(self)\n se...
[ 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": "0aed35827e6579f7a9434d252d0b9150ab24adf9", "index": 4573, "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 = [('codenerix_p...
[ 0, 1, 2, 3, 4 ]
# _*_ coding:utf-8 _*_ import csv c=open(r"e:/test.csv","r+") #read=csv.reader(c) #for line in read: # print line read=c.readlines() print read c.close()
normal
{ "blob_id": "c65e14de297cc785b804e68f29bd5766ca7a8cf7", "index": 7958, "step-1": "# _*_ coding:utf-8 _*_\nimport csv\n\nc=open(r\"e:/test.csv\",\"r+\")\n#read=csv.reader(c)\n#for line in read:\n# print line\nread=c.readlines()\nprint read\nc.close()", "step-2": null, "step-3": null, "step-4": null, "s...
[ 0 ]
import time t0 = time.time() while abs(t0 - time.time() < 60): pass
normal
{ "blob_id": "9a0e37aaa41f3b21ed7ad11096cd6c5dd0bb8564", "index": 5608, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile abs(t0 - time.time() < 60):\n pass\n", "step-3": "<mask token>\nt0 = time.time()\nwhile abs(t0 - time.time() < 60):\n pass\n", "step-4": "import time\nt0 = time.time()\nwh...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_req_var(var): result = 0 for s in vars: s = re.search('((?<=' + var + '>).+)', s) if s: result = s[0] break return result <|reserved_special_token_0|> @app.route('/') def home(): return render_template('index.html') <|r...
flexible
{ "blob_id": "e30aaf1616a107662924da3671b179a1887974f7", "index": 2404, "step-1": "<mask token>\n\n\ndef get_req_var(var):\n result = 0\n for s in vars:\n s = re.search('((?<=' + var + '>).+)', s)\n if s:\n result = s[0]\n break\n return result\n\n\n<mask token>\n\n\n@...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "52a4213a1729e25f96faebc5fd4f299017446c5a", "index": 6370, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
""" @file : 001-rnn+lstm+crf.py @author: xiaolu @time : 2019-09-06 """ import re import numpy as np import tensorflow as tf from sklearn.metrics import classification_report class Model: def __init__(self, dim_word, dim_char, dropout, learning_rate, hidden_size_char, hidden_size_word, num_l...
normal
{ "blob_id": "5d9c8e235385ff53c7510994826ff3a04e4a5888", "index": 10, "step-1": "<mask token>\n\n\nclass Model:\n\n def __init__(self, dim_word, dim_char, dropout, learning_rate,\n hidden_size_char, hidden_size_word, num_layers):\n \"\"\"\n :param dim_word: 词的维度\n :param dim_char: 字...
[ 5, 8, 10, 11, 13 ]
# import adafruit_ads1x15 as adс # from adafruit_ads1x15 import ads1x15 as adc # from adafruit_ads1x15 import analog_in import time import busio import board from adafruit_ads1x15 import ads1015 as ADS from adafruit_ads1x15.analog_in import AnalogIn i2c = busio.I2C(board.SCL, board.SDA) ads = ADS.ADS1015(i2c...
normal
{ "blob_id": "388904b6b826a1c718b85f2951a3189bb5abea2a", "index": 9755, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('{:>5}\\t{:>5}'.format('raw', 'v'))\nwhile True:\n print('{:>5}\\t{:>5.3f}'.format(chan.value, chan.voltage))\n time.sleep(0.5)\n", "step-3": "<mask token>\ni2c = busio.I2C(...
[ 0, 1, 2, 3, 4 ]
import math from Config import defaults as df from Utils.controls import sigmoid_decay def f1(phi, phi_o, d): """sinusoidally growing function between (phi_o-d) to phi_o""" return 1 - sigmoid_decay(phi, phi_o, d) def f2(phi, sigma): """normal distribution""" return math.exp(-phi ** 2 / sigma ** 2) ...
normal
{ "blob_id": "19bb3cd0c7862f39a78479d9a9703ebef198fc73", "index": 3677, "step-1": "<mask token>\n\n\ndef f1(phi, phi_o, d):\n \"\"\"sinusoidally growing function between (phi_o-d) to phi_o\"\"\"\n return 1 - sigmoid_decay(phi, phi_o, d)\n\n\ndef f2(phi, sigma):\n \"\"\"normal distribution\"\"\"\n retu...
[ 2, 3, 4, 5, 6 ]
### To run the test use: ### python3 -m unittest test_script.py import unittest import re class TestCustomerDetails(unittest.TestCase): def test_cu_name(self): ### Our script has a class ConfigurationParser, which will have method ParseCuNames cp = ConfigurationParser() ### expected nam...
normal
{ "blob_id": "582cbacd26f4a3ed0b4f5c85af67758de7c05836", "index": 7396, "step-1": "<mask token>\n\n\nclass ConfigurationParser:\n <mask token>\n <mask token>\n\n def ParseVlan(self, cuName):\n intPattern = (\n 'interface GigabitEthernet0\\\\/0.([0-9]+)\\\\n\\\\s+encapsulation\\\\s+dot1Q...
[ 2, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'filter': false, 'title': 'cash.py', 'tooltip': '/pset6/cash/cash.py', 'undoManager': {'mark': 100, 'position': 100, 'stack': [[{'start': { 'row': 12, 'column': 7}, 'end': {'row': 12, 'column': 8}, 'action': 'insert', 'lines': [' '], 'id': 308}, ...
flexible
{ "blob_id": "d14c22ba6db90a93a19d61e105e31b3eb8f3a206", "index": 1706, "step-1": "<mask token>\n", "step-2": "{'filter': false, 'title': 'cash.py', 'tooltip': '/pset6/cash/cash.py',\n 'undoManager': {'mark': 100, 'position': 100, 'stack': [[{'start': {\n 'row': 12, 'column': 7}, 'end': {'row': 12, 'colum...
[ 0, 1, 2 ]
from django.db import models from django.utils import timezone class Test(models.Model): word1 = models.CharField(max_length=50) word2 = models.CharField(max_length=50) word3 = models.CharField(max_length=50) answer = models.CharField(max_length=50) #def __str__(self): # return self.word1, ...
normal
{ "blob_id": "2a1d31b2123c11af3fce571287d3dad00a9b0086", "index": 2820, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test(models.Model):\n word1 = models.Char...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def income_input(prompt_message): prompt = prompt_message + ' ' temp = input(prompt) return float(temp) <|reserved_special_token_0|> <|reserved_special_token_1|> def income_input(prompt_message): prompt = prompt_message + ' ' temp = i...
flexible
{ "blob_id": "d5acde6c6139833c6631a2d88a181cd019d3d2da", "index": 5747, "step-1": "<mask token>\n", "step-2": "def income_input(prompt_message):\n prompt = prompt_message + ' '\n temp = input(prompt)\n return float(temp)\n\n\n<mask token>\n", "step-3": "def income_input(prompt_message):\n prompt =...
[ 0, 1, 2, 3, 4 ]
import copy import numpy as np from PySide2.QtCore import QItemSelectionModel, QObject, Signal from PySide2.QtWidgets import ( QComboBox, QLineEdit, QSizePolicy, QTableWidgetItem ) from hexrd.constants import chargestate from hexrd.material import Material from hexrd.ui.periodic_table_dialog import PeriodicTabl...
normal
{ "blob_id": "ec2be72f81d260c491cdc31b68b34401fb49b91e", "index": 2660, "step-1": "<mask token>\n\n\nclass MaterialSiteEditor(QObject):\n <mask token>\n\n def __init__(self, site, parent=None):\n super().__init__(parent)\n loader = UiLoader()\n self.ui = loader.load_file('material_site_...
[ 39, 40, 47, 54, 57 ]
<|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": "8471e6a3b6623236740ad5219e5038a64e0c0056", "index": 2083, "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 ]
def my_filter(L, num): return [x for x in L if x % num] print 'my_filter', my_filter([1, 2, 4, 5, 7], 2) def my_lists(L): return [range(1, x+1) for x in L] print 'my_lists', my_lists([1, 2, 4]) print 'my_lists', my_lists([0]) def my_function_composition(f, g): return {f_key: g[f_val] for f_key, f_val in f.item...
normal
{ "blob_id": "119ebdf4c686c52e052d3926f962cefdc93681cd", "index": 9984, "step-1": "def my_filter(L, num):\n\treturn [x for x in L if x % num]\n\nprint 'my_filter', my_filter([1, 2, 4, 5, 7], 2)\n\n\ndef my_lists(L):\n\treturn [range(1, x+1) for x in L]\n\nprint 'my_lists', my_lists([1, 2, 4])\nprint 'my_lists', m...
[ 0 ]
<|reserved_special_token_0|> class VirtualArray(common.CoprHDResource): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def varray_list(self, vdcname=None): """Returns all the varrays in a vdc. :param vdcname: Na...
flexible
{ "blob_id": "2d48a343ca7f0f8ba7de8b520aad71d774d9b4ba", "index": 9302, "step-1": "<mask token>\n\n\nclass VirtualArray(common.CoprHDResource):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def varray_list(self, vdcname=None):\n \"\"\"Returns all the varrays in a vdc.\n\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class RealVelocityController(RegulatorBaseClass): settings = {'kp': 10, 'ki': 0, 'kd': 1} v_d = 4 emergency_break_constant = 0.4 emergency_break_safety_factor = 1 def __init__(self): self.orientation_controller = PID(**self.settings, signed_error= ...
flexible
{ "blob_id": "98bf0a332a6753e500b24bed2af16fe4a1cb9568", "index": 1560, "step-1": "<mask token>\n\n\nclass RealVelocityController(RegulatorBaseClass):\n settings = {'kp': 10, 'ki': 0, 'kd': 1}\n v_d = 4\n emergency_break_constant = 0.4\n emergency_break_safety_factor = 1\n\n def __init__(self):\n ...
[ 10, 11, 13, 14, 15 ]
<|reserved_special_token_0|> class Record: def __init__(self, value=10, name='name'): self.id = name self.value = value <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Record: def __init__(self, value=10, ...
flexible
{ "blob_id": "3e1540a06c478d471f6e6a190cadc44d5c4c2467", "index": 665, "step-1": "<mask token>\n\n\nclass Record:\n\n def __init__(self, value=10, name='name'):\n self.id = name\n self.value = value\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Record:\n\n def __...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def calc(N, D): def check(n): return not sig(factor(n)) % D cachePrimes(int(N ** 0.5)) def a2n(a): return (a + 1) // D from math import log def genPrimeSigDivs(minA, maxA): if minA > maxA: return None maxE = int(ceil(log(m...
flexible
{ "blob_id": "fabd3f233753f63d731a43c8b8b311e50d9deefe", "index": 6349, "step-1": "<mask token>\n\n\ndef calc(N, D):\n\n def check(n):\n return not sig(factor(n)) % D\n cachePrimes(int(N ** 0.5))\n\n def a2n(a):\n return (a + 1) // D\n from math import log\n\n def genPrimeSigDivs(minA...
[ 1, 3, 4, 5, 6 ]
from coarsegrainparams import * from inva_fcl_stab import * from Eq import * from Dynamics import * from sympy import Matrix,sqrt def construct_param_dict(params,K_RC,K_CP,m_P): """ Construct all the parameters from its relationships with body size and temperature, using the normalizing constants and scaling e...
normal
{ "blob_id": "99c12e925850fe7603831df5b159db30508f4515", "index": 3832, "step-1": "<mask token>\n\n\ndef construct_param_dict(params, K_RC, K_CP, m_P):\n \"\"\"\n Construct all the parameters from its relationships with body size and temperature, using the normalizing constants and scaling exponent w\n \...
[ 5, 8, 9, 10, 11 ]
import sys num = int(input()) odd_sum = 0 even_sum = 0 odd_smallest = sys.maxsize even_smallest = sys.maxsize odd_biggest = -sys.maxsize even_biggest = -sys.maxsize for i in range(0, num): element = float(input()) if i % 2 != 0: even_sum += element if element <= even_smallest: even_s...
normal
{ "blob_id": "69e8601a387d0987fbb6d1da5ac0f9412fffc63d", "index": 8768, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, num):\n element = float(input())\n if i % 2 != 0:\n even_sum += element\n if element <= even_smallest:\n even_smallest = element\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # # All about users. # # author: ze.apollo@gmail.com # from client import ClientHelper from mongodb import MongoDBClient class FixedData: def get_data( self, id ): data = self.get_data_from_mongodb( id ) if ( data ): return data else: ...
normal
{ "blob_id": "b1530c664fa236e61ff50bca502bf79730c3386c", "index": 6647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FixedData:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FixedData:\n\n def get_data(self, id):\n data = self.get_data_from_mongodb(id)\n if data:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Modeller: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Modeller: <|reserved_special_token_0|> def event_mode(self): refusals = 0 processed = 0 generated_request...
flexible
{ "blob_id": "11ed7550c25ca9944ce7073d9655cb9af7bdeae9", "index": 1324, "step-1": "<mask token>\n\n\nclass Modeller:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Modeller:\n <mask token>\n\n def event_mode(self):\n refusals = 0\n processed = 0\n generated...
[ 1, 2, 3, 4, 5 ]
import requests import json URL = 'https://www.sms4india.com/api/v1/sendCampaign' # get request def sendPostRequest(reqUrl, apiKey, secretKey, useType, phoneNo, senderId, textMessage): req_params = { 'apikey':EON386947EGSUZ4VEMIL8AWQX8RQW6UH, 'secret':FB2K25JVMFPEM310, 'usetype':useType, 'p...
normal
{ "blob_id": "c889fd081eb606dca08fade03aa0a4d32319f98d", "index": 9362, "step-1": "import requests\r\nimport json\r\n\r\nURL = 'https://www.sms4india.com/api/v1/sendCampaign'\r\n\r\n\r\n\r\n\r\n# get request\r\ndef sendPostRequest(reqUrl, apiKey, secretKey, useType, phoneNo, senderId, textMessage):\r\n req_param...
[ 0 ]
from EdgeState import EdgeState from rest_framework import serializers from dzTrafico.BusinessLayer.TrafficAnalysis.TrafficAnalyzer import TrafficAnalyzer, VirtualRampMetering from dzTrafico.BusinessEntities.Location import LocationSerializer from dzTrafico.BusinessLayer.SimulationCreation.NetworkManager import Network...
normal
{ "blob_id": "892c363c247177deb3297af84a93819a69e16801", "index": 8907, "step-1": "from EdgeState import EdgeState\nfrom rest_framework import serializers\nfrom dzTrafico.BusinessLayer.TrafficAnalysis.TrafficAnalyzer import TrafficAnalyzer, VirtualRampMetering\nfrom dzTrafico.BusinessEntities.Location import Loca...
[ 0 ]
from pickle import dump, load def save(parameters): # Функция сохранения прогресса в файл with open('saves/save.zs', 'wb') as game_save: dump(parameters, game_save) game_save.close() def load_settings(): # Функция загрузки сохранения при выборе опции продолжения игры try:...
normal
{ "blob_id": "9d27b8844ab4070bb53afd89620177b89013956e", "index": 4164, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save(parameters):\n with open('saves/save.zs', 'wb') as game_save:\n dump(parameters, game_save)\n game_save.close()\n\n\n<mask token>\n", "step-3": "<mask toke...
[ 0, 1, 2, 3, 4 ]
from setuptools import setup setup(name='RedHatSecurityAdvisory', version='0.1', description='Script that automatically checks the RedHat security advisories to see if a CVE applies', author='Pieter-Jan Moreels', url='https://github.com/PidgeyL/RedHat-Advisory-Checker', entry_points={'con...
normal
{ "blob_id": "3f8c13be547099aa6612365452926db95828b9a0", "index": 554, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='RedHatSecurityAdvisory', version='0.1', description=\n 'Script that automatically checks the RedHat security advisories to see if a CVE applies'\n , author='Pieter-Jan Mo...
[ 0, 1, 2, 3 ]
<|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": "a3382c3e6e04ccb87b1d55f072ce959b137f9fdd", "index": 5722, "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 = [('Product', '...
[ 0, 1, 2, 3, 4 ]
class Vehicle: def __init__(self, category, top_speed, acceleration, position=0, speed =0, wheels=4): self.category = category self.speed = speed self.top_speed = top_speed self.position = position self.acceleration = acceleration self.wheels = wheels <|r...
flexible
{ "blob_id": "b1573f80395d31017ceacbb998e421daf20ab75f", "index": 6961, "step-1": "class Vehicle:\n\n def __init__(self, category, top_speed, acceleration, position=0, speed\n =0, wheels=4):\n self.category = category\n self.speed = speed\n self.top_speed = top_speed\n self.p...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> proc1.start() <|reserved_special_token_0|> proc2.start() <|reserved_special_token_1|> <|reserved_special_token_0|> web = WebServer() board_boy = Measurer_and_Filer() proc1 = Process(target=board_boy.measure_and_file, args=()) p...
flexible
{ "blob_id": "26744d51dbce835d31d572a053294c9d280e1a8b", "index": 3956, "step-1": "<mask token>\n", "step-2": "<mask token>\nproc1.start()\n<mask token>\nproc2.start()\n", "step-3": "<mask token>\nweb = WebServer()\nboard_boy = Measurer_and_Filer()\nproc1 = Process(target=board_boy.measure_and_file, args=())\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: if a == 'r': print(random.randint(1, 6)) elif a == 'q': print('bye!') exit() else: print("give either 'r' or 'q'") <|reserved_special_token_1|> <|reserved_special_token_0|...
flexible
{ "blob_id": "7e1f77210b3beb4e496ff95686d65bd7d79561a3", "index": 170, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n if a == 'r':\n print(random.randint(1, 6))\n elif a == 'q':\n print('bye!')\n exit()\n else:\n print(\"give either 'r' or 'q'\")\n", "s...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Fri Nov 2 16:07:25 2018 @author: Yigao """ import re from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords from wordcloud import WordCloud import matplotlib.pyplot as plt ## create a tokenizer hfilename = "file.txt" linecount=0 hashcount=0 wordcount=0 BagO...
normal
{ "blob_id": "fd04f6f4a03fdbe40e400d04e5759ef9ef30f974", "index": 6634, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(hfilename, 'r') as file:\n for line in file:\n tweetSplitter = TweetTokenizer(strip_handles=True, reduce_len=True)\n WordList = tweetSplitter.tokenize(line)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TriggerPipelineReference(Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TriggerPipelineReference(Model): <|reserved_special_token_0|> _attribute_m...
flexible
{ "blob_id": "6a954197b13c9adf9f56b82bcea830aaf44e725f", "index": 8999, "step-1": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TriggerPipelineReference(Model):\n <mask token>\n _attribute_map = {'pipe...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dataFrame1.columns) print(dataFrame1.info()) print(dataFrame1.dtypes) print(dataFrame1.describe()) <|reserved_special_token_1|> <|reserved_special_token_0|> dictionary = {'Name': ['Ali', 'Buse', 'Selma', 'Hakan', 'Bülent'...
flexible
{ "blob_id": "efa94f8442c9f43234d56a781d2412c9f7ab1bb3", "index": 7910, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dataFrame1.columns)\nprint(dataFrame1.info())\nprint(dataFrame1.dtypes)\nprint(dataFrame1.describe())\n", "step-3": "<mask token>\ndictionary = {'Name': ['Ali', 'Buse', 'Selma', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> tf.flags.DEFINE_integer('embedding_dim', 100, 'Dimensionality of character embedding (default: 100)') tf.flags.DEFINE_float('dropout_keep_prob', 0.5, 'Dropout keep probability (default: 0.5)') tf.flags.DEFINE_integer('batc...
flexible
{ "blob_id": "aa1a7de92b971b6d10d09b2f8ca2c55516e538e4", "index": 9904, "step-1": "<mask token>\n", "step-2": "<mask token>\ntf.flags.DEFINE_integer('embedding_dim', 100,\n 'Dimensionality of character embedding (default: 100)')\ntf.flags.DEFINE_float('dropout_keep_prob', 0.5,\n 'Dropout keep probability ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 """ Requests username and tasks from JSON Placeholder based on userid (which is sys.argv[1]) """ import json import requests import sys if __name__ == "__main__": url = "https://jsonplaceholder.typicode.com" if len(sys.argv) > 1: user_id = sys.argv[1] name = requests.get("{}...
normal
{ "blob_id": "e1a2b33a1ec7aca21a157895d8c7c5b5f29ff49c", "index": 5047, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url = 'https://jsonplaceholder.typicode.com'\n if len(sys.argv) > 1:\n user_id = sys.argv[1]\n name = requests.get('{}/users/{}'.format(ur...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TimeoutException(Exception): pass <|reserved_special_token_0|> class Control(StreamRequestHandler): allow_reuse_address = True def handle(self): command = 'go' prompt = True while command not in ['quit', 'exit']: command = read_co...
flexible
{ "blob_id": "e00b81f73f4f639e008fde1a6b2d4f7937df4207", "index": 8518, "step-1": "<mask token>\n\n\nclass TimeoutException(Exception):\n pass\n\n\n<mask token>\n\n\nclass Control(StreamRequestHandler):\n allow_reuse_address = True\n\n def handle(self):\n command = 'go'\n prompt = True\n ...
[ 6, 9, 10, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from tw.core import *
flexible
{ "blob_id": "ea25aedc4728c18ac3d5da22c76cb7f1ef65e827", "index": 4958, "step-1": "<mask token>\n", "step-2": "from tw.core import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import json import spotipy import spotipy.util as util from spotipy.oauth2 import SpotifyClientCredentials from flask import abort, Flask, flash, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from helpers import login_required # Configure application app = ...
normal
{ "blob_id": "4f674b30c919c7ec72c11a8edd9692c91da7cb90", "index": 9595, "step-1": "<mask token>\n\n\n@app.route('/tracks', methods=['POST'])\ndef get_user_tracks():\n ids = json.loads(request.data)['ids']\n tracks.extend(ids)\n return 'success'\n\n\n@app.route('/')\n@login_required\ndef index():\n use...
[ 4, 6, 7, 8, 9 ]
from django.contrib.auth.models import User from django.db import models class QueuedSpace(models.Model): """ Stores space json for possible further editing before being sent to the server. q_etag should update on every save so conflicts can be checked for in queued items. """ space_id = models.In...
normal
{ "blob_id": "ff09993a4f8fed65fa00c065eb5cfa41e7f9dcc1", "index": 4411, "step-1": "<mask token>\n\n\nclass QueuedSpace(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __unicode__(self):\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data', one_hot=True) num_sample = mnist_data.train.num_examples dataset = 'mnist' if dataset == 'mnist': in...
flexible
{ "blob_id": "02a28b61ad9d664c89829df019f4887c2c869f91", "index": 6046, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data',\n one_hot=True)\n num_sample = mnist_data.train.num_examples\n dataset ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestSpeckleStream(unittest.TestCase): def setUp(self): self.s = SpeckleApiClient() self.user = {'email': 'testuser@arup.com', 'password': 'testpassword', 'username': 'testuser'} self.test_stream = 'RKWgU-oWF' self.test_object = '5bcf2...
flexible
{ "blob_id": "b39403171ed264c8fae5ea4ae9d17f77cfcab497", "index": 9122, "step-1": "<mask token>\n\n\nclass TestSpeckleStream(unittest.TestCase):\n\n def setUp(self):\n self.s = SpeckleApiClient()\n self.user = {'email': 'testuser@arup.com', 'password':\n 'testpassword', 'username': 'te...
[ 7, 11, 12, 13, 14 ]
<|reserved_special_token_0|> class TypeDirPath(TypeBase): @classmethod def control(cls, delegate, property_item, parent): return PathParamWidget(delegate, parent=parent) <|reserved_special_token_0|> @classmethod def value(cls, control): return control.text() <|reserved_specia...
flexible
{ "blob_id": "ee91e8c9dcb940882733b2d23b74a76d0392f4fe", "index": 2126, "step-1": "<mask token>\n\n\nclass TypeDirPath(TypeBase):\n\n @classmethod\n def control(cls, delegate, property_item, parent):\n return PathParamWidget(delegate, parent=parent)\n <mask token>\n\n @classmethod\n def valu...
[ 21, 41, 43, 45, 61 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): cateto1 = input('dime un cateto') cateto2 = input('dime el otro cateto') print('la hipotenusa es: '), hipotenusa(cateto1, cateto2) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved...
flexible
{ "blob_id": "50ae2b4c6d51451031fc31ebbc43c820da54d827", "index": 7898, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n cateto1 = input('dime un cateto')\n cateto2 = input('dime el otro cateto')\n print('la hipotenusa es: '), hipotenusa(cateto1, cateto2)\n\n\n<mask token>\n", "...
[ 0, 1, 2, 3, 5 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 1 17:08:06 2023 @author: Alice Wells Plotting script for Figure 10 in Wells et al., 2023 Aerosol extinction coefficient vertical profile averaged longitudinally. Averaged monthly CALIOP (centre) aerosol extinction coefficient vertical profiles ...
normal
{ "blob_id": "e77c855ba87bc36ab09b0a3eca5c1b7123535794", "index": 2802, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(85):\n so2_ash_masked[:, i, :] = so2_ash[:, i, :] * mask\n so2_only_masked[:, i, :] = so2_only[:, i, :] * mask\n<mask token>\nplt.rcParams.update(params)\n<mask token...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PyLayer(caffe.Layer): def setup(self, bottom, top): if len(bottom) != 2: raise Exception('Need two inputs to compute distance') def reshape(self, bottom, top): if bottom[0].count != bottom[1].count: raise Exception('Inputs must have ...
flexible
{ "blob_id": "8040b47dc3fd6b03432f64d7fb8a4267cc94ac9a", "index": 2698, "step-1": "<mask token>\n\n\nclass PyLayer(caffe.Layer):\n\n def setup(self, bottom, top):\n if len(bottom) != 2:\n raise Exception('Need two inputs to compute distance')\n\n def reshape(self, bottom, top):\n if...
[ 3, 4, 5, 6, 7 ]
""" This is a big integer challenge. You are given an integer which is a **perfect square**. It is composed of 40 or more digits. Compose a function which will find the exact square root of this integer. ### Examples square_root(152415787532388367501905199875019052100) ➞ 12345678901234567890 square_ro...
normal
{ "blob_id": "f9b53df799b3e6b71282c84a625ea5915ccb8014", "index": 1966, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef square_root(n):\n start = 1\n end = n\n if n == 0 or n == 1:\n return n\n while start <= end:\n mid = (start + end) // 2\n if mid * mid == n:\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Bet(Document): """Bet that a user has placed""" OUTCOME = (-1, 'Team 2 wins'), (0, 'Draw'), (1, 'Team 1 wins') group_match = ReferenceField(GroupMatch) user = ReferenceField(User) amount = DecimalField() currency = StringField(max_length=3, choices=CURRENCIES...
flexible
{ "blob_id": "0e8a11c5b5a95929c533597d79ee4f3d037c13e0", "index": 4961, "step-1": "<mask token>\n\n\nclass Bet(Document):\n \"\"\"Bet that a user has placed\"\"\"\n OUTCOME = (-1, 'Team 2 wins'), (0, 'Draw'), (1, 'Team 1 wins')\n group_match = ReferenceField(GroupMatch)\n user = ReferenceField(User)\n...
[ 9, 10, 15, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BytesField(BlobField): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BytesField(BlobField): <|reserved_special_token_0|> def...
flexible
{ "blob_id": "b11869076c2c8d6207df861cd1d0b0434b3f9477", "index": 9836, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BytesField(BlobField):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BytesField(BlobField):\n <mask token>\n\n def adapt(self, value):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': dir_path = os.path.dirname(os.path.realpath(__file__)) if runBatch: fixed_params = {'width': 60, 'height': 60, 'splitSize': 1, 'distributed': True, 'verbose': False, 'searchSi...
flexible
{ "blob_id": "57b51ea36e9e2a095cf7e9646db2cc400cc72b83", "index": 1082, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n dir_path = os.path.dirname(os.path.realpath(__file__))\n if runBatch:\n fixed_params = {'width': 60, 'height': 60, 'splitSize': 1,\n '...
[ 0, 1, 2, 3, 4 ]
class Car: <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self): self.__updateSoftware() self.__name = 'Supercar' self.__maxspeed = 320 def drive(self): print('Driving') print('name of the car ' + self.__name) def __updateSoftware(s...
flexible
{ "blob_id": "318556a6c327294986fcef938c254b8dfe66adaa", "index": 6375, "step-1": "class Car:\n <mask token>\n <mask token>\n\n def __init__(self):\n self.__updateSoftware()\n self.__name = 'Supercar'\n self.__maxspeed = 320\n\n def drive(self):\n print('Driving')\n ...
[ 5, 6, 7, 8, 9 ]
def getArticle(): text = [] idx = 1 with open('article.txt','r') as f: data = f.readlines() for i in data: if i != '\n': s = "{ 'id':" + str(idx) + "," + "'text':" + i.rstrip() + " }" text.append(s) idx+=1 return text a = getArticle() print a ''' create a list of 100 words article use javascri...
normal
{ "blob_id": "6591ad20d4a07f29f22b50b6e8998c51e53600d6", "index": 5686, "step-1": "def getArticle():\n\ttext = []\n\tidx = 1\n\twith open('article.txt','r') as f:\n\t\tdata = f.readlines()\n\t\tfor i in data:\n\t\t\tif i != '\\n':\n\t\t\t\ts = \"{ 'id':\" + str(idx) + \",\" + \"'text':\" + i.rstrip() + \" }\" \n...
[ 0 ]
import random import matplotlib.pyplot as plt import tensorflow.keras as keras mnist = keras.datasets.mnist # MNIST datasets # Load Data and splitted to train & test sets # x : the handwritten data, y : the number (x_train_data, y_train_data), (x_test_data, y_test_data) = mnist.load_data() print('x_train_d...
normal
{ "blob_id": "b4eb62413fb8069d8f11c34fbfecc742cd79bdb8", "index": 7057, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('x_train_data shape:', x_train_data.shape)\nprint(x_train_data.shape[0], 'train samples')\nprint(x_test_data.shape[0], 'test samples')\nprint(x_train_data[0])\n<mask token>\nprint(y...
[ 0, 1, 2, 3, 4 ]
""" Compiled: 2020-09-18 10:38:52 """ #__src_file__ = "extensions/AppWorkspaceTools/etc/FAppWorkspaceDesignerNodes.py" """ Compiled: 2018-06-07 17:06:19 """ #__src_file__ = "extensions/AppWorkspaceTools/etc/FAppWorkspaceDesignerNodes.py" import acm import FUxCore import Contracts_AppConfig_Messages_AppWorkspace as Ap...
normal
{ "blob_id": "f80de2b069cf1dee2e665556262c6e84ce04b208", "index": 1244, "step-1": "<mask token>\n\n\nclass MainViewNode(NodeBase):\n <mask token>\n\n def Label(self):\n return 'Main View'\n <mask token>\n\n\nclass DockSectionNode(NodeBase):\n\n def __init__(self, label, icon, contents, settings...
[ 15, 37, 38, 44, 48 ]
import unittest from nldata.corpora import Telegram import os class TestTelegram(unittest.TestCase): def test_export_iter(self): pass # telegram = Telegram(data_dir) # it = telegram.split("train", n=20) # samples = [s for s in it] # self.assertEqual(len(samples), 20) ...
normal
{ "blob_id": "5c1d81c973487f1b091e58a6ccf5947c3f2a7e6d", "index": 1058, "step-1": "<mask token>\n\n\nclass TestTelegram(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestTelegram(unittest.TestCase):\n\n def test_export_iter(self):\n pass\n\n\n<mask toke...
[ 1, 2, 3, 4, 5 ]
def to_bitmask(n, bits): # [2:] to chop off the "0b" part mask = [int(digit) for digit in bin(n)[2:]] # pad to fixed length return [0] * (bits - len(mask)) + mask def invert_mask(mask): return [int(not bit) for bit in mask]
normal
{ "blob_id": "98f36b216e718fc4fe42d1717ff9ba82cc24c2ff", "index": 7752, "step-1": "<mask token>\n", "step-2": "def to_bitmask(n, bits):\n mask = [int(digit) for digit in bin(n)[2:]]\n return [0] * (bits - len(mask)) + mask\n\n\n<mask token>\n", "step-3": "def to_bitmask(n, bits):\n mask = [int(digit)...
[ 0, 1, 2, 3 ]
# 来源知乎 https://zhuanlan.zhihu.com/p/51987247 # 博客 https://www.cnblogs.com/yangecnu/p/Introduce-Binary-Search-Tree.html """ 二叉查找树 (Binary Search Tree, BST) 特点 : left < root < right 若任意节点的左子树不空,则左子树上所有结点的 值均小于它的根结点的值; 若任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 任意节点的左、右子树也分别为二叉查找树; 没有键值相等的节点(no ...
normal
{ "blob_id": "fa46bd784dcfeee4f9012ffb6ab6731d2764c9fa", "index": 8484, "step-1": "<mask token>\n\n\nclass BinarySearchTree:\n <mask token>\n\n def __init__(self):\n self._root = None\n\n def __str__(self):\n \"\"\" yield 迭代器 \"\"\"\n tree2list = [x.data for x in self._generate_node(...
[ 15, 19, 26, 31, 34 ]
from django.contrib.auth import get_user_model from rest_framework import generics from rest_framework.response import Response from rest_framework_jwt.settings import api_settings from status.api.serializers import StatusInlineUserSerializer from status.api.views import StatusAPIView from status.models import Status ...
normal
{ "blob_id": "472a79767f5dc7dc3cd03d89999d322b3885dcbf", "index": 1220, "step-1": "<mask token>\n\n\nclass UserStatusAPIView(StatusAPIView):\n serializer_class = StatusInlineUserSerializer\n search_fields = 'id',\n\n def get_queryset(self, *args, **kwargs):\n username = self.kwargs.get('username')...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class PongBall(Widget): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, **kwargs): super(PongBall, self).__init__(**kwargs) self._bo...
flexible
{ "blob_id": "fa8431ae96cd6c1133d56285d0168f43d9068bc5", "index": 2099, "step-1": "<mask token>\n\n\nclass PongBall(Widget):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, **kwargs):\n super(PongBall, self).__init__(**kwargs)\n sel...
[ 8, 12, 13, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> def sumNumbers(self, root): def dfs(root, sofar): if root.left is None...
flexible
{ "blob_id": "e6ac742eb74d5d18e4c304a8ea1331e7e16e403d", "index": 2317, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def sumNumbers(self, root):\n\n def dfs(root, sofar):\n if root.left is N...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> compiler.generate_proto(PROTO, '.') compiler.generate_proto(PROTO, '.', with_plugin='python_rpcz', suffix= '_rpcz.py') <|reserved_special_token_1|> <|reserved_special_token_0|> PROTO = '../index_server.proto' compiler.gener...
flexible
{ "blob_id": "e868998833774c829b05ae8da3280bed61363be1", "index": 177, "step-1": "<mask token>\n", "step-2": "<mask token>\ncompiler.generate_proto(PROTO, '.')\ncompiler.generate_proto(PROTO, '.', with_plugin='python_rpcz', suffix=\n '_rpcz.py')\n", "step-3": "<mask token>\nPROTO = '../index_server.proto'\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def welcome(): print('\nWelcome to the Bingo Game.') def initialise_grid(): grid = [['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', '' ], ['', '', '', '', ''], ['', '', '', '', '']] return grid def generate_b_column(grid): b_nums = [] for x in ...
flexible
{ "blob_id": "7be62ce45f815c4f4cf32df696cc444f92ac6d5c", "index": 8901, "step-1": "<mask token>\n\n\ndef welcome():\n print('\\nWelcome to the Bingo Game.')\n\n\ndef initialise_grid():\n grid = [['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''\n ], ['', '', '', '', ''], ['', '', '', ''...
[ 14, 15, 16, 17, 18 ]