code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
NUM_CLASSES = 31
AUDIO_SR = 16000
AUDIO_LENGTH = 16000
LIBROSA_AUDIO_LENGTH = 22050
EPOCHS = 25
categories = {
'stop': 0,
'nine': 1,
'off': 2,
'four': 3,
'right': 4,
'eight': 5,
'one': 6,
'bird': 7,
'dog': 8,
'no': 9,
'on': 10,
'seven': 11,
'cat': 12,
'left': 1... | normal | {
"blob_id": "6a9e18cde94258b01a37f459eceaac58118b4976",
"index": 5813,
"step-1": "<mask token>\n",
"step-2": "NUM_CLASSES = 31\nAUDIO_SR = 16000\nAUDIO_LENGTH = 16000\nLIBROSA_AUDIO_LENGTH = 22050\nEPOCHS = 25\ncategories = {'stop': 0, 'nine': 1, 'off': 2, 'four': 3, 'right': 4,\n 'eight': 5, 'one': 6, 'bir... | [
0,
1,
2
] |
# Create your views here.
# -*- coding: utf-8 -*-
from json import dumps
from django.shortcuts import render_to_response
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.conf import settings
from utils import Utils, MERCS, ENTITY, PARTS, ARMY, D... | normal | {
"blob_id": "b1c8aceab44574d0f53d30969861be028c920ef2",
"index": 5007,
"step-1": "# Create your views here.\n# -*- coding: utf-8 -*-\n\nfrom json import dumps\nfrom django.shortcuts import render_to_response\nfrom django.http import Http404, HttpResponseRedirect, HttpResponse\nfrom django.template import Request... | [
0
] |
# TUPLE IMUTAVEL
# GERALMENTE HETEORGENEA
# tupla com 1 ou 0 elementos
#
# empty = ()
# singleton = 'breno',
# print(type(empty))
# print(singleton)
# tuplas podem ser aninhadas
# t = 12345, 54321, 'hello!'
# u = t, (1, 2, 3, 4, 5)
#imutaveis
# t[0] = 88888 | normal | {
"blob_id": "34e902fbced13629657494eedfe385d3b5ae3f55",
"index": 2489,
"step-1": "# TUPLE IMUTAVEL\n# GERALMENTE HETEORGENEA\n\n# tupla com 1 ou 0 elementos\n#\n# empty = ()\n# singleton = 'breno',\n# print(type(empty))\n# print(singleton)\n\n# tuplas podem ser aninhadas\n# t = 12345, 54321, 'hello!'\n# u = t, (... | [
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
"""
Read all the images from a directory,
resize, rescale and rename them.
"""
| flexible | {
"blob_id": "670efbd9879099b24a87e19a531c4e3bbce094c6",
"index": 1666,
"step-1": "<mask token>\n",
"step-2": "\n\n\"\"\"\nRead all the images from a directory,\nresize, rescale and rename them.\n\"\"\"\n\n\n\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
session = boto3.session.Session(profile_name='dev_root')
iam_re = session.resource(service_name='iam')
for each in range(701, 1100):
try:
iam_re.create_user(UserName='ixasisiidemo' + str... | flexible | {
"blob_id": "00afab442f56d364c785324f816b52b4a6be609d",
"index": 3078,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n session = boto3.session.Session(profile_name='dev_root')\n iam_re = session.resource(service_name='iam')\n for each in range(701, 1100):\n try:\n ... | [
0,
1,
2,
3
] |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import config
import os
db = SQLAlchemy()
static_file_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'static')
def create_app(config_name):
app = Flask(__name__, static_folder=static_file_dir)
app.config.from_obje... | normal | {
"blob_id": "bee6ba1db608c1d9c8114f89d4b3abab795a6b86",
"index": 3843,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_app(config_name):\n app = Flask(__name__, static_folder=static_file_dir)\n app.config.from_object(config[config_name])\n config[config_name].init_app(app)\n fro... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def convertWPFile(mapName):
fullMapName = 'mp_' + mapName + '_waypoints.gsc'
waypoints = open(fullMapName, 'r')
wpLines = waypoints.readlines()
waypoints.close()
wpLinesNew = []
temp = 0
for i, j in e... | flexible | {
"blob_id": "1aacd04234d60e495888fc44abe3fbacf404e0ce",
"index": 5799,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef convertWPFile(mapName):\n fullMapName = 'mp_' + mapName + '_waypoints.gsc'\n waypoints = open(fullMapName, 'r')\n wpLines = waypoints.readlines()\n waypoints.close()\n... | [
0,
1,
2,
3,
4
] |
#Write a function remove_duplicates that takes in a list and removes elements of the list that are the same.
#For example: remove_duplicates([1,1,2,2])
#should return [1,2].
#Do not modify the list you take as input! Instead, return a new list.
def remove_duplicates(lst_of_items):
new_list=list()
#dict={}
... | normal | {
"blob_id": "b4d31fd05f8a9d66dcfffb55d805ab93d7ff9cdf",
"index": 5441,
"step-1": "#Write a function remove_duplicates that takes in a list and removes elements of the list that are the same.\n\n#For example: remove_duplicates([1,1,2,2])\n#should return [1,2].\n\n#Do not modify the list you take as input! Instead... | [
0
] |
from sklearn import svm, metrics, tree
from sklearn.ensemble import AdaBoostClassifier
from sklearn.neighbors import KNeighborsClassifier
import numpy as np
my_data = np.loadtxt('edited_data/dataset_regression_edited.csv',delimiter=',', dtype='str')
training_data = my_data[:, 0:6]
validation_data = my_data[:, 6]
... | normal | {
"blob_id": "3024359710148bfbb15677973555f214b1f878b7",
"index": 1521,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor classifier in classifiers:\n classifier.fit(training_data[:1500], validation_data[:1500])\n expected = validation_data[681:]\n predicted = classifier.predict(training_data[68... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def convert_torch_to_flow(model, torch_weight_path, save_path):
parameters = torch.load(torch_weight_path)
new_parameters = dict()
for key, value in parameters.items():
if 'num_batches_tracked' not in key:
... | flexible | {
"blob_id": "8a3cf65550893367b9001369111fa19a3e998d82",
"index": 9589,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef convert_torch_to_flow(model, torch_weight_path, save_path):\n parameters = torch.load(torch_weight_path)\n new_parameters = dict()\n for key, value in parameters.items():... | [
0,
1,
2,
3
] |
import math
def normal(data,mean,variance):
# print data-mean
return -1*(((data-mean)**2)/(2*variance)) - (0.5 * math.log(2*3.1415*variance))
a = math.log(0.33333) + normal(67.7854,6.0998,13.5408)
b = math.log(0.33333) + normal(67.7854,119.3287,9.4803)
c = math.log(0.33333) + normal(67.7854,65.7801,12.6203)
d =... | normal | {
"blob_id": "0edca9893d62eea6513543a1d3dd960e9e95d573",
"index": 7505,
"step-1": "import math\n\ndef normal(data,mean,variance):\n\t# print data-mean\n\treturn -1*(((data-mean)**2)/(2*variance)) - (0.5 * math.log(2*3.1415*variance))\n\na = math.log(0.33333) + normal(67.7854,6.0998,13.5408)\nb = math.log(0.3333... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for n in range(2, 51):
for k in range(n, n * n + 1):
queries.append((n, k))
print(len(queries))
for n, k in queries:
print(n, k)
<|reserved_special_token_1|>
queries = []
for n in range(2, 51):
for k in rang... | flexible | {
"blob_id": "798d5c68a0aa2057c28d7f333905f20fef965d70",
"index": 2850,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor n in range(2, 51):\n for k in range(n, n * n + 1):\n queries.append((n, k))\nprint(len(queries))\nfor n, k in queries:\n print(n, k)\n",
"step-3": "queries = []\nfor n ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def compute_vis(X, F):
vis = np.matmul(X, np.transpose(F)).astype(np.complex64)
return vis
def compute_vis_grad(vis, Z, F):
Z_vis = compute_vis(Z, F)
grad = -np.matmul(np.conjugate(F.T), vis - Z_vis)
return grad.real
<|reserved_special_token_0|>
def compute_amp_g... | flexible | {
"blob_id": "ea3217be80b6d1d3a400139bc4a91870cd2f1d87",
"index": 5118,
"step-1": "<mask token>\n\n\ndef compute_vis(X, F):\n vis = np.matmul(X, np.transpose(F)).astype(np.complex64)\n return vis\n\n\ndef compute_vis_grad(vis, Z, F):\n Z_vis = compute_vis(Z, F)\n grad = -np.matmul(np.conjugate(F.T), v... | [
11,
13,
15,
16,
17
] |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# 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... | normal | {
"blob_id": "eed3ec2897d4da20b576cb4e2ce95331ae223f76",
"index": 7938,
"step-1": "<mask token>\n\n\nclass AgentInstallerLocalTest(BaseDaemonLiveTestCase):\n <mask token>\n\n @classmethod\n def setUpClass(cls):\n cls.logger = setup_logger(cls.__name__)\n cls.source_url = get_source_uri()\n ... | [
4,
6,
8,
10,
11
] |
<|reserved_special_token_0|>
class GameList(ListCreateAPIView):
<|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|>
def perform_create... | flexible | {
"blob_id": "2908d34165fac272c9571be623855a0613c952f3",
"index": 5433,
"step-1": "<mask token>\n\n\nclass GameList(ListCreateAPIView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def perform_create(self, serializer):\n ... | [
18,
25,
26,
27,
28
] |
from network.utility import *
from entities.message import Message, BroadcastMessage, GroupMessage
from entities.node import Node
from entities.group import GroupBroadcast
from entities.request import Request
import threading
import time
import logging
import random
import json
import socket
from services.user import U... | normal | {
"blob_id": "67446f50d1c062eddcad282d3bf508967c5192fc",
"index": 4905,
"step-1": "<mask token>\n\n\nclass Sender:\n\n def __init__(self, reverseMap, info):\n self.reverseMap = reverseMap\n self.info = info\n\n def sendMessage(self, message):\n data = {'timestamp': message.timestamp, 'm... | [
9,
12,
13,
15,
16
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from machina.apps.forum_conversation.abstract_models import AbstractPost
from machina.apps.forum_conversation.abstract_models import AbstractTopic
from machina.core.db.models import model_factory
from django.dispatch import receiver
from django.db.models... | normal | {
"blob_id": "1e81e0f3cb2fb25fdef08a913aa1ff77d0c2a562",
"index": 9204,
"step-1": "<mask token>\n\n\nclass UserNotification(models.Model):\n user = models.ForeignKey(User, on_delete=models.CASCADE)\n notification_content = models.CharField(max_length=100)\n notification_link = models.CharField(max_length... | [
10,
11,
12,
13,
14
] |
<|reserved_special_token_0|>
class OrderCreateView(CreateView):
template_name = 'orders/form.html'
form_class = OrderForm
success_url = '/'
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class OrdersListView(ListView):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<... | flexible | {
"blob_id": "afd184962e8e69843ca518e140d5fdde3d7c9ed2",
"index": 7456,
"step-1": "<mask token>\n\n\nclass OrderCreateView(CreateView):\n template_name = 'orders/form.html'\n form_class = OrderForm\n success_url = '/'\n",
"step-2": "<mask token>\n\n\nclass OrdersListView(ListView):\n <mask token>\n ... | [
2,
3,
4,
5
] |
from sikuli import *
import logging
import myTools
from datetime import date
import reports_Compare
#---------------------------------------------------#
def fSet_BillDate(pMonth):
#---------------------------------------------------#
if pMonth == 13:
pMonth = 12
logging.debug('- change bill dat... | normal | {
"blob_id": "69721dca0f5d8396e330696cde52bfabad33c895",
"index": 3242,
"step-1": "<mask token>\n\n\ndef fSet_BillDate(pMonth):\n if pMonth == 13:\n pMonth = 12\n logging.debug('- change bill date: ' + str(pMonth) + '/27/' + Settings.\n dataYear)\n time.sleep(1)\n myTools.getFocus()\n ... | [
2,
3,
4,
5,
6
] |
class User:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def greet_user(self):
if self.gender.lower() == 'male':
print('Greetings, Mr. ' + self.last_name.title() + '!')
elif self.gender.lower() == 'female':
print('Greetings, Miss ' + self.last_name.title... | flexible | {
"blob_id": "93b712c60ba4bfa81d967ec59035b6fb7793ce87",
"index": 1974,
"step-1": "class User:\n <mask token>\n <mask token>\n\n def greet_user(self):\n if self.gender.lower() == 'male':\n print('Greetings, Mr. ' + self.last_name.title() + '!')\n elif self.gender.lower() == 'fema... | [
2,
3,
4,
6,
7
] |
from queue import Queue
class Stack:
def __init__(self):
self.q1 = Queue()
self.q2 = Queue()
def empty(self):
return self.q1.empty()
def push(self, element):
if self.empty():
self.q1.enqueue(element)
else:
self.q2.enqueue(element)
... | normal | {
"blob_id": "4f5f4aadfeabb13790b417b334c5f73c6d0345a7",
"index": 9256,
"step-1": "<mask token>\n\n\nclass Stack:\n\n def __init__(self):\n self.q1 = Queue()\n self.q2 = Queue()\n\n def empty(self):\n return self.q1.empty()\n\n def push(self, element):\n if self.empty():\n ... | [
5,
7,
8,
9,
11
] |
"""Test an example."""
from . import main
def test_readme_escaping() -> None:
"""Ensure the demo matches expected."""
assert main() == "<div><span>Escaping</span></div>"
| normal | {
"blob_id": "7b459aad399a31f61b8686e1919b38d5538924b8",
"index": 2014,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_readme_escaping() ->None:\n \"\"\"Ensure the demo matches expected.\"\"\"\n assert main() == '<div><span>Escaping</span></div>'\n",
"step-3": "<mask token... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Board:
def __init__(self):
"""
Do not forget to ensure 6 and 8 are not next to each other:
no 6-6 no 6-8 no 8-8
"""
self.board_resources = np.array([res_dict['desert']] + [res_dict[
'brick']] * 3 + [res_dict['ore']] * 3 + [res... | flexible | {
"blob_id": "ee22d6226f734c67be91a3ccf1c8c0024bb7dc08",
"index": 5818,
"step-1": "<mask token>\n\n\nclass Board:\n\n def __init__(self):\n \"\"\"\n Do not forget to ensure 6 and 8 are not next to each other:\n no 6-6 no 6-8 no 8-8\n \"\"\"\n self.board_resources = np.array([... | [
7,
8,
10,
12,
13
] |
was = input()
print(was)
| normal | {
"blob_id": "e12c411814efd7cc7417174b51f0f756589ca40b",
"index": 3325,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(was)\n",
"step-3": "was = input()\nprint(was)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
class Generator(Model):
def __init__(self, name):
super(Generator, self).__init__(name=name)
self.dense = layers.Dense(7 * 7 * 128)
self.conv1 = layers.Conv2DTranspose(128, kernel_size=5, padding='same')
self.conv2 = layers.Conv2DTranspose(64, kernel_s... | flexible | {
"blob_id": "e265b2b2ccc0841ccb8b766de4ae2a869f2d280d",
"index": 8326,
"step-1": "<mask token>\n\n\nclass Generator(Model):\n\n def __init__(self, name):\n super(Generator, self).__init__(name=name)\n self.dense = layers.Dense(7 * 7 * 128)\n self.conv1 = layers.Conv2DTranspose(128, kernel... | [
8,
12,
13,
15,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def Cardid(name):
query = {'key': vars.Key, 'token': vars.Token, 'cards': 'visible'}
execute = requests.request('GET', vars.BoardGetUrl, params=query).json()
for row in execute['cards']:
if row['name'] == nam... | flexible | {
"blob_id": "68493acce71060799da8c6cb03f2ddffce64aa92",
"index": 8970,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Cardid(name):\n query = {'key': vars.Key, 'token': vars.Token, 'cards': 'visible'}\n execute = requests.request('GET', vars.BoardGetUrl, params=query).json()\n for row in... | [
0,
1,
2,
3
] |
import random
import datetime
import userval
import file
from getpass import getpass
#SORRY FOR THE REDUNDANT CODE, I RAN OUT OF OPTIONS
def register():
global first,last,email,pin,password,accountName #prepared_user_details
first=input("input firstname:")
last=input("input lastname:")
... | normal | {
"blob_id": "a8106c8f14e15706b12e6d157b889288b85bc277",
"index": 6789,
"step-1": "<mask token>\n\n\ndef genAcc():\n num = 1\n y = [3, 0]\n while num <= 8:\n x = random.randint(0, 9)\n y.append(x)\n num = num + 1\n accountNo = ''.join([str(i) for i in y])\n return accountNo... | [
7,
8,
9,
13,
15
] |
import sys
import os
import random
if sys.version_info[0] < 3:
from StringIO import StringIO
else:
from io import StringIO
def file_len(file):
initial = file.tell()
file.seek(0, os.SEEK_END)
size = file.tell()
file.seek(initial)
return size
def run():
rand_seed = None
stderr_file... | normal | {
"blob_id": "b7db0d2f4bbbc2c7763b9d2e6bede74979b65161",
"index": 4283,
"step-1": "<mask token>\n\n\ndef run():\n rand_seed = None\n stderr_filename = None\n stdout_filename = None\n if len(sys.argv) >= 4:\n rand_seed = int(sys.argv[3])\n if len(sys.argv) >= 3:\n stderr_filename = sys... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class SystemInfoJabberBot(JabberBot):
@botcmd
def serverinfo(self, mess, args):
"""Displays information about the server"""
version = open('/proc/version').read().strip()
loadavg = open('/proc/loadavg').read().strip()
return '%snn%s' % (version, lo... | flexible | {
"blob_id": "c9872fb536fd6552e2a5353566305555808747f7",
"index": 1777,
"step-1": "<mask token>\n\n\nclass SystemInfoJabberBot(JabberBot):\n\n @botcmd\n def serverinfo(self, mess, args):\n \"\"\"Displays information about the server\"\"\"\n version = open('/proc/version').read().strip()\n ... | [
4,
5,
6,
7,
9
] |
<|reserved_special_token_0|>
class TestTelegram(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestTelegram(unittest.TestCase):
def test_export_iter(self):
pass
<|reserved_special_token_0|>
<|res... | flexible | {
"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
] |
# Copyright (c) 2020 Open Collector, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | normal | {
"blob_id": "6e01e36170f3f08f2030dbd4dd91019936fb9f5c",
"index": 849,
"step-1": "<mask token>\n\n\n@routes.route('/signin', name='signin')\nclass SigninEndpoint(PoolHTTPEndpoint):\n <mask token>\n <mask token>\n\n @back_to.setter\n def back_to(self, value: typing.Optional[str]):\n self.request... | [
9,
13,
14,
19,
20
] |
"""
Task. Given two integers a and b, find their greatest common divisor.
Input Format. The two integers a, b are given in the same line separated by space.
Constraints. 1<=a,b<=2·109.
Output Format. Output GCD(a, b).
"""
def EuclidGCD(a, b):
if b == 0:
return a
else:
a = a%b
return Euc... | normal | {
"blob_id": "39d82267f966ca106ee384e540c31a3e5e433318",
"index": 2248,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef EuclidGCD(a, b):\n if b == 0:\n return a\n else:\n a = a % b\n return EuclidGCD(b, a)\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef EuclidGCD... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
plt.figure(figsize=(20, 8), dpi=128)
plt.barh(a, b, height=0.5, color='red')
plt.title('2018年电影票房纪录', fontsize=24)
plt.xlabel('票房(亿元)', fontsize=14)
<|reserved_special_token_0|>
plt.xticks(my_x_ticks)
plt.grid(axis='both', color='... | flexible | {
"blob_id": "16d86c48c45ab0441046e968ea364d27f6dcfd12",
"index": 3066,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.figure(figsize=(20, 8), dpi=128)\nplt.barh(a, b, height=0.5, color='red')\nplt.title('2018年电影票房纪录', fontsize=24)\nplt.xlabel('票房(亿元)', fontsize=14)\n<mask token>\nplt.xticks(my_x_tick... | [
0,
1,
2,
3,
4
] |
import wfdb as wf
import numpy as np
from scipy import signal as ss
from datasets import mitdb as dm
from matplotlib import pyplot as plt
def show_path(path):
""" As a plot """
# Read in the data
record = wf.rdsamp(path)
annotation = wf.rdann(path, 'atr')
data = record.p_signals
cha = data[:, 0... | normal | {
"blob_id": "4ba722e685c7608fcfd5111131c96847c0408a02",
"index": 1905,
"step-1": "import wfdb as wf\nimport numpy as np\nfrom scipy import signal as ss\nfrom datasets import mitdb as dm\nfrom matplotlib import pyplot as plt\n\ndef show_path(path):\n \"\"\" As a plot \"\"\"\n # Read in the data\n record ... | [
0
] |
import os
from cs50 import SQL
from flask import Flask, flash, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError
from werkzeug.security import check_password_hash, generate_pa... | normal | {
"blob_id": "c66f4ee5719f764c8c713c23815302c00b6fb9af",
"index": 310,
"step-1": "<mask token>\n\n\n@app.route('/buy', methods=['GET', 'POST'])\n@login_required\ndef buy():\n \"\"\"Buy shares of stock\"\"\"\n if request.method == 'POST':\n if not request.form.get('symbol'):\n return apolog... | [
3,
9,
13,
14,
15
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if len(sys.argv[1:]) == 5:
name_pos, start_pos, length_pos, first_note_pos, second_note_pos = [int
(pos) for pos in sys.argv[1:]]
elif len(sys.argv[1:]) == 4:
name_pos, start_pos, length_pos, first_note_pos = [int(... | flexible | {
"blob_id": "d7653a205fb8203fed4009846780c63dd1bcb505",
"index": 3603,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(sys.argv[1:]) == 5:\n name_pos, start_pos, length_pos, first_note_pos, second_note_pos = [int\n (pos) for pos in sys.argv[1:]]\nelif len(sys.argv[1:]) == 4:\n name_pos... | [
0,
1,
2,
3,
4
] |
import logging, numpy as np, time, pandas as pd
from abc import abstractmethod
from kombu import binding
from tqdm import tqdm
from functools import lru_cache
from threading import Thread
from math import ceil
from copy import copy
from .pos import Position
from .base import BaseConsumer
from .event import SignalEven... | normal | {
"blob_id": "76d166bc227986863db77aa784be3de8110437ff",
"index": 530,
"step-1": "<mask token>\n\n\nclass BaseStrategy(BaseConsumer):\n <mask token>\n <mask token>\n\n @abstractmethod\n def calculate_signals(self):\n \"\"\"Provide the mechanism to calculate a list of signals\"\"\"\n rais... | [
18,
19,
28,
30,
32
] |
# -*- coding: utf-8 -*-
import sys
import xlrd
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
param = sys.argv
print "Hello:" + param[0]
# ファイルのオープン
book = xlrd.open_workbook('sample.xls')
# シートの選択
sheet = book.sheet_by_name(u"Sheet1")
# sheet = book.sheet_by_index(0)
plot_x =... | normal | {
"blob_id": "dacd4334433eb323ce732c96f680fb7b9333721a",
"index": 2268,
"step-1": "# -*- coding: utf-8 -*-\n\nimport sys\nimport xlrd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nif __name__ == \"__main__\":\n\tparam = sys.argv\n\tprint \"Hello:\" + param[0]\n\n\t# ファイルのオープン\n\tbook = xlrd.open_workboo... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
cgitb.enable()
sys.stdout.write('Content-Type: application/octet-stream\n\n')
sys.stdout.write('yes' if is_admin() else 'no')
sys.stdout.flush()
<|reserved_special_token_1|>
import cgitb
import sys
from auth import is_admin
cgi... | flexible | {
"blob_id": "be9972d899a167a8ca2728960e55cda538793cc5",
"index": 1576,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncgitb.enable()\nsys.stdout.write('Content-Type: application/octet-stream\\n\\n')\nsys.stdout.write('yes' if is_admin() else 'no')\nsys.stdout.flush()\n",
"step-3": "import cgitb\nimport... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
if __name__ == '__main__':
with open('./input/day6', 'r') as f:
orbit_input = [l.strip().split(')') for l in f.readlines()]
planets = [planet[0] for planet in orbit_input]
planets1 = [planet[1] for planet in orbit_input]
planets = set(... | flexible | {
"blob_id": "96778a238d8ed8ae764d0cf8ec184618dc7cfe18",
"index": 5790,
"step-1": "<mask token>\n",
"step-2": "if __name__ == '__main__':\n with open('./input/day6', 'r') as f:\n orbit_input = [l.strip().split(')') for l in f.readlines()]\n planets = [planet[0] for planet in orbit_input]\n plane... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def test_create_tensor_dataset_from_arrays(tmp_dir_fixture):
pass
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_image_dataset_functional():
from dtoolai.data import ImageDataSet
ids_uri = 'http://bit.ly/2Uho6tN'
ids = ImageDataSet(ids_uri)
ass... | flexible | {
"blob_id": "97dfcce6e82ef33334b49de72bb126150dfef196",
"index": 2844,
"step-1": "<mask token>\n\n\ndef test_create_tensor_dataset_from_arrays(tmp_dir_fixture):\n pass\n",
"step-2": "<mask token>\n\n\ndef test_image_dataset_functional():\n from dtoolai.data import ImageDataSet\n ids_uri = 'http://bit.... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def wczytywanie_ustawien(plik_konfiguracyjny='defs.txt'):
"""
wczytywanie pliku z ustawieniami (pliku defs.txt) do slownika
arg:
str: plik_konfiguracyjny - nazwa pliku konfiguracyjnego z podanymi
wartosciami parametrow (tempo i... | flexible | {
"blob_id": "8220a6d33cda5861e74d6236757abbc81685a998",
"index": 6369,
"step-1": "<mask token>\n\n\ndef wczytywanie_ustawien(plik_konfiguracyjny='defs.txt'):\n \"\"\" \n wczytywanie pliku z ustawieniami (pliku defs.txt) do slownika\n \n arg:\n str: plik_konfiguracyjny - nazwa pliku konfiguracy... | [
1,
3,
4,
5,
6
] |
from admin_tools.dashboard.modules import DashboardModule
from nodes.models import Node
from slices.models import Slice
class MyThingsDashboardModule(DashboardModule):
"""
Controller dashboard module to provide an overview to
the user of the nodes and slices of its groups.
"""
title="My Things"
... | normal | {
"blob_id": "90324392e763ac6ea78c77b909c4bea667d45e6c",
"index": 5896,
"step-1": "<mask token>\n\n\nclass MyThingsDashboardModule(DashboardModule):\n <mask token>\n <mask token>\n <mask token>\n\n def init_with_context(self, context):\n user = context['request'].user\n slices = Slice.ob... | [
2,
4,
5,
6,
7
] |
from superwires import games, color
import random
SCORE = 0
## pizza_image= games.load_image("images/pizza.png")
## pizza = games.Sprite(image = pizza_image, x=SW/2, y=SH/2,
## dx =1, dy = 1)
## games.screen.add(pizza)
games.init(screen_width = 640, screen_height = 480, fps = ... | normal | {
"blob_id": "ee16b91ce1c12ce78d23ff655304aebc39cb1639",
"index": 9693,
"step-1": "<mask token>\n\n\nclass Pan(games.Sprite):\n <mask token>\n\n def update(self):\n \"\"\" Move to mouse coordinates \"\"\"\n self.x = games.mouse.x\n self.check_collide()\n <mask token>\n\n\nclass Pizza... | [
7,
9,
10,
13,
14
] |
<|reserved_special_token_0|>
class TestQuarkUpdateIpPolicies(test_quark_plugin.TestQuarkPlugin):
@contextlib.contextmanager
def _stubs(self, ip_policy, subnets=None, networks=None):
if not subnets:
subnets = []
if not networks:
networks = []
db_mod = 'quark.db.... | flexible | {
"blob_id": "cf931da4c06e16fe6f6da5eb1826d8b7a59c1f7b",
"index": 9057,
"step-1": "<mask token>\n\n\nclass TestQuarkUpdateIpPolicies(test_quark_plugin.TestQuarkPlugin):\n\n @contextlib.contextmanager\n def _stubs(self, ip_policy, subnets=None, networks=None):\n if not subnets:\n subnets = ... | [
37,
43,
48,
57,
67
] |
from itertools import cycle
STEP_VAL = 376
spinlock = []
for count in range(2018):
len(spinlock) % count
| normal | {
"blob_id": "c3755ff5d4262dbf6eaf3df58a336f5e61531435",
"index": 5149,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor count in range(2018):\n len(spinlock) % count\n",
"step-3": "<mask token>\nSTEP_VAL = 376\nspinlock = []\nfor count in range(2018):\n len(spinlock) % count\n",
"step-4": "fr... | [
0,
1,
2,
3
] |
from django.forms import ModelForm
from contactform.models import ContactRequest
class ContactRequestForm(ModelForm):
class Meta:
model = ContactRequest
| normal | {
"blob_id": "97637e2114254b41ef6e777e60b3ddab1d4622e8",
"index": 4606,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ContactRequestForm(ModelForm):\n\n\n class Meta:\n model = ContactRequest\n",
"step-3": "from django.forms import ModelForm\nfrom contactform.models import ContactRe... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def create_new_report(chrome_driver_inner, report_info_inner):
add_new_report = chrome_driver_inner.find_element_by_id(
'MainContent_MainActionCreate')
add_new_report.click()
next_button = chrome_driver_inner.find_element_by_id(
'MainContent_AAWiz__Next')
n... | flexible | {
"blob_id": "14cb702054b8caaa8899a2a3d8b65aae9b063cb6",
"index": 5600,
"step-1": "<mask token>\n\n\ndef create_new_report(chrome_driver_inner, report_info_inner):\n add_new_report = chrome_driver_inner.find_element_by_id(\n 'MainContent_MainActionCreate')\n add_new_report.click()\n next_button = ... | [
2,
3,
4,
5,
6
] |
from Distributions import UniformDistribution
from EventGenerator import Generator
from Processor import Processor
class Modeller:
def __init__(self, generator, operators, computers):
self._generator = generator
self._operators = operators
self._computers = computers
def event_mode... | normal | {
"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 cv2
import random
import os
import numpy as np
import matplotlib.pyplot as plt
import torch
from torch.utils.data import Dataset
from torchvision import transforms
class ShanghaiTechPartA(Dataset):
def __init__(self, root, shuffle=False, transform=None, downsample=1):
self.root = root
sel... | normal | {
"blob_id": "8a0a98ab072e46463d80d8638c830e6db0032a77",
"index": 8101,
"step-1": "<mask token>\n\n\nclass ShanghaiTechPartA(Dataset):\n\n def __init__(self, root, shuffle=False, transform=None, downsample=1):\n self.root = root\n self.shuffle = shuffle\n self.transform = transform\n ... | [
3,
4,
5,
6,
7
] |
#finding postgresql info
import re
import subprocess
def get_postgre_version():
p = subprocess.Popen("psql --version",stdout=subprocess.PIPE,shell=True)
k = re.findall(r'psql\s+\(PostgreSQL\)\s+(.*)',p.stdout.read())
postgre_version = k[0]
return postgre_version
version=get_postgre_version()
print ver... | normal | {
"blob_id": "e6b84a2190a84c871e7191ef49fb7ee8b8148c9a",
"index": 7062,
"step-1": "#finding postgresql info\nimport re\nimport subprocess\ndef get_postgre_version():\n p = subprocess.Popen(\"psql --version\",stdout=subprocess.PIPE,shell=True)\n k = re.findall(r'psql\\s+\\(PostgreSQL\\)\\s+(.*)',p.stdout.rea... | [
0
] |
class UF(object):
<|reserved_special_token_0|>
def find(self, i):
while i != self.parents[i]:
self.parents[i] = self.parents[self.parents[i]]
i = self.parents[i]
return i
def union(self, p, q):
i = self.find(p)
j = self.find(q)
if i == j:
... | flexible | {
"blob_id": "c8d5b8515a468190d14311118e12a7d414908be6",
"index": 8109,
"step-1": "class UF(object):\n <mask token>\n\n def find(self, i):\n while i != self.parents[i]:\n self.parents[i] = self.parents[self.parents[i]]\n i = self.parents[i]\n return i\n\n def union(sel... | [
4,
5,
6,
7,
8
] |
from abc import ABC, abstractmethod
from raspberry_home.view.geometry import *
from raspberry_home.view.renderable import Renderable
class View(Renderable, ABC):
@abstractmethod
def content_size(self, container_size: Size) ->Size:
pass
| normal | {
"blob_id": "913ff9b811d3abbe43bda0554e40a6a2c87053be",
"index": 4449,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass View(Renderable, ABC):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass View(Renderable, ABC):\n\n @abstractmethod\n def content_size(self, container_size: Size)... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class GAME:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def check_timer(self):
if self.count >= self.crowd:
self.game_timer += 1
if self.game_timer > 50:
... | flexible | {
"blob_id": "2b14607aa2527f5da57284917d06ea60e89f784c",
"index": 1659,
"step-1": "<mask token>\n\n\nclass GAME:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def check_timer(self):\n if self.count >= self.crowd:\n self.game_timer += 1\n if self.game_t... | [
5,
7,
9,
10,
13
] |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 20 14:48:56 2020
@author: dhk1349
"""
n = int(input()) #목표채널
m = int(input())
broken=[int(i) for i in input().split()] #망가진 버튼
normal=[i for i in range(10)] #사용가능한 버튼
ans=abs(n-100) #시작 시 정답
for i in broken:
normal.remove(i)
tempnum=0
iternum=1
def solve(ls... | normal | {
"blob_id": "2a6ae615b427a7c970aacf9804865ea7952d065f",
"index": 5888,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Dec 20 14:48:56 2020\n\n@author: dhk1349\n\"\"\"\n\nn = int(input()) #목표채널 \nm = int(input())\nbroken=[int(i) for i in input().split()] #망가진 버튼 \nnormal=[i for i in range(10)] #사용가능한 ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [url('newuser/', NewUserView.as_view(), name='newuser'), url(
'login/', LoginView.as_view(), name='login'), url('logout/',
logout_user, name='logout'), url('delete/$', delete_user, name=
'deleteuser')]
... | flexible | {
"blob_id": "9b4bc7f8f9c96f503a5ed79827430963e21718c4",
"index": 3733,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('newuser/', NewUserView.as_view(), name='newuser'), url(\n 'login/', LoginView.as_view(), name='login'), url('logout/',\n logout_user, name='logout'), url('delete... | [
0,
1,
2,
3
] |
print("Hi Tom") | normal | {
"blob_id": "e838a52fecbf69719acc6de38b5f045e792e1408",
"index": 9232,
"step-1": "<mask token>\n",
"step-2": "print('Hi Tom')\n",
"step-3": "print(\"Hi Tom\")",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2011 Lionel Bergeret
#
# ----------------------------------------------------------------
# The contents of this file are distributed under the CC0 license.
# See http://creativecommons.org/publicdomain/zero/1.0/
# ----------------------------------------... | normal | {
"blob_id": "b7aa99e9e4af3bef4b2b3e7d8ab9bf159a093af6",
"index": 574,
"step-1": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n#\n# Copyright (C) 2011 Lionel Bergeret\n#\n# ----------------------------------------------------------------\n# The contents of this file are distributed under the CC0 license.\n# S... | [
0
] |
<|reserved_special_token_0|>
class ArticleTools(Articles):
<|reserved_special_token_0|>
@staticmethod
def add_article(**kwargs):
ca = Articles(**kwargs)
ca.insert()
@staticmethod
def update_article(**kwargs):
ca = Articles(**kwargs)
ca.update_data()
@staticme... | flexible | {
"blob_id": "79c4a2d4503c2639950675b398e000aae367ff4a",
"index": 8117,
"step-1": "<mask token>\n\n\nclass ArticleTools(Articles):\n <mask token>\n\n @staticmethod\n def add_article(**kwargs):\n ca = Articles(**kwargs)\n ca.insert()\n\n @staticmethod\n def update_article(**kwargs):\n ... | [
12,
15,
19,
20,
21
] |
class Solution:
def uniquePaths(self, A, B):
# A - rows
# B - columns
if A == 0 or B == 0:
return 0
grid = [[1 for _ in range(B)] for _ in range(A)]
for i in range(1, A):
for j in range(1, B):
grid[i][j] = grid[i-1][j] + grid[i][j-1]
return grid[A-1][B-1]
s = Solution... | normal | {
"blob_id": "027e53d69cfece0672556e34fa901412e483bc3e",
"index": 8805,
"step-1": "class Solution:\n\n def uniquePaths(self, A, B):\n # A - rows\n # B - columns\n if A == 0 or B == 0:\n return 0\n\n grid = [[1 for _ in range(B)] for _ in range(A)]\n\n for i in range(1, A):\n for j in ran... | [
0
] |
# coding: utf-8
import os
import factory
import datetime
from journalmanager import models
from django.contrib.auth.models import Group
from django.core.files.base import File
_HERE = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(_HERE, 'xml_samples', '0034-8910-rsp-48-2-0216.xml')) as xml_fil... | normal | {
"blob_id": "44d87f112ab60a202e4c8d64d7aec6f4f0d10578",
"index": 31,
"step-1": "<mask token>\n\n\nclass IssueTitleFactory(factory.Factory):\n \"\"\"\n ``issue`` must be provided\n \"\"\"\n FACTORY_FOR = models.IssueTitle\n language = factory.SubFactory(LanguageFactory)\n title = u'Bla'\n\n\ncla... | [
22,
39,
42,
45,
47
] |
n = int(input())
A = list(map(int, input().split()))
g = 1000
for s1, s2 in zip(A[:-1], A[1:]):
if s1 < s2:
stockNum = g // s1
g += stockNum * (s2 - s1)
print(g)
| normal | {
"blob_id": "da903409d75ba2a07443317e30bce568444fbca5",
"index": 9956,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor s1, s2 in zip(A[:-1], A[1:]):\n if s1 < s2:\n stockNum = g // s1\n g += stockNum * (s2 - s1)\nprint(g)\n",
"step-3": "n = int(input())\nA = list(map(int, input().sp... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
load_dotenv('.env')
<|reserved_special_token_0|>
print(response.text)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
load_dotenv('.env')
USERNAME = os.getenv('USER')
TOKEN = os.getenv('TO... | flexible | {
"blob_id": "ba34dfcad0cb9bac9c462bdf60e55dee6ba9d58d",
"index": 9255,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nload_dotenv('.env')\n<mask token>\nprint(response.text)\n<mask token>\n",
"step-3": "<mask token>\nload_dotenv('.env')\nUSERNAME = os.getenv('USER')\nTOKEN = os.getenv('TOKEN')\npixela_... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def nav17vw(Y, t, voltage_clamp_func, voltage_clamp_params):
""" Human Nav 1.7 from Vasylyev Waxman """
v = voltage_clamp_func(t, voltage_clamp_params)
m = Y[0]
h = Y[1]
alpha_m = 10.22 - 10.22 / (1 + np.exp((v + 7.19) / 15.43))
beta_m = 23.76 / (1 + np.exp((v + 70... | flexible | {
"blob_id": "012ab947f7a2c9d44f54464b3e477582ffcf3d77",
"index": 5589,
"step-1": "<mask token>\n\n\ndef nav17vw(Y, t, voltage_clamp_func, voltage_clamp_params):\n \"\"\" Human Nav 1.7 from Vasylyev Waxman \"\"\"\n v = voltage_clamp_func(t, voltage_clamp_params)\n m = Y[0]\n h = Y[1]\n alpha_m = 10... | [
12,
13,
14,
15,
18
] |
__author__ = 'simsun'
| normal | {
"blob_id": "2b746d89d34435eb5f3a5b04da61c5cc88178852",
"index": 8784,
"step-1": "<mask token>\n",
"step-2": "__author__ = 'simsun'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
__author__ = 'gaa8664'
import pymssql
class Connection:
def __init__(self):
self.connection = pymssql.connect(server = 'gditsn033\SQLPROD', database='ProdigiousDB', user='sa', password='sgrh@2016')
def __enter__(self):
self.cursor = self.connection.cursor()
return self.cursor
de... | normal | {
"blob_id": "12dc248a95a84603065e23ce8fd33163bfcd2d3e",
"index": 9295,
"step-1": "<mask token>\n\n\nclass Connection:\n\n def __init__(self):\n self.connection = pymssql.connect(server='gditsn033\\\\SQLPROD',\n database='ProdigiousDB', user='sa', password='sgrh@2016')\n\n def __enter__(se... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class PatrimonyCertificate(BaseFolder, GenericLicence, Inquiry,
BrowserDefaultMixin):
<|reserved_special_token_0|>
security = ClassSecurityInfo()
implements(interfaces.IPatrimonyCertificate)
meta_type = 'PatrimonyCertificate'
_at_rename_after_creation = True
sc... | flexible | {
"blob_id": "6c0b2fa8166bb21a514dc188858e1de285ad9b0a",
"index": 166,
"step-1": "<mask token>\n\n\nclass PatrimonyCertificate(BaseFolder, GenericLicence, Inquiry,\n BrowserDefaultMixin):\n <mask token>\n security = ClassSecurityInfo()\n implements(interfaces.IPatrimonyCertificate)\n meta_type = 'P... | [
6,
8,
9,
10,
12
] |
# message 为定义的变量
message = 'Hello Python World '
print(message) | normal | {
"blob_id": "ee5e970f32b1d601f9dc3ab37a5028ce7ff8a32e",
"index": 1368,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(message)\n",
"step-3": "message = 'Hello Python World '\nprint(message)\n",
"step-4": "# message 为定义的变量\r\nmessage = 'Hello Python World '\r\nprint(message)",
"step-5": null... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class User:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def get_dscan(self, motor, start, end, nsteps, nEvents, record=True):
daq.configure(nEvents, record=record)
currPos = motor.wm()
return scan([daq], m... | flexible | {
"blob_id": "4473971552aa48236b19dec7e7c1ea1e622d5795",
"index": 7347,
"step-1": "<mask token>\n\n\nclass User:\n <mask token>\n <mask token>\n <mask token>\n\n def get_dscan(self, motor, start, end, nsteps, nEvents, record=True):\n daq.configure(nEvents, record=record)\n currPos = moto... | [
12,
21,
22,
24,
26
] |
from discord.ext import commands, tasks
from discord.utils import get
import discord
import re
import json
import time
import random
import asyncio
import os
import datetime
from live_ticker_scrape import wrangle_data
from tokens import dev, dev1, es, nas, dow, us10y, dollar, vix, btc, eth, silver , link
es_bot = d... | normal | {
"blob_id": "e57109f1c5c2e1468ef1cf9f10fba743633ca150",
"index": 8094,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@es_bot.event\nasync def on_ready():\n print('es started')\n\n\n@nas_bot.event\nasync def on_ready():\n print('nas started')\n\n\n@dow_bot.event\nasync def on_ready():\n prin... | [
0,
1,
2,
3,
4
] |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, hidden_size, encoder_layer=2, step=4, is_bidir=False, **kw):
super(Model, self).__init__()
fc_embedding = []
# First, we should convert the 1 dim data to ... | normal | {
"blob_id": "188f82b0fb04d6814d77617fa9148113d0e6ef01",
"index": 2170,
"step-1": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n\n def forward(self, input_seq, target_seq=None):\n input_seq = self.fc_embedding(input_seq.unsqueeze(-1))\n _, encoding_result = self.encoder(input_seq)... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class CouchTests2(unittest.TestCase):
<|reserved_special_token_0|>
def test_bar(self):
self.assertEqual(1, 1)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class CouchTests2(unittest.TestCase):
def test_foo(self):
self.assertEqual(1, 1)
... | flexible | {
"blob_id": "cd4f22b8e2188e8019e7324e80d64a7b95f8f956",
"index": 1961,
"step-1": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n <mask token>\n\n def test_bar(self):\n self.assertEqual(1, 1)\n",
"step-2": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n\n def test_foo(self)... | [
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if car_state == True:
print('Car is stopped!')
if u_input == 'start':
car_state = True
print('Car has started!')
elif u_input == 'stop':
car_state == False
print('Car has stopped!')
else:
print("I don''t un... | flexible | {
"blob_id": "2766339632200c26a8c6cd3abff28b1495870b9a",
"index": 9207,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif car_state == True:\n print('Car is stopped!')\nif u_input == 'start':\n car_state = True\n print('Car has started!')\nelif u_input == 'stop':\n car_state == False\n prin... | [
0,
1,
2,
3
] |
"""
Note: names of methods in this module, if seem weird, are the same as in Hunspell's ``suggest.cxx``
to keep track of them.
"""
from typing import Iterator, Union, List, Set
from spylls.hunspell.data import aff
MAX_CHAR_DISTANCE = 4
def replchars(word: str, reptable: List[aff.RepPattern]) -> Iterator[Union[str... | normal | {
"blob_id": "cfba55505f3290a14b98d594bc871a74812c7c57",
"index": 5594,
"step-1": "<mask token>\n\n\ndef replchars(word: str, reptable: List[aff.RepPattern]) ->Iterator[Union[\n str, List[str]]]:\n \"\"\"\n Uses :attr:`aff.REP <spylls.hunspell.data.aff.Aff.REP>` table (typical misspellings) to replace\n ... | [
6,
9,
12,
13,
14
] |
<|reserved_special_token_0|>
def concat_all_data(path: str='Data/*.csv', save_path: str='Data/final.csv'):
csvs = glob.glob(path)
li = []
for csv in csvs:
df = pd.read_csv(csv)
li.append(df)
final_df = pd.concat(li)
final_df.to_csv(save_path)
def clean_csv(path: str, save_pth: st... | flexible | {
"blob_id": "0a5e30483c1fde10410c442a1ccd1f79bfb329c8",
"index": 8457,
"step-1": "<mask token>\n\n\ndef concat_all_data(path: str='Data/*.csv', save_path: str='Data/final.csv'):\n csvs = glob.glob(path)\n li = []\n for csv in csvs:\n df = pd.read_csv(csv)\n li.append(df)\n final_df = pd... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class Server:
def __init__(self):
self.private_key = random.randint(0, 2 ** 100)
self.salt = random.randint(0, 2 ** 100)
self.salt_bytes = self.salt.to_bytes(byteorder='big', length=
get_num_byte_len(self.salt))
self.u = random.randint(0, 2... | flexible | {
"blob_id": "cf7aeacedec211e76f2bfcb7f6e3cb06dbfdc36e",
"index": 3907,
"step-1": "<mask token>\n\n\nclass Server:\n\n def __init__(self):\n self.private_key = random.randint(0, 2 ** 100)\n self.salt = random.randint(0, 2 ** 100)\n self.salt_bytes = self.salt.to_bytes(byteorder='big', leng... | [
17,
19,
20,
24,
26
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
router.register('species', views.SpeciesViewSet)
router.register('com_names', views.Com_NamesViewSet)
router.register('photos', views.PhotosViewSet)
<|reserved_special_token_0|>
if settings.DEBUG:
urlpatterns += static(setting... | flexible | {
"blob_id": "786bc5d44115b46bd246e85e85c8f8c1f20737b9",
"index": 7921,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrouter.register('species', views.SpeciesViewSet)\nrouter.register('com_names', views.Com_NamesViewSet)\nrouter.register('photos', views.PhotosViewSet)\n<mask token>\nif settings.DEBUG:\n ... | [
0,
1,
2,
3,
4
] |
from typing import List
from re import match
from utility import ButtonGroup
import rumps
class RepeatWorkBreak(rumps.App):
def __init__(self):
rumps.debug_mode(True)
self.config = {
"app_title": "Repeat Work and Break",
"start": "Start",
"pause": "Pause Timer"... | normal | {
"blob_id": "2ca91c410b8c8d6306d5ed918783a4d77a091ba8",
"index": 360,
"step-1": "<mask token>\n\n\nclass RepeatWorkBreak(rumps.App):\n <mask token>\n\n def set_up_menu(self):\n self.timer.stop()\n self.timer.count = 0\n self.app.title = self.config['app_title']\n\n def convert_secon... | [
7,
10,
11,
12,
14
] |
from OpenSSL import SSL, crypto
from twisted.internet import ssl, reactor
from twisted.internet.protocol import Factory, Protocol
import os
from time import time
class Echo(Protocol):
def dataReceived(self, data):
print "Data received: " + data
# define cases
options = {
"gen... | normal | {
"blob_id": "9951588f581c5045154a77535b36d230d586d8a5",
"index": 338,
"step-1": "from OpenSSL import SSL, crypto\nfrom twisted.internet import ssl, reactor\nfrom twisted.internet.protocol import Factory, Protocol\n\nimport os\nfrom time import time\n\nclass Echo(Protocol):\n\n def dataReceived(self, data):\n ... | [
0
] |
<|reserved_special_token_0|>
def send_sms(sms_text):
account_sid = os.getenv('TWILIO_ACCOUNT_SID')
auth_token = os.getenv('TWILIO_AUTH_TOKEN')
client = Client(account_sid, auth_token)
message = client.messages.create(body='Joing the dark side', from_=os.
getenv('NUMBER_FROM'), media_url=['http... | flexible | {
"blob_id": "6b2a9e8c6e95f52e9ebf999b81f9170fc669cce4",
"index": 6329,
"step-1": "<mask token>\n\n\ndef send_sms(sms_text):\n account_sid = os.getenv('TWILIO_ACCOUNT_SID')\n auth_token = os.getenv('TWILIO_AUTH_TOKEN')\n client = Client(account_sid, auth_token)\n message = client.messages.create(body=... | [
1,
3,
4,
5
] |
import numpy as np
import scipy.signal as sp
from common import *
class Processor:
def __init__(self, sr, **kwargs):
self.samprate = float(sr)
self.hopSize = kwargs.get("hopSize", roundUpToPowerOf2(self.samprate * 0.005))
self.olaFac = int(kwargs.get("olaFac", 2))
def analyze(self, x)... | normal | {
"blob_id": "e0075e4afafba9da70bbcb2ee073b5c1f7782d7d",
"index": 6032,
"step-1": "<mask token>\n\n\nclass Processor:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Processor:\n <mask token>\n <mask token>\n\n def synth(self, *args):\n nFrame, nBin =... | [
1,
2,
4,
5,
6
] |
<|reserved_special_token_0|>
class InvalidDictError(Exception):
<|reserved_special_token_0|>
pass
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class InvalidDictError(Exception):
"""Raised when the object can not be created from the provided dict."""
pass
<|reserved_special_token_1|... | flexible | {
"blob_id": "94130b4962ecff2ea087ab34cf50a084254bf980",
"index": 8948,
"step-1": "<mask token>\n\n\nclass InvalidDictError(Exception):\n <mask token>\n pass\n",
"step-2": "<mask token>\n\n\nclass InvalidDictError(Exception):\n \"\"\"Raised when the object can not be created from the provided dict.\"\"... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--old-output', required=True, help=
'"Old" output directory to read old checksum file from.')
parser.add_argument('-b', '--brick', required=True, help=
'Brick name to run')
... | flexible | {
"blob_id": "a98d03b169b59704b3b592cee0b59f5389fd77b3",
"index": 8899,
"step-1": "<mask token>\n\n\ndef main():\n import argparse\n parser = argparse.ArgumentParser()\n parser.add_argument('--old-output', required=True, help=\n '\"Old\" output directory to read old checksum file from.')\n pars... | [
1,
2,
3,
4,
5
] |
import os
f_s_list = [2, 1.5, 1, 0.5, 0.2]
g_end_list = [500, 1000, 2000, 5000, 10000, 20000, 60000]
h_i_list = [(10000 * i, 10000 * (i + 1)) for i in range(6)]
i_seed_list = [1, 12, 123, 1234, 12345, 123456]
for s in f_s_list:
os.system("python SKs_model.py " + str(s) + " 0 10000 0 relu")
for train_end in g_... | normal | {
"blob_id": "56a681015ea27e2c8e00ab8bcc8019d5987c4ee1",
"index": 6949,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor s in f_s_list:\n os.system('python SKs_model.py ' + str(s) + ' 0 10000 0 relu')\nfor train_end in g_end_list:\n os.system('python SKs_model.py 0.2 0 ' + str(train_end) + ' 0 rel... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print("Python's Data Type")
print('"Python is very easy" he said.')
print("""No pain
No gain""")
print("""No pain
No gain""")
print("""No pain
No gain""")
<|reserved_special_token_0|>
print('Ha\tHa\tHa')
print('역슬래시 \\')
print('쌍따옴표 "')
... | flexible | {
"blob_id": "eb81f1825c4ac8e20dde1daefbdad22f588e696e",
"index": 9431,
"step-1": "<mask token>\n",
"step-2": "print(\"Python's Data Type\")\nprint('\"Python is very easy\" he said.')\nprint(\"\"\"No pain\n No gain\"\"\")\nprint(\"\"\"No pain\n No gain\"\"\")\nprint(\"\"\"No pain \n No gain\"\... | [
0,
1,
2
] |
import preprocessing
import tokenization
import vectorspacemodel
import pickle
import collections
import os
import math
import operator
from itertools import islice
def take(n, iterable):
# "Return first n items of the iterable as a list"
return list(islice(iterable, n))
directory = os.getcwd()
... | normal | {
"blob_id": "1630a3d0becac195feee95a1c3b23568612a48d2",
"index": 3194,
"step-1": "<mask token>\n\n\ndef take(n, iterable):\n return list(islice(iterable, n))\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef take(n, iterable):\n return list(islice(iterable, n))\n\n\n<mask token>\nwith open('D_INDEXE... | [
1,
2,
3,
4,
5
] |
import datetime
import time
import boto3
from botocore.config import Config
# FinSpace class with Spark bindings
class SparkFinSpace(FinSpace):
import pyspark
def __init__(
self,
spark: pyspark.sql.session.SparkSession = None,
config = Config(retries = {'max_attempts': 0, 'mode': 'sta... | normal | {
"blob_id": "4f4af4caf81397542e9cd94c50b54303e2f81881",
"index": 3926,
"step-1": "<mask token>\n\n\nclass SparkFinSpace(FinSpace):\n import pyspark\n <mask token>\n\n def upload_dataframe(self, data_frame: pyspark.sql.dataframe.DataFrame):\n resp = self.client.get_user_ingestion_info()\n u... | [
3,
5,
6,
7,
8
] |
from django.db import models
import string
import random
def id_generator(size=32, chars=string.ascii_uppercase + string.digits):
exists = True
while exists == True:
ran = ''.join(random.choice(chars) for _ in range(size))
if len(Item.objects.filter(random_str=ran)) == 0:
exists = False
return ran
# Crea... | normal | {
"blob_id": "efba815fe64cddb5315b17b2cbaf1d3fc38c11ee",
"index": 4995,
"step-1": "<mask token>\n\n\nclass Item(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 <mask token>\n <mask token>\n <m... | [
2,
3,
4,
6,
7
] |
import inputoutput
def xor_encryption(source, destination, key):
"""
Returns text encrypted or decrypted with xor
Keyword arguments:
source - path to file with text to be encrypted
destination - path to the file where you want to save the result
key - encryption key
"""
text = inputou... | normal | {
"blob_id": "81774d3b4d9fbf22ed19e1cba7ec5e8e3707f51a",
"index": 2076,
"step-1": "<mask token>\n\n\ndef xor_encryption(source, destination, key):\n \"\"\"\n Returns text encrypted or decrypted with xor\n\n Keyword arguments:\n source - path to file with text to be encrypted\n destination - path to... | [
1,
2,
3,
4,
5
] |
# from datetime import datetime
from datetime import datetime, time, timedelta
# today = datetime.now()
# previous_day = today - timedelta(days=1)
# previous_day = previous_day.strftime("%Y%m%d")
# print(today)
# print(previous_day)
print(datetime.strptime("2013-1-25", '%Y-%m-%d').strftime('%Y-%m-%d 00:00:00'))
# def... | normal | {
"blob_id": "4dac8e7e695c473cb73ceaf3887373bcc0a08aff",
"index": 5940,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%Y-%m-%d 00:00:00'))\n",
"step-3": "from datetime import datetime, time, timedelta\nprint(datetime.strptime('2013-1-25', '%Y-%... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class IssueManager(models.Manager):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class IssueManager(models.Manager):
def open(self):
return self.filter(status__is_closed=False)
<|reserved_... | flexible | {
"blob_id": "4c54cfefbaf90c1dd0648485e62bff1f2787ccfe",
"index": 2784,
"step-1": "<mask token>\n\n\nclass IssueManager(models.Manager):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass IssueManager(models.Manager):\n\n def open(self):\n return self.filter(status__is_closed=F... | [
1,
2,
3,
4
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib import request,parse
# req = request.Request('https://api.douban.com/v2/book/2129650')
# req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36')
# with request.urlopen(req) as f:... | normal | {
"blob_id": "9bd63181de024c2f4517defa9ed51bdbc8d610d2",
"index": 6025,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Login to weibo.com')\n<mask token>\nreq.add_header('Host', 'chenshuaijun.com')\nreq.add_header('User-Agent',\n 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like G... | [
0,
1,
2,
3,
4
] |
class Solution(object):
def findPaths(self, m, n, N, i, j):
"""
:type m: int
:type n: int
:type N: int
:type i: int
:type j: int
:rtype: int
"""
MOD = 10 ** 9 + 7
dz = zip((1,0,-1,0),(0,1,0,-1))
dp = [[0]* n for x in range(m)]
... | normal | {
"blob_id": "ebbc79d6582f7d6139e0dcec6333b679bb86c63c",
"index": 1383,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def findPaths(self, m, n, N, i, j):\n \"\"\"\n :type m: int\n :type n: int\n :type ... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import rospy
import numpy as np
from sensor_msgs.msg import Image
import cv2, cv_bridge
from geometry_msgs.msg import Twist, Pose2D
from std_msgs.msg import String
import pytesseract as ocr
from PIL import Image as imagePil
import os
import time
from roseli.srv import CreateMap, CreateMapRequest
... | normal | {
"blob_id": "83ce5ee4d2a18caeb364b74c3739015fc0e1474c",
"index": 1344,
"step-1": "#!/usr/bin/env python\n\nimport rospy\nimport numpy as np\nfrom sensor_msgs.msg import Image\nimport cv2, cv_bridge\nfrom geometry_msgs.msg import Twist, Pose2D\nfrom std_msgs.msg import String\nimport pytesseract as ocr\nfrom PIL ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
users = {(1): 'Tom', (2): 'Bob', (3): 'Bill'}
elements = {'Au': 'Oltin', 'Fe': 'Temir', 'H': 'Vodorod', 'O': 'Kislorod'}
<|reserved_special_token_1|>
users = {1: "Tom", 2: "Bob", 3: "Bill"}
elements = {"Au": "Oltin", "Fe": "Temir", "H": "Vodorod", "O": "K... | flexible | {
"blob_id": "a24ab93983546f8ae0fab042c121ac52388e62e8",
"index": 2967,
"step-1": "<mask token>\n",
"step-2": "users = {(1): 'Tom', (2): 'Bob', (3): 'Bill'}\nelements = {'Au': 'Oltin', 'Fe': 'Temir', 'H': 'Vodorod', 'O': 'Kislorod'}\n",
"step-3": "users = {1: \"Tom\", 2: \"Bob\", 3: \"Bill\"}\n\nelements = {\... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class TestSummary(base.BaseTestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestSummary(base.BaseTestCase):
def setUp(self):
super(TestSummary, self).setUp()
<|reserved_specia... | flexible | {
"blob_id": "0ea67ac97ec8e7f287a2430c67f8f7d841d8b646",
"index": 813,
"step-1": "<mask token>\n\n\nclass TestSummary(base.BaseTestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TestSummary(base.BaseTestCase):\n\n def setUp(self):\n super(TestSummary, self).setUp()\n... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class ScheduledEventSubscriber(TypedDict):
guild_scheduled_event_id: Snowflake
user: User
member: Member | None
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class ScheduledEvent(TypedDict):
id: Snowflake
guild_id: Snowflake
channel_id: Snowflake
... | flexible | {
"blob_id": "a73dcfc21c31d4e984db39c072d11cb9a9c3d5e5",
"index": 2470,
"step-1": "<mask token>\n\n\nclass ScheduledEventSubscriber(TypedDict):\n guild_scheduled_event_id: Snowflake\n user: User\n member: Member | None\n",
"step-2": "<mask token>\n\n\nclass ScheduledEvent(TypedDict):\n id: Snowflake... | [
1,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
'''
File Name: bubustatus/utils.py
Author: JackeyGao
mail: junqi.gao@shuyun.com
Created Time: 一 9/14 12:51:37 2015
'''
from rest_framework.views import exception_handler
def custom_exception_handler(exc, context):
# Call REST framework's default exception handler first,
# to get the st... | normal | {
"blob_id": "4e6e4917aee2385fe118d6e58c359a4c9fc50943",
"index": 8617,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef custom_exception_handler(exc, context):\n response = exception_handler(exc, context)\n if response is not None:\n response.data['status_code'] = response.status_code\... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def check_type(item, target):
assert item == target
def exec_lines(source: str, body, loc: Dict[str, Any], glob: Dict[str, Any],
ret: Any):
def get_value(v):
if isinstance(v, ast.BinOp):
a = get_value(v.left)
b = get_value(v.right)
... | flexible | {
"blob_id": "430b5ca7212983743cadc36a2ada987bb721174a",
"index": 3537,
"step-1": "<mask token>\n\n\ndef check_type(item, target):\n assert item == target\n\n\ndef exec_lines(source: str, body, loc: Dict[str, Any], glob: Dict[str, Any],\n ret: Any):\n\n def get_value(v):\n if isinstance(v, ast.Bin... | [
3,
4,
5,
6
] |
#!/usr/bin/env python
# coding: utf-8
from sklearn.metrics import confusion_matrix
import numpy as np
import pandas as pd
df = pd.read_csv('orb.csv')
d = pd.pivot_table(df,index='col1',columns='col2',values='result')
d.fillna(0,inplace=True)
| normal | {
"blob_id": "ce65a672cae26bdb8ec8cb04eabfe1877f9cd7d4",
"index": 9558,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nd.fillna(0, inplace=True)\n",
"step-3": "<mask token>\ndf = pd.read_csv('orb.csv')\nd = pd.pivot_table(df, index='col1', columns='col2', values='result')\nd.fillna(0, inplace=True)\n",
... | [
0,
1,
2,
3,
4
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.