code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
a,b,c,d=map(int,input().split())
ans=0
if a>=0:
if c>=0:
ans=b*d
elif d>=0:
ans=b*d
else:
ans=a*d
elif b>=0:
if c>=0:
ans=b*d
elif d>=0:
ans=max(b*d,a*c)
else:
ans=a*c
else:
if c>=0:
ans=b*c
elif d>=0:
ans=a*c
else:
... | normal | {
"blob_id": "be37a7596850050af58f735e60bdf13594715caf",
"index": 4928,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif a >= 0:\n if c >= 0:\n ans = b * d\n elif d >= 0:\n ans = b * d\n else:\n ans = a * d\nelif b >= 0:\n if c >= 0:\n ans = b * d\n elif d >= 0:... | [
0,
1,
2,
3
] |
# -*- coding: UTF-8 -*-
import lava
from lava.api.constants.vk import QueueType
from lava.api.device import Device
from lava.api.util import Destroyable
__all__ = ["Session"]
sessions = set()
class Session(Destroyable):
def __init__(self, physical_device, queue_index=None):
super(Session, self).__init... | normal | {
"blob_id": "193dcf7bd658f88afe0a1f2fa28605f262e45bc2",
"index": 1554,
"step-1": "<mask token>\n\n\nclass Session(Destroyable):\n\n def __init__(self, physical_device, queue_index=None):\n super(Session, self).__init__()\n self.instance = lava.instance()\n if physical_device not in lava.d... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_email():
assert email('barney@purpledino.com') == True
assert email('barney.10.WHATDINO@purple.com') == True
assert type(email('barney')) == str
assert type(email('barney@dino')) == str
<|reserved_spec... | flexible | {
"blob_id": "40637c7a5e45d0fe4184478a1be2e08e5040c93b",
"index": 8931,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_email():\n assert email('barney@purpledino.com') == True\n assert email('barney.10.WHATDINO@purple.com') == True\n assert type(email('barney')) == str\n assert ty... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class CreateProjectForm(forms.ModelForm):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Meta:
model = Project
fields = ['project_name', 'project_desc', 'auth_users', 'assets_s... | flexible | {
"blob_id": "599c5c02397f283eb00f7343e65c5cb977442e38",
"index": 3848,
"step-1": "<mask token>\n\n\nclass CreateProjectForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Project\n fields = ['project_name', 'project_desc', 'a... | [
3,
4,
5,
6,
7
] |
#!/usr/bin/python3
max_integer = __import__('9-max_integer').max_integer
my_list = [1, 90, 2, 13, 34, 5, -13, 3]
my_list1 = []
my_list2 = [1, 90, 2, 13, 34, 100, -13, 3]
max_value = max_integer(my_list)
max_value1 = max_integer(my_list1)
max_value2 = max_integer(my_list2)
max_value3 = max_integer()
print("Max: {}".for... | normal | {
"blob_id": "f5b74ca95cb368d70139b5d36e3c8d553b8c5393",
"index": 1393,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Max: {}'.format(max_value))\nprint('Max: {}'.format(max_value1))\nprint('Max: {}'.format(max_value2))\nprint('Max: {}'.format(max_value3))\n",
"step-3": "max_integer = __import__... | [
0,
1,
2,
3
] |
import os
import sqlite3 as db
os.system('clear')
persons = []
class Person:
def __init__(self, name, surname, job, salary):
self.name = name
self.surname = surname
self.job = job
self.salary = salary
def create(name):
conn = db.connect(name + '.db')
c = conn.cursor()
c.execute("""CREATE TABLE first(
... | normal | {
"blob_id": "7ff19ee35422395f78dca1e17a736df20a40ea98",
"index": 7569,
"step-1": "<mask token>\n\n\nclass Person:\n\n def __init__(self, name, surname, job, salary):\n self.name = name\n self.surname = surname\n self.job = job\n self.salary = salary\n\n\ndef create(name):\n conn... | [
4,
6,
7,
8,
9
] |
from typing import Dict, Any
from urllib import request
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from .models import Product
from cart.forms import CartAddProductForm
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login, logout... | normal | {
"blob_id": "1d72a9882aea1e0f808969828ed2e69ecd79ac71",
"index": 7522,
"step-1": "<mask token>\n\n\nclass UserFormView(View):\n form_class = UserForm\n template_name = 'shop/signup.html'\n\n def get(self, request):\n form = self.form_class(None)\n return render(request, self.template_name,... | [
4,
6,
8,
9,
10
] |
import numpy as np
import math
a = [
[0.54, -0.04, 0.10],
[-0.04, 0.50, 0.12],
[0.10, 0.12, 0.71]
]
b = [0.33, -0.05, 0.28]
# Метод Гаусса
def gauss(left, right, prec=3):
# Создаем расширенную матрицу
arr = np.concatenate((np.array(left), np.array([right]).T), axis=1)
print('\nИсходная матриц... | normal | {
"blob_id": "bd0530b6f3f7b1a5d72a5b11803d5bb82f85105d",
"index": 6587,
"step-1": "<mask token>\n\n\ndef gauss(left, right, prec=3):\n arr = np.concatenate((np.array(left), np.array([right]).T), axis=1)\n print('\\nИсходная матрица:')\n print(arr)\n if np.linalg.matrix_rank(left) != np.linalg.matrix_r... | [
4,
6,
7,
9,
10
] |
# 6. Evaluate Classifier: you can use any metric you choose for this assignment
# (accuracy is the easiest one). Feel free to evaluate it on the same data you
# built the model on (this is not a good idea in general but for this assignment,
# it is fine). We haven't covered models and evaluation yet, so don't worry ... | normal | {
"blob_id": "62de629d8f28435ea8dc3dc093cac95e7cedf128",
"index": 7859,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef evaluate(model, X_te, y_te):\n \"\"\"\n Given the model and independent and dependent testing data,\n print out statements that evaluate classifier\n \"\"\"\n probs... | [
0,
1,
2,
3,
4
] |
class ModelInfo:
def __init__(self, name: str, path: str, filter: str):
self.name: str = name
self.path: str = path
self.filter: str = filter
| normal | {
"blob_id": "def089c2749444797ac3079809c082dacab08554",
"index": 1167,
"step-1": "<mask token>\n",
"step-2": "class ModelInfo:\n <mask token>\n",
"step-3": "class ModelInfo:\n\n def __init__(self, name: str, path: str, filter: str):\n self.name: str = name\n self.path: str = path\n ... | [
0,
1,
2
] |
import numpy as np
import tensorflow as tf
from tfrecords_handler.moving_window.tfrecord_mean_reader import TFRecordReader
from configs.global_configs import training_data_configs
class StackingModelTester:
def __init__(self, **kwargs):
self.__use_bias = kwargs["use_bias"]
self.__use_peepholes = ... | normal | {
"blob_id": "3b7839347f24d39904d29d40e688a5dfd63534d7",
"index": 3560,
"step-1": "<mask token>\n\n\nclass StackingModelTester:\n\n def __init__(self, **kwargs):\n self.__use_bias = kwargs['use_bias']\n self.__use_peepholes = kwargs['use_peepholes']\n self.__input_size = kwargs['input_size... | [
3,
4,
5,
6,
7
] |
from odoo import models,fields, api
class director(models.Model):
#Clasica
_inherit = 'base.entidad'
_name = 'cinemateca.director'
name = fields.Char(string="name", required=True, help="Nombre del director")
apellidos = fields.Char(string="apellidos", required=True, help="Apellidos del director")
... | normal | {
"blob_id": "006f499eed7cd5d73bb0cb9b242c90726fff35c1",
"index": 3185,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass director(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass director(models.Model)... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def loadModel(name):
model = load_model('./Model/%s.h5' % name)
return model
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def loadModel(name):
model = load_model('./Model/%s.h5' % name)
return model
def predict(tag):
t... | flexible | {
"blob_id": "a6154c5d855dc53d73db08bbb5b5d7437056e156",
"index": 1566,
"step-1": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n return model\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef loadModel(name):\n model = load_model('./Model/%s.h5' % name)\n ... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
c = Client()
<|reserved_special_token_1|>
from end import Client
c = Client()
| flexible | {
"blob_id": "1be510e6715d21e814c48fe05496704e9a65d554",
"index": 308,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nc = Client()\n",
"step-3": "from end import Client\nc = Client()\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
import base
import telebot
import markups
from starter import start_bot, bot
@bot.message_handler(commands=['start'])
def start(message):
chat = message.chat
# welcome(msg)
msg = bot.send_message(chat.id, "Select a language in the list", reply_markup=markups.language())
bot.register_next_step_handler(... | normal | {
"blob_id": "7cc77de31adff5b4a394f117fc743cd6dd4bc06c",
"index": 6065,
"step-1": "<mask token>\n\n\ndef llanguage(msg):\n chat = msg.chat\n base.create_user(msg.chat.id, msg.text)\n markup = telebot.types.ReplyKeyboardMarkup(True, True)\n markup.row('ok')\n str = bot.send_message(msg.chat.id, base... | [
19,
20,
30,
36,
37
] |
<|reserved_special_token_0|>
class Dscanner(Linter):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "fda73b5dac038f077da460d6ebfb432b756909d9",
"index": 3125,
"step-1": "<mask token>\n\n\nclass Dscanner(Linter):\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",
"step-2": "<mask token>\n\n\nclass Dsca... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def buzz(pitch, duration):
peroid = 1.0 / pitch
delay = peroid / 2.0
cycles = int(duration * pitch)
for i in range(cycles):
gpio.output(buzzer_pin, True)
sleep(delay)
gpio.output(buzzer_pin, False)
sleep(delay)
<|reserved_special_token_0|>... | flexible | {
"blob_id": "149ac778a552fac4499d7146db8600c91c68c60e",
"index": 4479,
"step-1": "<mask token>\n\n\ndef buzz(pitch, duration):\n peroid = 1.0 / pitch\n delay = peroid / 2.0\n cycles = int(duration * pitch)\n for i in range(cycles):\n gpio.output(buzzer_pin, True)\n sleep(delay)\n ... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class CopyResAction:
<|reserved_special_token_0|>
default_option = None
res_root = None
packing_root = None
ignore_list = []
def setResRoot(self, root):
self.res_root = root
pass
def setPackingRoot(self, root):
self.packing_root = root... | flexible | {
"blob_id": "364150d6f37329c43bead0d18da90f0f6ce9cd1b",
"index": 4886,
"step-1": "<mask token>\n\n\nclass CopyResAction:\n <mask token>\n default_option = None\n res_root = None\n packing_root = None\n ignore_list = []\n\n def setResRoot(self, root):\n self.res_root = root\n pass\... | [
6,
8,
13,
14,
15
] |
<|reserved_special_token_0|>
def getMFCC(rate, sig):
mfcc_feat = mfcc(sig, rate)
return numpy.concatenate(getQuartileMeans(mfcc_feat))
def getLogFBank(rate, sig):
logfbank_feat = logfbank(sig, rate)
return numpy.concatenate(getQuartileMeans(logfbank_feat))
def getData(filename, outdir=None):
i... | flexible | {
"blob_id": "cca1a491e2a48b4b0c7099a6c54e528158ef30bb",
"index": 5189,
"step-1": "<mask token>\n\n\ndef getMFCC(rate, sig):\n mfcc_feat = mfcc(sig, rate)\n return numpy.concatenate(getQuartileMeans(mfcc_feat))\n\n\ndef getLogFBank(rate, sig):\n logfbank_feat = logfbank(sig, rate)\n return numpy.conca... | [
3,
7,
8,
9,
10
] |
import sys
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
stringe = test.strip()
list1 = stringe.split(" | ")
list2 = list1[0].split(" ")
kha = 0
for item in list2:
for c in list1[1]:
if c in item:
... | normal | {
"blob_id": "def2721cd89501b1004d5d3f4f58df300616c1be",
"index": 2747,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(sys.argv[1], 'r') as test_cases:\n for test in test_cases:\n stringe = test.strip()\n list1 = stringe.split(' | ')\n list2 = list1[0].split(' ')\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Blockchain:
def __init__(self):
self.chain = []
self.farmer_details = []
self.create_block(proof=1, previous_hash='0')
self.nodes = set()
def create_block(self, proof, previous_hash):
block = {'index': len(self.chain) + 1, 'timestamp... | flexible | {
"blob_id": "f8c222b1a84a092a3388cb801a88495bc227b1d5",
"index": 9748,
"step-1": "<mask token>\n\n\nclass Blockchain:\n\n def __init__(self):\n self.chain = []\n self.farmer_details = []\n self.create_block(proof=1, previous_hash='0')\n self.nodes = set()\n\n def create_block(se... | [
13,
15,
16,
18,
21
] |
<|reserved_special_token_0|>
class HTTPError(CCEError):
""" HTTPError raised when HTTP request returned a error."""
def __init__(self, reason=None):
"""
Initialize HTTPError with `response` object and `status`.
"""
self.reason = reason
super(HTTPError, self).__init__(r... | flexible | {
"blob_id": "e2840eb1b0d731d6b0356835ba371d05ba351ff6",
"index": 5323,
"step-1": "<mask token>\n\n\nclass HTTPError(CCEError):\n \"\"\" HTTPError raised when HTTP request returned a error.\"\"\"\n\n def __init__(self, reason=None):\n \"\"\"\n Initialize HTTPError with `response` object and `s... | [
8,
9,
10,
12,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def all_match_data(year):
"""
Searches through the parse_matches data for all games in a specific season prints them out with a game ID and
returns the data in a list to the main program
:param year: Specific for... | flexible | {
"blob_id": "bc53af24bb46d2be3122e290c4732b312f4ebdf5",
"index": 5313,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef all_match_data(year):\n \"\"\"\n Searches through the parse_matches data for all games in a specific season prints them out with a game ID and\n returns the data in a lis... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Defaults(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Defaults(object):
INBUS_VERS... | flexible | {
"blob_id": "bc087482e901ce1831cef56aa9c7aef0c8f2d15a",
"index": 1793,
"step-1": "<mask token>\n",
"step-2": "class Defaults(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "class Defaults(object):\n INBUS_VERSION = 2\n LOCALHOST = '127.0... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def calculo_suma():
print('---Funcion con Python---')
print('la sumatoria de los valores: ', dato['Bronce'].sum())
print('---Funcion con Numpy---')
print('la sumatoria de los valores: ', numpy.sum(dato['Bronce']))
print('---Otras Formas---')
print(dato.Bronce.sum()... | flexible | {
"blob_id": "f5542cfe6827c352cc6e6da1147e727f2b2d8247",
"index": 9586,
"step-1": "<mask token>\n\n\ndef calculo_suma():\n print('---Funcion con Python---')\n print('la sumatoria de los valores: ', dato['Bronce'].sum())\n print('---Funcion con Numpy---')\n print('la sumatoria de los valores: ', numpy.... | [
9,
10,
11,
12,
13
] |
import os
import zipfile
import cv2
import numpy as np
from sklearn import svm
from sklearn import cross_validation
from sklearn.externals import joblib
import matplotlib.pyplot as plt
""" Global constants """
data_zip = "data.zip" # The zip archive
clean_files = [".csv", ".jpg"] # File extensions ... | normal | {
"blob_id": "d2da95f44e814accd3a91c5e8497ceff85c98711",
"index": 2848,
"step-1": "import os\nimport zipfile\nimport cv2\nimport numpy as np\nfrom sklearn import svm\nfrom sklearn import cross_validation\nfrom sklearn.externals import joblib\nimport matplotlib.pyplot as plt\n\n\n\"\"\" Global constants \"\"\"\nda... | [
0
] |
<|reserved_special_token_0|>
def test_create_all():
eng = create_engine('cql://user:password@localhost:49154/system')
metadata.create_all(eng)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_create_engine():
eng = create_engine('cql://user:password@localhost:49154/system')
asse... | flexible | {
"blob_id": "f5b18673dd5a3ba3070c07e88ae83a531669311a",
"index": 2139,
"step-1": "<mask token>\n\n\ndef test_create_all():\n eng = create_engine('cql://user:password@localhost:49154/system')\n metadata.create_all(eng)\n",
"step-2": "<mask token>\n\n\ndef test_create_engine():\n eng = create_engine('cq... | [
1,
3,
4,
5,
6
] |
import sys
import bisect
t = int(raw_input())
for i in xrange(1, t+1):
n, k = map(int, raw_input().strip().split())
s = [n]
for j in xrange(k):
num = s.pop()
if num % 2 != 0:
ls = num/2
lr = num/2
if ls != 0:
bisect.insort_left(s,ls)
bisect.insort_left(s,lr)
else:
... | normal | {
"blob_id": "488c111c051796b481794678cb04108fcf11ac39",
"index": 5778,
"step-1": "import sys\nimport bisect\n\nt = int(raw_input())\n\nfor i in xrange(1, t+1):\n n, k = map(int, raw_input().strip().split())\n s = [n]\n for j in xrange(k):\n num = s.pop()\n if num % 2 != 0:\n ls = num/2\n lr = ... | [
0
] |
import ga.ga as ga
import os
import datetime
def ga_optimise(synth, param_count, target, output_dir, iterations = 10, pop_size = 500):
fs = ga.ga_optimise(compute_population_fitnesses = ga.compute_population_fitnesses,
target = target,
synth = synth,
param_count = param_count,
iterations = iterat... | normal | {
"blob_id": "4bc9896847e4ab92a01dfcf674362140cc31ef4f",
"index": 5587,
"step-1": "import ga.ga as ga\nimport os\nimport datetime\n\n\ndef ga_optimise(synth, param_count, target, output_dir, iterations = 10, pop_size = 500):\n\tfs = ga.ga_optimise(compute_population_fitnesses = ga.compute_population_fitnesses, \n... | [
0
] |
# import sys
# class PriorityQueue:
# """Array-based priority queue implementation."""
#
# def __init__(self):
# """Initially empty priority queue."""
# self.queue = []
# self.min_index = None
# self.heap_size = 0
#
# def __len__(self):
# # Number of elements in the q... | normal | {
"blob_id": "f0630d248cfa575ee859e5c441deeb01b68c8150",
"index": 3741,
"step-1": "class PriorityQueue:\n <mask token>\n\n def __init__(self):\n \"\"\"Initially empty priority queue.\"\"\"\n self.heap = [None]\n\n def __len__(self):\n return len(self.heap) - 1\n\n def append(self,... | [
6,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
def main():
"""Remove a category from a coco json file
"""
parser = ArgumentParser(description=
'Category Filter: Filter a List of Categories from a JSON')
parser.add_argument('json_file_path', help='JSON file path')
parser.add_argument('out_file', help='Output... | flexible | {
"blob_id": "467327b98ab99bdad429943c701c751be4f67940",
"index": 9378,
"step-1": "<mask token>\n\n\ndef main():\n \"\"\"Remove a category from a coco json file\n \"\"\"\n parser = ArgumentParser(description=\n 'Category Filter: Filter a List of Categories from a JSON')\n parser.add_argument('j... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def move_directory(input_directory_path, output_directory_path):
print('moving %s to %s' % (input_directory_path, output_directory_path))
if not dry_run:
shutil.move(input_directory_path, output_directory_path)
... | flexible | {
"blob_id": "7de19a85a6a05bd2972b11571d5f05219c6beb1a",
"index": 916,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef move_directory(input_directory_path, output_directory_path):\n print('moving %s to %s' % (input_directory_path, output_directory_path))\n if not dry_run:\n shutil.move... | [
0,
1,
2,
3,
5
] |
""" Classes and functions for generalized q-sampling """
import numpy as np
from dipy.reconst.odf import OdfModel, OdfFit, gfa
from dipy.reconst.cache import Cache
import warnings
from dipy.reconst.multi_voxel import multi_voxel_fit
from dipy.reconst.recspeed import local_maxima, remove_similar_vertices
class General... | normal | {
"blob_id": "2f193cb1eaf7b5e99d20025716a248144af90b92",
"index": 1925,
"step-1": "<mask token>\n\n\nclass GeneralizedQSamplingModel(OdfModel, Cache):\n\n def __init__(self, gtab, method='gqi2', sampling_length=1.2,\n normalize_peaks=False):\n \"\"\" Generalized Q-Sampling Imaging [1]_\n\n ... | [
14,
16,
17,
19,
20
] |
<|reserved_special_token_0|>
def resizeXY(X, Y, occurrency, dx, dz):
"""This function takes in input X,Y,occurrency, two dimensions dx, dz and scales the values
contained in X and Y, in such a way that only empty spaces are scaled and filled spaces are mantained fixed"""
sumY = sum(Y)
sumX = sum(X)
v... | flexible | {
"blob_id": "9bc955def6250908050a1f3046dd78480f25e0a1",
"index": 1898,
"step-1": "<mask token>\n\n\ndef resizeXY(X, Y, occurrency, dx, dz):\n \"\"\"This function takes in input X,Y,occurrency, two dimensions dx, dz and scales the values\n\tcontained in X and Y, in such a way that only empty spaces are scaled ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def app(page):
if not login_status():
title_container = st.empty()
remail_input_container = st.empty()
rpw_input_container = st.empty()
rregister_button_container = st.empty()
email = ... | flexible | {
"blob_id": "41cfd558824b6561114a48a694b1e6e6a7cb8c05",
"index": 7,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef app(page):\n if not login_status():\n title_container = st.empty()\n remail_input_container = st.empty()\n rpw_input_container = st.empty()\n rregister... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class TestLempelZivWelchDecoder(unittest.TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class TestLempelZivWelchDecoder(unittest.TestCase):
def test_decode(self):
test_value = ['t', 256... | flexible | {
"blob_id": "8126af930ec75e2818455d959f00285bdc08c044",
"index": 1899,
"step-1": "<mask token>\n\n\nclass TestLempelZivWelchDecoder(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestLempelZivWelchDecoder(unittest.TestCase):\n\n def test_decode(self):\n ... | [
1,
2,
3,
4,
5
] |
class Vertex:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def get_connections(self):
return self.connections.keys()
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Graph:
def __init__(self):
self.vertices = {}
... | flexible | {
"blob_id": "3af78dcc0bb0b6f253af01d2945ad6ada02ca7a0",
"index": 7270,
"step-1": "class Vertex:\n <mask token>\n <mask token>\n\n def get_connections(self):\n return self.connections.keys()\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Graph:\n\n def __init__(self):\n ... | [
10,
12,
13,
15,
17
] |
import sys
from pypregel import Pypregel
from pypregel.vertex import Vertex, Edge
from pypregel.reader import Reader
from pypregel.writer import Writer
from pypregel.combiner import Combiner
class PageRankVertex(Vertex):
def compute(self):
if self.superstep() >= 1:
s = 0
while sel... | normal | {
"blob_id": "6db7189d26c63ca9f9667045b780ec11994bac28",
"index": 788,
"step-1": "<mask token>\n\n\nclass PageRankReader(Reader):\n\n def read_num_of_vertices(self):\n line = self.config_fp.readline()\n return int(line)\n\n def read_vertex(self):\n line = self.graph_fp.readline()\n ... | [
7,
9,
10,
12,
13
] |
import math
print(dir(math))
# Prints a list of entities residing in the math module | normal | {
"blob_id": "94056e8920d265831da67bd1d999330a47a7ef0d",
"index": 1991,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(dir(math))\n",
"step-3": "import math\nprint(dir(math))\n",
"step-4": "import math\nprint(dir(math))\n\n# Prints a list of entities residing in the math module",
"step-5": nul... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class TestCreateSummaryReport(unittest.TestCase):
def setUp(self):
redi.configure_logging(DEFAULT_DATA_DIRECTORY)
self.test_report_params = {'project': 'hcvtarget-uf',
'report_file_path': proj_root + 'config/report.xml',
'redcap_uri': 'https://... | flexible | {
"blob_id": "f9dd21aac7915b9bbf91eeffb5fd58ffdb43c6c3",
"index": 5857,
"step-1": "<mask token>\n\n\nclass TestCreateSummaryReport(unittest.TestCase):\n\n def setUp(self):\n redi.configure_logging(DEFAULT_DATA_DIRECTORY)\n self.test_report_params = {'project': 'hcvtarget-uf',\n 'report... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class decl_cmd1(Command):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class decl_cmd2(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
... | flexible | {
"blob_id": "70b8efa844395592131382d1d1e2c39150804f99",
"index": 4111,
"step-1": "<mask token>\n\n\nclass decl_cmd1(Command):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass decl_cmd2(Command):\n user_options = []\n\n def initialize_options(self):\n pass\n\n def... | [
6,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Hi buddy! Today we will play a game ' + name + '!')
print('Are you ready?')
<|reserved_special_token_0|>
print(name + ' we are starting!')
<|reserved_special_token_0|>
print(liste1 + liste2 + liste3 + liste4)
<|reserved_s... | flexible | {
"blob_id": "4ef6002480fcaa514f41227978bae76f6e02c22d",
"index": 6401,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Hi buddy! Today we will play a game ' + name + '!')\nprint('Are you ready?')\n<mask token>\nprint(name + ' we are starting!')\n<mask token>\nprint(liste1 + liste2 + liste3 + liste4... | [
0,
1,
2,
3
] |
import pandas as pd
from sklearn.tree import DecisionTreeClassifier # Import Decision Tree Classifier
from sklearn.model_selection import train_test_split # Import train_test_split function
from sklearn import metrics #Import scikit-learn metrics module for accuracy calculation
from sklearn.tree import DecisionTreeRegr... | normal | {
"blob_id": "1e34087719f6fd0456d2722edbd0a7af68d37e4c",
"index": 1577,
"step-1": "<mask token>\n\n\ndef read_atomic_data(path):\n if not path or not os.path.exists(path) or not os.path.isfile(path):\n print('To begin with, your path to data should be proper!')\n sys.exit(1)\n df = pd.read_csv... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def crear_addr_word(word):
priv = sha256(word)
pub = privtopub(priv)
addr = pubtoaddr(pub)
wif = encode_privkey(priv, 'wif')
return addr, priv, wif
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def crear_addr_word(word):
... | flexible | {
"blob_id": "cc7a44754dc1371733420fd3a1e51ab6b5e7c4d8",
"index": 6898,
"step-1": "<mask token>\n\n\ndef crear_addr_word(word):\n priv = sha256(word)\n pub = privtopub(priv)\n addr = pubtoaddr(pub)\n wif = encode_privkey(priv, 'wif')\n return addr, priv, wif\n\n\n<mask token>\n",
"step-2": "<mask... | [
1,
2,
3,
4,
5
] |
# _*_ coding: utf-8 _*_
# 按层打印二叉树
class TreeNode(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class PrintTree(object):
def printTree(self, root):
if not root:
return
'''
定义next_last为下一层的最后一个,cur_last为当前层最后一个
... | normal | {
"blob_id": "4ddff57790ad191fc29fc092bcc714f0b6273100",
"index": 7755,
"step-1": "<mask token>\n\n\nclass PrintTree(object):\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass PrintTree(object):\n\n def printTree(self, root):\n if not root:\n return\n \"\"\"\n 定义next_la... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def indent_wrap(s, indent=0, wrap=80):
"""
Wraps and indents a string ``s``.
Parameters
----------
s : str
The string to wrap.
indent : int
How far to indent each new line.
wrape : int
Number of character after which to wrap the string.... | flexible | {
"blob_id": "3b4799f43ec497978bea3ac7ecf8c6aaeb2180b4",
"index": 3867,
"step-1": "<mask token>\n\n\ndef indent_wrap(s, indent=0, wrap=80):\n \"\"\"\n Wraps and indents a string ``s``.\n\n Parameters\n ----------\n s : str\n The string to wrap.\n indent : int\n How far to indent ea... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if len(sys.argv) == 1:
photoscanname = 'C:\\Program Files\\Agisoft\\PhotoScan Pro\\photoscan.exe'
scriptname = (
'C:\\Users\\slocumr\\github\\SimUAS\\batchphotoscan\\agiproc.py')
xmlnames = (
'C:\\Users... | flexible | {
"blob_id": "00f95733505b3e853a76bbdd65439bcb230fa262",
"index": 3345,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif len(sys.argv) == 1:\n photoscanname = 'C:\\\\Program Files\\\\Agisoft\\\\PhotoScan Pro\\\\photoscan.exe'\n scriptname = (\n 'C:\\\\Users\\\\slocumr\\\\github\\\\SimUAS\\\\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
import matplotlib.pyplot as plt
import numpy as np
try:
from viscm import viscm
viscm(romaO_map)
except ImportError:
print('viscm not found, falling back on simple... | flexible | {
"blob_id": "5082182af5a08970568dc1ab7a53ee5337260687",
"index": 45,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n import matplotlib.pyplot as plt\n import numpy as np\n try:\n from viscm import viscm\n viscm(romaO_map)\n except ImportError:\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def insert_timestamp_from_filename_into_image(path_to_image: str,
ignorable_string: str, output_filename: str='', distance_to_border: int
=5, color_of_timestamp: tuple=(0, 0, 0), size_of_timestamp: int=20):
image = Image.open(path_to_image)
pos_of_timestamp = (distance_to_... | flexible | {
"blob_id": "e6ab18d87ace00436a480f4f01da224eead84fc0",
"index": 5145,
"step-1": "<mask token>\n\n\ndef insert_timestamp_from_filename_into_image(path_to_image: str,\n ignorable_string: str, output_filename: str='', distance_to_border: int\n =5, color_of_timestamp: tuple=(0, 0, 0), size_of_timestamp: int=2... | [
2,
3,
4,
5,
6
] |
total = totmil = cont = menor = 0
barato = ' '
print('-' * 40)
print('LOJA SUPER BARATÃO')
print('-' * 40)
while True:
produto = str(input('Nome do Produto: '))
preco = float(input('Preço: '))
cont += 1
total += preco
if preco > 1000:
totmil += 1
if cont == 1 or preco < menor:
ba... | normal | {
"blob_id": "35b24ffa14f8b3c2040d5becc8a35721e86d8b3d",
"index": 345,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('-' * 40)\nprint('LOJA SUPER BARATÃO')\nprint('-' * 40)\nwhile True:\n produto = str(input('Nome do Produto: '))\n preco = float(input('Preço: '))\n cont += 1\n total += ... | [
0,
1,
2
] |
<|reserved_special_token_0|>
def functionGraph(function, dVal1, dVal2, dVal3, dVal4, ftcVal1, ftcVal2):
print('printing user input from functionGraph - ' + function)
print(dVal1, dVal2, dVal3, dVal4)
x1 = -5
x2 = 5
print('1st input:')
y = function
def f(x):
return eval(y)
"""p... | flexible | {
"blob_id": "9dc8449bcc0c6c6ffb5ced5724ca632b6578bf1b",
"index": 9170,
"step-1": "<mask token>\n\n\ndef functionGraph(function, dVal1, dVal2, dVal3, dVal4, ftcVal1, ftcVal2):\n print('printing user input from functionGraph - ' + function)\n print(dVal1, dVal2, dVal3, dVal4)\n x1 = -5\n x2 = 5\n pr... | [
10,
13,
15,
16,
18
] |
'''
3、 编写一个函数,输入n为偶数时,调用函数求1/2+1/4+...+1/n,当输入n为奇数时,调用函数1/1+1/3+...+1/n
'''
def f(n):
if n%2==0:
sum=0
for x in range(2,n+1,2):
sum+=1/x
print(sum)
if n%2!=0:
sum=0
for x in range(1,n+1,2):
sum+=1/x
print(sum)
| normal | {
"blob_id": "69cf28d32e6543271a0855d61a76808b03c06891",
"index": 4805,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef f(n):\n if n % 2 == 0:\n sum = 0\n for x in range(2, n + 1, 2):\n sum += 1 / x\n print(sum)\n if n % 2 != 0:\n sum = 0\n for x ... | [
0,
1,
2
] |
# Question link: https://www.hackerrank.com/challenges/30-scope/problem
# Code section:
def computeDifference(self):
# Add your code here
self.maximumDifference = -111111
for i in range(0,len(self.__elements)-1):
for j in range(i+1, len(self.__elements)):
diff = abs(self._... | normal | {
"blob_id": "eb90912d09fca52a43b28ec4c988e3658ddfc219",
"index": 605,
"step-1": "# Question link: https://www.hackerrank.com/challenges/30-scope/problem\n# Code section:\n\n def computeDifference(self):\n # Add your code here\n self.maximumDifference = -111111\n for i in range(0,len(self.__elem... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def minvalue(weight, Day):
maximum = 0
res = 0
for x in range(0, len(weight)):
if weight[x] > maximum:
maximum = weight[x]
res += weight[x]
Capitivity = max(res // Day, maximum)
while True:
sum = 0
... | flexible | {
"blob_id": "a0ffb793650b0e911dd9bcbec0b7ba76f7829c12",
"index": 1539,
"step-1": "<mask token>\n",
"step-2": "def minvalue(weight, Day):\n maximum = 0\n res = 0\n for x in range(0, len(weight)):\n if weight[x] > maximum:\n maximum = weight[x]\n res += weight[x]\n Capitivity... | [
0,
1,
2,
3,
4
] |
import cv2
import pandas
from sklearn import tree
import pydotplus
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
import matplotlib.image as pltimg
df = pandas.read_csv("show.csv")
d = {'UK': 0, 'USA': 1, 'N': 2}
df['Nationality'] = df['Nationality'].map(d)
d = {'YES': 1, 'NO': 0}
df['... | normal | {
"blob_id": "c9cf65eeec49eba004312491cdd2321200fa6a61",
"index": 469,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ngraph.write_png('mydecisiontree.png')\n<mask token>\nplt.show()\nprint(X)\nprint(y)\n",
"step-3": "<mask token>\ndf = pandas.read_csv('show.csv')\nd = {'UK': 0, 'USA': 1, 'N': 2}\ndf['Na... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for a in A[::-1]:
idx = bisect.bisect_right(dp, a)
dp[idx] = a
<|reserved_special_token_0|>
for n in dp:
if n != float('inf'):
ans += 1
print(ans)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
in... | flexible | {
"blob_id": "dfe79d2f4bf4abc1d04035cf4556237a53c01122",
"index": 6913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor a in A[::-1]:\n idx = bisect.bisect_right(dp, a)\n dp[idx] = a\n<mask token>\nfor n in dp:\n if n != float('inf'):\n ans += 1\nprint(ans)\n",
"step-3": "<mask token>... | [
0,
1,
2,
3
] |
'''
Problem 24
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 ... | normal | {
"blob_id": "f2ac9904aaa4c12ef2954b88c37ffd0c97aadf5a",
"index": 9398,
"step-1": "'''\nProblem 24\n\n\nA permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lex... | [
0
] |
import os
import time
import re
import json
from os.path import join, getsize
from aiohttp import web
from utils import helper
TBL_HEAD = '''
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
<th scope="col">Directory</th>
<th scope="col">Size</th>
</tr>
</thead>
<tbody>... | normal | {
"blob_id": "7c9b51ae7cde9c3a00888dac6df710b93af6dd7f",
"index": 4836,
"step-1": "<mask token>\n\n\ndef stats_count_info(request):\n root_path = request.app['PATH-DB']\n cpt = 0\n d = dict()\n dirs_data = dict()\n for root, dirs, files in os.walk(root_path, topdown=False):\n cpt += len(file... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def introduction():
like_to_play = int(input(
'Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) '
))
if like_to_play == 1:
easy_or_hard = input('Easy (1) or hard (2)? ')
... | flexible | {
"blob_id": "31246a2e022f3c5b0ce68bb06422307439cbd9b6",
"index": 4272,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef introduction():\n like_to_play = int(input(\n 'Welcome to Rock Paper Scissors, would you like to play? (1 = yes, 2 = no) '\n ))\n if like_to_play == 1:\n ... | [
0,
1,
2,
3,
4
] |
from .dispatch import dispatch_expts
| normal | {
"blob_id": "394ebfe25bbf8eaf427509f28a82a98b9b481b63",
"index": 4957,
"step-1": "<mask token>\n",
"step-2": "from .dispatch import dispatch_expts\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
def test_nested_query_with_datetime():
inner_q = assist.build_query(select='time, value', from_='system_load',
where='L2=\'cpuload\' and "name" != \'Idle\'', groupby=('host', 'L3'))
outer_q = assist.build_query(select='time, value', from_=inner_q, where
=
f... | flexible | {
"blob_id": "8aa9ba145b6c7347a7a926d50dca35383ddd52a3",
"index": 9217,
"step-1": "<mask token>\n\n\ndef test_nested_query_with_datetime():\n inner_q = assist.build_query(select='time, value', from_='system_load',\n where='L2=\\'cpuload\\' and \"name\" != \\'Idle\\'', groupby=('host', 'L3'))\n outer_... | [
6,
8,
9,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .ros_publisher import *
| flexible | {
"blob_id": "6e7cca4f766ca89d2e2f82a73f22742b0e8f92a8",
"index": 5870,
"step-1": "<mask token>\n",
"step-2": "from .ros_publisher import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
# Print name and marks
f = open("marks.txt", "rt")
for line in f:
line = line.strip()
if len(line) == 0: # Blank line
continue
name, *marks = line.split(",")
if len(marks) == 0:
continue
marks = filter(str.isdigit, marks) # Take only numbers
total = sum(map(int, marks)) ... | normal | {
"blob_id": "00587de133ee68415f31649f147fbff7e9bf65d5",
"index": 3337,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in f:\n line = line.strip()\n if len(line) == 0:\n continue\n name, *marks = line.split(',')\n if len(marks) == 0:\n continue\n marks = filter(str.is... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from tests import unittest
from kepler.descriptors import *
class DescriptorsTestCase(unittest.TestCase):
def testEnumDefaultsToNoopMapper(self):
class Record(object):
cat = Enum(name='cat', enums=['Lucy Cat', 'Hot Pocket'])
... | normal | {
"blob_id": "3eb40dfe68573b93c544a2279ac5c8728ae9601f",
"index": 7485,
"step-1": "<mask token>\n\n\nclass DescriptorsTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DescriptorsTestCase(unittest.TestCase):\n\n def testEnumDefaultsToNoopMapper(self):\n\n... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class FFTPricing:
def __init__(self, option: Option, riskFreeRate, volatility,
samplePoints, bandwidth, dampingFactor, underlyingModel='GBM'):
self.__option = option
self.__r = riskFreeRate
self.__sigma = volatility
self.__N = samplePoints
... | flexible | {
"blob_id": "25987c15c28e3939f9f531dbc1d4bd9bf622b5a9",
"index": 5691,
"step-1": "<mask token>\n\n\nclass FFTPricing:\n\n def __init__(self, option: Option, riskFreeRate, volatility,\n samplePoints, bandwidth, dampingFactor, underlyingModel='GBM'):\n self.__option = option\n self.__r = ri... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
class MemberTests(CustomAPITestCase):
def setUp(self):
"""
Make a user for authenticating and
testing community actions
"""
owner = self.user_model.objects.create(password=make_password(
'user1'), email='user1@test.com', first_name=... | flexible | {
"blob_id": "75c00eec7eacd37ff0b37d26163c2304620bb9db",
"index": 5868,
"step-1": "<mask token>\n\n\nclass MemberTests(CustomAPITestCase):\n\n def setUp(self):\n \"\"\"\n Make a user for authenticating and\n testing community actions\n \"\"\"\n owner = self.user_model.objects... | [
23,
29,
33,
36,
38
] |
<|reserved_special_token_0|>
class Zui:
def __init__(self):
self.pb = Pushbullet(self.api_key())
self.target = self.make_devices()
self.dayone = config.URL_SCHEME
self.clear, self.pause = self.check_platform()
def api_key(self):
if config.API_KEY:
return c... | flexible | {
"blob_id": "66cc9ca3d8cbe9690da841e43cef217f3518122c",
"index": 7939,
"step-1": "<mask token>\n\n\nclass Zui:\n\n def __init__(self):\n self.pb = Pushbullet(self.api_key())\n self.target = self.make_devices()\n self.dayone = config.URL_SCHEME\n self.clear, self.pause = self.check_... | [
8,
10,
11,
12,
13
] |
<|reserved_special_token_0|>
class Audio:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_sp... | flexible | {
"blob_id": "d35d26cc50da9a3267edd2da706a4b6e653d22ac",
"index": 6555,
"step-1": "<mask token>\n\n\nclass Audio:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Audio:\n\n def __init__(self):... | [
1,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
class popen:
<|reserved_special_token_0|>
def __init__(self, command):
self._command = command
self._process = None
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class popen:
<|... | flexible | {
"blob_id": "bbb3d27ce8f4c1943ecc7ab542346c9f41cbd30e",
"index": 1256,
"step-1": "<mask token>\n\n\nclass popen:\n <mask token>\n\n def __init__(self, command):\n self._command = command\n self._process = None\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass popen:... | [
2,
4,
5,
6,
7
] |
/home/khang/anaconda3/lib/python3.6/tempfile.py | normal | {
"blob_id": "399a22450d215638051a7d643fb6d391156779c5",
"index": 5855,
"step-1": "/home/khang/anaconda3/lib/python3.6/tempfile.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
import math
# type defining of the variable and playing with variables.
a = 5.0
print(id(a))
a = 10
print("hello.....")
print(type(a))
print(id(a))
# locating addresses...
b = [5, 6, 7]
print(id(b))
b.append(10)
print(id(b))
# Strings...
name = input("Enter Your Name:: ") # iNPUTTING AS NAME
pri... | normal | {
"blob_id": "95b75395cafc6ba9f75ecf48157421e37ced2518",
"index": 815,
"step-1": "<mask token>\n\n\ndef rows(**ro):\n print(ro)\n\n\n<mask token>\n",
"step-2": "<mask token>\nprint(id(a))\n<mask token>\nprint('hello.....')\nprint(type(a))\nprint(id(a))\n<mask token>\nprint(id(b))\nb.append(10)\nprint(id(b))\... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
registry = load.PrimitiveRegistry({bool: dict(true=True, false=False).
__getitem__, datetime: partial(flip(datetime.strptime),
'%Y-%m-%dT%H:%M:%S%z'), str: str.strip, **{c: c for c in [int, float,
types.Journey.Status,... | flexible | {
"blob_id": "2dcb2d8d41096f0affe569d8ddbdd190885d5f14",
"index": 4738,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nregistry = load.PrimitiveRegistry({bool: dict(true=True, false=False).\n __getitem__, datetime: partial(flip(datetime.strptime),\n '%Y-%m-%dT%H:%M:%S%z'), str: str.strip, **{c: c fo... | [
0,
1,
2,
3
] |
class Solution:
def minimumDeviation(self, nums: List[int]) ->int:
hq, left, right, res = [], inf, 0, inf
for num in nums:
if num % 2:
num = num * 2
heapq.heappush(hq, -num)
left = min(left, num)
while True:
right = -heapq.heap... | normal | {
"blob_id": "975b2f3443e19f910c71f872484350aef9f09dd2",
"index": 7370,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def minimumDeviation(self, nums: List[int]) ->int:\n hq, left, right, res = [], inf, 0, inf\n for num in nums:\n ... | [
0,
1,
2
] |
import pygame
import textwrap
import client.Button as Btn
from client.ClickableImage import ClickableImage as ClickImg
from client.CreateDisplay import CreateDisplay
import client.LiverpoolButtons as RuleSetsButtons_LP
import client.HandAndFootButtons as RuleSetsButtons_HF
import client.HandManagement as HandManagement... | normal | {
"blob_id": "1cdd315eec6792a8588dc2e6a221bc024be47078",
"index": 7885,
"step-1": "<mask token>\n\n\nclass HandView:\n <mask token>\n\n def __init__(self, controller, display, ruleset):\n self.controller = controller\n self.display = display\n self.ruleset = ruleset\n self.Meld_T... | [
7,
9,
11,
12,
13
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-16 12:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0036_auto_20180516_1818'),
]
operations = [
migrations.AddField(
... | normal | {
"blob_id": "a7add26a919a41e52ae41c6b4c4079eadaa8aa1d",
"index": 851,
"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 = [('main', '0036... | [
0,
1,
2,
3,
4
] |
from matplotlib import pyplot as plt
dev_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
dev_y = [4000, 45000, 50000, 55000, 60000,
56000, 62316, 64928, 67317, 68748, 73752]
plt.plot(dev_x, dev_y, label='All Devs')
#dev_x and dev_y are respectively x-axis and y-axis
# Median Python Developer Salari... | normal | {
"blob_id": "796a13de72c2879956c5f9c9c9bdef7253760c9d",
"index": 9895,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.plot(dev_x, dev_y, label='All Devs')\n<mask token>\nplt.plot(dev_x, py_dev_y, label='Python')\nplt.xlabel('Ages')\nplt.ylabel('Median Salary')\nplt.title('Median Salary (USD) by Age')... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@ClassFactory.register(ClassType.METRIC, alias='accuracy')
class Accuracy(MetricBase):
<|reserved_special_token_0|>
__metric_name__ = 'accuracy'
def __init__(self, topk=(1, 5)):
"""Init Accuracy metric."""
self.topk = topk
self.sum = [0.0] * len(topk)
... | flexible | {
"blob_id": "a491772258a52bdfc93083343d2a2e48a240340d",
"index": 490,
"step-1": "<mask token>\n\n\n@ClassFactory.register(ClassType.METRIC, alias='accuracy')\nclass Accuracy(MetricBase):\n <mask token>\n __metric_name__ = 'accuracy'\n\n def __init__(self, topk=(1, 5)):\n \"\"\"Init Accuracy metri... | [
12,
13,
14,
15,
16
] |
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from appium.webdriver.common.touch_action import TouchAction
import time
import re
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import pymongo
def getSize():
x = driv... | normal | {
"blob_id": "6e614d1235a98ef496956001eef46b4447f0bf9b",
"index": 4677,
"step-1": "<mask token>\n\n\ndef getSize():\n x = driver.get_window_size()['width']\n y = driver.get_window_size()['height']\n return x, y\n\n\n<mask token>\n\n\ndef swipeUp(t):\n l = getSize()\n x1 = int(l[0] * 0.5)\n y1 = ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AppValidationsConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AppValidationsConfig(AppConfig):
name = 'app_validations'
<|reserved_special_toke... | flexible | {
"blob_id": "7a6a8b5e344a7b60e369f100885d1e26afa28f46",
"index": 7600,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass AppValidationsConfig(AppConfig):\n name = 'app_validations'\n",
"step-4": "from ... | [
0,
1,
2,
3
] |
#!flask/bin/python
from config import SQLALCHEMY_DATABASE_URI
from app.models import Patient, Appointment, PhoneCalls
from app import db
import os.path
db.create_all()
# Patient.generate_fake();
# Appointment.generate_fake();
# PhoneCalls.generate_fake();
Patient.add_patient();
Appointment.add_appointment();
PhoneCal... | normal | {
"blob_id": "173e6017884a1a4df64018b306ea71bcaa1c5f1d",
"index": 4528,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndb.create_all()\nPatient.add_patient()\nAppointment.add_appointment()\nPhoneCalls.add_call()\n",
"step-3": "from config import SQLALCHEMY_DATABASE_URI\nfrom app.models import Patient, A... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@celery_app.task
def demo_celery_run():
return 'result is ok'
<|reserved_special_token_1|>
from celery_app import celery_app
@celery_app.task
def demo_celery_run():
return 'result is ok'
| flexible | {
"blob_id": "4bb973b598a9c35394a0cd78ed9ba807f3a595d7",
"index": 2323,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@celery_app.task\ndef demo_celery_run():\n return 'result is ok'\n",
"step-3": "from celery_app import celery_app\n\n\n@celery_app.task\ndef demo_celery_run():\n return 'resul... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class NavTest(unittest.TestCase):
<|reserved_special_token_0|>
@classmethod
def tearDownClass(cls) ->None:
pass
def test01_getMarket(self):
resp_c = getParams.get_resp_params('cms_getMarket', 'getMarket', 'code'
)
resp_m = getParams.ge... | flexible | {
"blob_id": "b328ee0b6c5afaf496297cefe477f933af458a03",
"index": 5654,
"step-1": "<mask token>\n\n\nclass NavTest(unittest.TestCase):\n <mask token>\n\n @classmethod\n def tearDownClass(cls) ->None:\n pass\n\n def test01_getMarket(self):\n resp_c = getParams.get_resp_params('cms_getMark... | [
3,
4,
5,
6
] |
from cache_replacement.double_linked_list import DoubleLinkedList
from cache_replacement.node import Node
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.size = 0
self.cache_map = {}
self.cache_list = DoubleLinkedList(capacity=capacity)
def get(sel... | normal | {
"blob_id": "898ff6e38e80419d61ec4bbde827e8ca729eb19a",
"index": 5202,
"step-1": "<mask token>\n\n\nclass LRUCache:\n <mask token>\n <mask token>\n\n def put(self, key, value):\n if key in self.cache_map:\n old_node = self.cache_map.get(key)\n self.cache_list.remove(old_node... | [
2,
3,
4,
5
] |
import types
from robot.libraries.BuiltIn import BuiltIn
def GetAllVariableBySuffix (endswith):
all_vars = BuiltIn().get_variables()
result = {}
for var_name, var in all_vars.items():
#print var_name
if var_name.endswith(endswith+"}"):
print var_name
#print var
def ... | normal | {
"blob_id": "e9de42bb8ed24b95e5196f305fe658d67279c078",
"index": 3915,
"step-1": "import types\nfrom robot.libraries.BuiltIn import BuiltIn\n\ndef GetAllVariableBySuffix (endswith):\n all_vars = BuiltIn().get_variables()\n result = {}\n for var_name, var in all_vars.items():\n #print var_name\n ... | [
0
] |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | normal | {
"blob_id": "a9e0659c6a18ffc954079845b7d0de04c46a78c9",
"index": 7204,
"step-1": "<mask token>\n\n\nclass ServiceMap(Base):\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 <mas... | [
9,
10,
11,
13,
14
] |
#### As an example below shell script can be used to execute this every 300s.
####!/bin/bash
####while true
####do
#### /usr/bin/sudo python3 /path/of/the/python/script.sh
####done
#!/usr/bin/python
import sys
import time
import paho.mqtt.client as mqtt
broker_url = "<IP_Address_of_MQTT_broker>"
b... | normal | {
"blob_id": "f311b803d8c0ee68bc43526f56e6b14f3a2836b8",
"index": 7309,
"step-1": "#### As an example below shell script can be used to execute this every 300s.\r\n####!/bin/bash\r\n####while true\r\n####do\r\n#### /usr/bin/sudo python3 /path/of/the/python/script.sh\r\n####done\r\n\r\n#!/usr/bin/python\r\n... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def send_confirmation_email(user):
try:
confirmation_key = user.confirmation_key
except:
confirmation_key = user.add_unconfirmed_email(user.email)
msg_txt = render_to_string('email/confirmation.txt', ... | flexible | {
"blob_id": "822fc2941099cb9d7791580678cfb2a89a987175",
"index": 4685,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef send_confirmation_email(user):\n try:\n confirmation_key = user.confirmation_key\n except:\n confirmation_key = user.add_unconfirmed_email(user.email)\n msg... | [
0,
1,
2,
3,
4
] |
#source: https://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/
from imutils.video import VideoStream
import argparse
import datetime
import imutils
import time
import cv2
#capture the video file
b="blood.mp4"
c="Center.avi"
d="Deformed.avi"
i="Inlet.avi"
... | normal | {
"blob_id": "4bd928c16cd0f06931aad5a478f8a911c5a7108b",
"index": 5850,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Width x: ', width, ' Height y: ', height)\nprint('Frame Number,x coordinate of ROI,Weidth,Height,Width/Height')\n<mask token>\nwhile True:\n j += 1\n if j % 1000 != 0:\n ... | [
0,
1,
2,
3,
4
] |
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
import tensorflow as tf
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import u... | normal | {
"blob_id": "28c4c09b81d63785750cee36a8efd77760cac451",
"index": 7231,
"step-1": "<mask token>\n\n\ndef rotate_img(image, angle, color, filter=Image.NEAREST):\n if image.mode == 'P' or filter == Image.NEAREST:\n matte = Image.new('1', image.size, 1)\n else:\n matte = Image.new('L', image.size... | [
5,
8,
9,
11,
12
] |
string=input();
string=string.replace("(","");
string=string.replace(")","");
string=list(map(int,string.split(",")));
if(1 in string):
string.remove(1);
mid=[string[0]];
string.remove(string[0]);
result=0;
tar=0;
while(string!=[]):
tar=0;
length=len(string);
i=0
while(i<len(string)):
cout=0... | normal | {
"blob_id": "6a8cab1fceffa0d70441cc600137417a8b81d7b1",
"index": 6897,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif 1 in string:\n string.remove(1)\n<mask token>\nstring.remove(string[0])\n<mask token>\nwhile string != []:\n tar = 0\n length = len(string)\n i = 0\n while i < len(strin... | [
0,
1,
2,
3
] |
from sys import getsizeof
# using parenthesis indicates that we are creating a generator
a = (b for b in range(10))
print(getsizeof(a))
c = [b for b in range(10)]
# c uses more memory than a
print(getsizeof(c))
for b in a:
print(b)
print(sum(a)) # the sequence has disappeared
| normal | {
"blob_id": "2ee4b31f880441e87c437d7cc4601f260f34ae24",
"index": 6574,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(getsizeof(a))\n<mask token>\nprint(getsizeof(c))\nfor b in a:\n print(b)\nprint(sum(a))\n",
"step-3": "<mask token>\na = (b for b in range(10))\nprint(getsizeof(a))\nc = [b for... | [
0,
1,
2,
3,
4
] |
"""
help find Holly find dups in the PC's
Given a particular dir - report the dupset of each of the files so we can see
where the dups are
"""
import os, sys, re
from comms.dup_manager import DupManager
class DupFinder (DupManager):
base_archives_path = '/Volumes/archives/CommunicationsImageCollection/'
ba... | normal | {
"blob_id": "037a02ff2c0699acdd1fefbe60098c93cd99e777",
"index": 1987,
"step-1": "\"\"\"\nhelp find Holly find dups in the PC's\n\nGiven a particular dir - report the dupset of each of the files so we can see\nwhere the dups are\n\n\"\"\"\nimport os, sys, re\n\nfrom comms.dup_manager import DupManager\n\nclass D... | [
0
] |
from matplotlib import cm
from datascience.visu.util import plt, save_fig, get_figure
from sklearn.metrics import roc_curve, auc, confusion_matrix
import numpy as np
y = np.array([
[0.8869, 1.],
[1.-0.578, 0.],
[0.7959, 1.],
[0.8618, 1.],
[1.-0.2278, 0.],
[0.6607, 1.],
[0.7006, 1.],
... | normal | {
"blob_id": "5b3514af839c132fda9a2e6e178ae62f780f291e",
"index": 3388,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nax.set_xlim([-0.007, 1.0])\nax.set_ylim([0.0, 1.01])\nax.set_xlabel('False Positive Rate')\nax.set_ylabel('True Positive Rate')\nax.set_title('Receiver operating characteristic (AUC: %.3f... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3
# coding=utf-8
# date 2020-10-22 10:54:38
# author calllivecn <c-all@qq.com>
import sys
import random
import asyncio
import argparse
def httpResponse(msg):
response = [
"HTTP/1.1 200 ok",
"Server: py",
"Content-Type: text/plain",
"Content-Le... | normal | {
"blob_id": "9320926c9eb8a03d36446f3692f11b242c4fc745",
"index": 8364,
"step-1": "<mask token>\n\n\ndef httpResponse(msg):\n response = ['HTTP/1.1 200 ok', 'Server: py', 'Content-Type: text/plain',\n 'Content-Length: ' + str(len(msg)), '\\r\\n']\n return '\\r\\n'.join(response).encode('utf8') + msg\... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class AnnotatorConfig(object):
<|reserved_special_token_0|>
def __init__(self, filename=None):
pass
<|reserved_special_token_0|>
def get(self, key, default=None):
return self.__dict__.get(key, default)
def __setitem__(self, key, value):
self.... | flexible | {
"blob_id": "5c4c893caa19e58491e641420261bb70e7202cf0",
"index": 3566,
"step-1": "<mask token>\n\n\nclass AnnotatorConfig(object):\n <mask token>\n\n def __init__(self, filename=None):\n pass\n <mask token>\n\n def get(self, key, default=None):\n return self.__dict__.get(key, default)\n... | [
11,
13,
15,
16,
19
] |
__author__ = 'AChen'
from rec_linked_list import *
def filter_pos_rec(lst):
"""
@type lst: LinkedListRec
>>> lst = LinkedListRec([3, -10, 4, 0])
>>> pos = filter_pos_rec(lst)
>>> str(pos)
'3 -> 4'
"""
if lst.is_empty():
return lst
else:
pos_rec = LinkedListRec([])
... | normal | {
"blob_id": "efcbe296ea72a94be967124a8ba8c84a524e2eb1",
"index": 66,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef filter_pos_rec(lst):\n \"\"\"\n @type lst: LinkedListRec\n >>> lst = LinkedListRec([3, -10, 4, 0])\n >>> pos = filter_pos_rec(lst)\n >>> str(pos)\n '3 -> 4'\n\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_content(url):
paste_info = {'site': 'pomf', 'url': url}
m = re.match('^.*/([0-9a-zA-Z]+)\\.([a-zA-Z0-9]+)$', url)
response = requests.get(url)
if response.status_code != 200:
return
paste_info... | flexible | {
"blob_id": "78a6202f501bc116e21e98a3e83c9e3f8d6402b4",
"index": 3981,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_content(url):\n paste_info = {'site': 'pomf', 'url': url}\n m = re.match('^.*/([0-9a-zA-Z]+)\\\\.([a-zA-Z0-9]+)$', url)\n response = requests.get(url)\n if respons... | [
0,
1,
2,
3
] |
#!/usr/bin/python
import calendar
a=int(raw_input("enter the year to check that year is leap year or not\n"))
cal=calendar.isleap(a)
if cal :
print "leap year"
else :
print "not a leap year"
print "\nthanks "
'''
'''
| normal | {
"blob_id": "a077221d91f75645172ba5d86afad8e49cb7ed2f",
"index": 2796,
"step-1": "#!/usr/bin/python\nimport calendar\n\na=int(raw_input(\"enter the year to check that year is leap year or not\\n\")) \ncal=calendar.isleap(a)\n \nif cal :\n\t\t\tprint \"leap year\"\nelse :\n\t\t\tprint \"not a leap year\"\n\nprint... | [
0
] |
'''
Copyright (c) 2011 Jacob K. Schoen (jacob.schoen@gmail.com)
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,... | normal | {
"blob_id": "e2e3b63deba20cd87fdfca81a9f67fa24891a1e0",
"index": 6416,
"step-1": "<mask token>\n\n\ndef _getAlbums(conn, smugmug, lock):\n albums = smugmug.albums_get(Extras='LastUpdated')\n for album in albums['Albums']:\n myLogger.debug(album)\n title = album['Title']\n cat = None\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
class DeadlineMiddleware:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class DeadlineMiddleware:
def __init__(self, get_response):
self.get_response = get_resp... | flexible | {
"blob_id": "0d3e1df1720812e8546b1f3509c83d1e6566e103",
"index": 4639,
"step-1": "<mask token>\n\n\nclass DeadlineMiddleware:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DeadlineMiddleware:\n\n def __init__(self, get_response):\n self.get_response = ge... | [
1,
3,
4,
5,
6
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.