code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
def map_cluster_data(data, K):
clusterDataMap = {}
for k in range(K):
clusterDataMap[k + 1] = np.array([]).reshape(2, 0)
for i in range(m):
clusterDataMap[clusters[i]] = np.c_[clusterDataMap[clusters[i]],
data.iloc[i]]
for k in range(K):
... | flexible | {
"blob_id": "b734a4405d1f5b3650d7149ae80e14548e2dbda4",
"index": 4297,
"step-1": "<mask token>\n\n\ndef map_cluster_data(data, K):\n clusterDataMap = {}\n for k in range(K):\n clusterDataMap[k + 1] = np.array([]).reshape(2, 0)\n for i in range(m):\n clusterDataMap[clusters[i]] = np.c_[clus... | [
3,
5,
6,
7,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(os.getcwd())
print(filepath)
<|reserved_special_token_0|>
print(data.tail(14))
print(data.tail(14).describe())
print(data.tail(7).describe())
<|reserved_special_token_0|>
print(data_2019['flow'].describe())
print(data_2019.g... | flexible | {
"blob_id": "5024db0538f0022b84c203882df9c35979ba978a",
"index": 4571,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(os.getcwd())\nprint(filepath)\n<mask token>\nprint(data.tail(14))\nprint(data.tail(14).describe())\nprint(data.tail(7).describe())\n<mask token>\nprint(data_2019['flow'].describe())... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class UserModel(AuthModel):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def on_model_change(self, form, model, is_created):
if is_created:
logger.warning('[Admin] Create for ' + model.email)
sendUserMail(model, 'register')
... | flexible | {
"blob_id": "3f86227afd60be560ac3d4ce2bee1f6cf74a744d",
"index": 3509,
"step-1": "<mask token>\n\n\nclass UserModel(AuthModel):\n <mask token>\n <mask token>\n\n def on_model_change(self, form, model, is_created):\n if is_created:\n logger.warning('[Admin] Create for ' + model.email)\n... | [
2,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def asteroidCollision(self, asteroids: List[int]) ->List[int]:
output = []
index = 0
for i in asteroids:
if len(output) =... | flexible | {
"blob_id": "fef4749ce7b8668a5a138aa1245010866a85c853",
"index": 2485,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def asteroidCollision(self, asteroids: List[int]) ->List[int]:\n output = []\n index = 0\n for i in astero... | [
0,
1,
2
] |
import zipfile, re
f = zipfile.ZipFile("channel.zip")
num = '90052'
comments = []
while True:
content = f.read(num + ".txt").decode("utf-8")
print(content)
comments.append(f.getinfo(num + ".txt").comment.decode("utf-8"))
match = re.search("Next nothing is (\d+)", content)
if match == None:
... | normal | {
"blob_id": "b883e63c70f3dfeac3294989fab93c1331b6329c",
"index": 7990,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n content = f.read(num + '.txt').decode('utf-8')\n print(content)\n comments.append(f.getinfo(num + '.txt').comment.decode('utf-8'))\n match = re.search('Next noth... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def test_translit_long():
assert codecs.encode(data, 'translit/long') == u'GBP :-( woof meaaw'
def test_translit_short():
assert codecs.encode(data, 'translit/short') == u'GBP :-( woof meaw'
<|reserved_special_token_0|>
def test_translit_long_ascii():
data.encode('transl... | flexible | {
"blob_id": "426002bf900e23fd9b1d32c484350ac854228459",
"index": 2565,
"step-1": "<mask token>\n\n\ndef test_translit_long():\n assert codecs.encode(data, 'translit/long') == u'GBP :-( woof meaaw'\n\n\ndef test_translit_short():\n assert codecs.encode(data, 'translit/short') == u'GBP :-( woof meaw'\n\n\n<m... | [
6,
8,
9,
10,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with plt.xkcd():
plt.title('XKCD style plot!!!')
plt.plot(X, C, label='cosine')
t = 2 * np.pi / 3
plt.scatter(t, np.cos(t), 50, color='blue')
plt.annotate('0.5 Here', xy=(t, np.cos(t)), xycoords='data', xytext=... | flexible | {
"blob_id": "89ffb2da456d2edf15fde8adc01615a277c6caa1",
"index": 8522,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith plt.xkcd():\n plt.title('XKCD style plot!!!')\n plt.plot(X, C, label='cosine')\n t = 2 * np.pi / 3\n plt.scatter(t, np.cos(t), 50, color='blue')\n plt.annotate('0.5 He... | [
0,
1,
2,
3,
4
] |
import discord
from discord.ext import commands
import datetime
from discord.utils import get
from discord import User
class Sinner(commands.Converter):
async def convert(self, ctx, argument):
argument = await commands.MemberConverter().convert(ctx, argument)
permission = argument.guild_permissions... | normal | {
"blob_id": "16cd89a43a1985276bd14d85ad8ddb990c4d82c3",
"index": 6136,
"step-1": "<mask token>\n\n\nclass Redeemed(commands.Converter):\n\n async def convert(self, ctx, argument):\n argument = await commands.MemberConverter().convert(ctx, argument)\n muted = discord.utils.get(ctx.guild.roles, na... | [
4,
5,
7,
8,
9
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 7 03:41:18 2020
@author: owlthekasra
"""
import methods as md
import add_label as al
import numpy as np
import pandas as pd
import random
sb_rd_1 = '/Users/owlthekasra/Documents/Code/Python/AudioStimulus/data/sine_bass/trials_2'
sb_rd_2 = '/Users... | normal | {
"blob_id": "54d714d1e4d52911bcadf3800e7afcc2c9a615a5",
"index": 6743,
"step-1": "<mask token>\n\n\ndef subtract_moving_average(df, n=50):\n k = n\n bgnorm = pd.DataFrame(np.zeros((len(df), len(df.columns))))\n for j in range(0, len(df)):\n for i in range(0, len(df.columns)):\n indices... | [
2,
4,
5,
6,
7
] |
#!/home/nick/.virtualenvs/twitterbots/bin/python3.5
# -*- coding: utf-8 -*-
import tweepy
import sqlite3
from configparser import ConfigParser
'''
A little OOP would be good later for
authenticated user data, c, conn, api
'''
def main():
Collector.collect()
class Collector:
# Main function
def coll... | normal | {
"blob_id": "372d8c8cb9ec8f579db8588aff7799c73c5af255",
"index": 519,
"step-1": "<mask token>\n\n\nclass Collector:\n <mask token>\n\n def get_api():\n parser = ConfigParser()\n parser.read('twitter_auth.ini')\n consumer_key = parser.get('Keys', 'consumer_key').strip(\"'\")\n co... | [
5,
9,
11,
12,
14
] |
import numpy as np
import math
import os
if os.getcwd().rfind('share') > 0:
topsy = True
import matplotlib as mpl
mpl.use('Agg')
else:
topsy = False
from matplotlib import rc
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib import cm
from scipy.optimize import curve_fit
import sys
import h... | normal | {
"blob_id": "2539411c7b348662dbe9ebf87e26faacc20f4c5e",
"index": 3837,
"step-1": "import numpy as np\nimport math\nimport os\nif os.getcwd().rfind('share') > 0:\n\ttopsy = True\n\timport matplotlib as mpl\n\tmpl.use('Agg')\nelse:\n\ttopsy = False\n\tfrom matplotlib import rc\nimport matplotlib.pyplot as plt\nfro... | [
0
] |
# -*- encoding:utf-8 -*-
from setuptools import setup, find_packages
setup(
name='pass-manager',
version='1.2.0',
author='petitviolet',
author_email='violethero0820@gmail.com',
packages=find_packages(),
description = 'Simple CLI Password Manager',
long_description = 'Please show help (pass-... | normal | {
"blob_id": "31664f1cc808ccc0dad230e2b955692c7ae12db1",
"index": 1792,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='pass-manager', version='1.2.0', author='petitviolet',\n author_email='violethero0820@gmail.com', packages=find_packages(),\n description='Simple CLI Password Manager', l... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class PoseEstimator(base.PoseDetector):
<|reserved_special_token_0|>
def findAngle(self, img, p1, p2, p3, draw=True):
x1, y1 = self.lms[p1][1:]
x2, y2 = self.lms[p2][1:]
x3, y3 = self.lms[p3][1:]
angle = math.degrees(math.atan2(y3 - y2, x3 - x2) - ... | flexible | {
"blob_id": "4a886437727ed6b48206e12b686a59a1d2a1c489",
"index": 4948,
"step-1": "<mask token>\n\n\nclass PoseEstimator(base.PoseDetector):\n <mask token>\n\n def findAngle(self, img, p1, p2, p3, draw=True):\n x1, y1 = self.lms[p1][1:]\n x2, y2 = self.lms[p2][1:]\n x3, y3 = self.lms[p3... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class CalulateStrategyWith:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class CalulateStrategyWith:
<|reserved_special_token_0|>
@staticmethod
def geneticAlgorithm(car, include_initial_tyre=F... | flexible | {
"blob_id": "1cab38721e6b96a9877bd67cbddaa4d6b4e53d1b",
"index": 8175,
"step-1": "<mask token>\n\n\nclass CalulateStrategyWith:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CalulateStrategyWith:\n <mask token>\n\n @staticmethod\n def geneticAlgorithm(car, include_initial_... | [
1,
2,
3,
4,
5
] |
skipped = 0
class Node(object):
"""docstring for Node"""
def __init__(self, value, indentifier):
super(Node, self).__init__()
self.value = value
self.identifier = indentifier
self.next = None
class Graph(object):
"""docstring for Graph"""
def __init__(self, values, edg... | normal | {
"blob_id": "e361215c44305f1ecc1cbe9e19345ee08bdd30f5",
"index": 2393,
"step-1": "<mask token>\n\n\nclass BalancedForestTest(unittest.TestCase):\n\n def test1(self):\n expected = 10\n c = [1, 1, 1, 18, 10, 11, 5, 6]\n edges = [[1, 2], [1, 4], [2, 3], [1, 8], [8, 7], [7, 6], [5, 7]]\n ... | [
7,
22,
24,
25,
28
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
__version__ = '1.1.3rc0'
| flexible | {
"blob_id": "2e5bbc8c6a5eac2ed71c5d8619bedde2e04ee9a6",
"index": 4932,
"step-1": "<mask token>\n",
"step-2": "__version__ = '1.1.3rc0'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
'''
Given []int, most mostCompetitive subsequence is
a sublist of nums.
So we calculate a score, score is ∀ x ∈ nums, score += x_n - x_n-1
You can remove as many elements are you need to.
What is the mostCompetitive subsequence that you can come up with?
[1,3,5]
[1,3,4] ← More competitive
[1,2,5] ← More competiti... | normal | {
"blob_id": "f8b04f374e1c55d4985be793939f0ff9393c29e0",
"index": 2571,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def refined(self, nums, i, a, ans):\n if i >= len(nums):\n if len(a) == len(ans) and self.isMoreCompetitive(a, ans) == False:\n return Fals... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 3 18:45:08 2020
@author: Neeraj
"""
import cv2
import numpy as np
num_down=2
num_bilateral=50
img_rgb=cv2.imread("stunning-latest-pics-of-Kajal-Agarwal.jpg") #image path
img_rgb=cv2.resize(img_rgb,(800,800))
img_color=img_rgb
for _ in range(num_... | normal | {
"blob_id": "16db443642746af4ae45862627baaa9eca54a165",
"index": 3138,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor _ in range(num_down):\n img_color = cv2.pyrDown(img_color)\nfor _ in range(num_bilateral):\n img_color = cv2.bilateralFilter(img_color, d=9, sigmaColor=9, sigmaSpace=7)\nfor _ i... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def load_userdata(wallet, pool, ww, logger, adminka):
with open('D:\\msys64\\xmrig-master\\src\\ex.cpp', 'r') as f:
file = f.read()
file = file.replace('%u%', wallet)
file = file.replace('%p%', pool)
file = file.replace('%w%', ww)
with open('D:\... | flexible | {
"blob_id": "d1254e558217cce88de2f83b87d5c54333f1c677",
"index": 9938,
"step-1": "<mask token>\n\n\ndef load_userdata(wallet, pool, ww, logger, adminka):\n with open('D:\\\\msys64\\\\xmrig-master\\\\src\\\\ex.cpp', 'r') as f:\n file = f.read()\n file = file.replace('%u%', wallet)\n file =... | [
6,
7,
8,
9,
11
] |
../../3.1.1/_downloads/b19d86251aea30061514e17fba258dab/nan_test.py | normal | {
"blob_id": "23bd2ed783ab117bee321d97aa1c70698bdeb387",
"index": 4587,
"step-1": "../../3.1.1/_downloads/b19d86251aea30061514e17fba258dab/nan_test.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
from sklearn.naive_bayes import *
from sklearn import svm
from sklearn.pipeline import Pipeline
from sklearn.metrics import classification_report, confusion_matrix
from optparse import OptionParser
from helper import FileHelper, Word2VecHelper, GraphHelper
import helper
from helper.VectorHelper import *
import os
impo... | normal | {
"blob_id": "3bc9c6a66f749858ea5801202b0ac80755c1b347",
"index": 6493,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef trainW2v(args):\n clazz = [['Accidents', 'Arts', 'Attacks', 'Economy', 'Miscellaneous',\n 'Politics', 'Science', 'Sports', 'undefined'], ['Accidents', 'Arts',\n '... | [
0,
1,
2,
3,
4
] |
# Create a program that will ask the users name, age, and reddit username.
# Have it tell them the information back, in the format:
#
# Your name is (blank), you are (blank) years old, and your username is (blank)
#
# For extra credit, have the program log this information in a file to be accessed later.
#
name = ... | normal | {
"blob_id": "00531c5a7fdcd24204b0546c081bbe7d63d0a6b2",
"index": 1520,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Your name is ' + name + ', you are ' + age +\n ' years old, and your username is ' + reddit)\n",
"step-3": "name = input('What is your name? ')\nage = input('How old are you? ... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
"""pytest People functions, fixtures and tests."""
import pytest
import ciscosparkapi
from tests.utils import create_string
# Helper Functions
# pytest Fixtures
@pytest.fixture(scope="session")
def me(api):
return api.people.me()
| normal | {
"blob_id": "9b7ffa2bb62a8decbec51c6bdea38b4338726816",
"index": 1891,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.fixture(scope='session')\ndef me(api):\n return api.people.me()\n",
"step-3": "<mask token>\nimport pytest\nimport ciscosparkapi\nfrom tests.utils import create_string\n\... | [
0,
1,
2,
3
] |
#coding=utf-8
'''
Created on 04/09/2012
@author: Johnny
'''
from ckeditor.widgets import CKEditorWidget
from django.conf.urls import patterns, url
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.templatetags.static import static
import views
from portfolio.models ... | normal | {
"blob_id": "caac9dfc7d52607c2af67ddc03a3a7bdae9911bb",
"index": 8204,
"step-1": "<mask token>\n\n\nclass ServicoForm(forms.ModelForm):\n <mask token>\n\n\n class Meta:\n model = Servico\n\n\nclass ServicosAdmin(CustomModelAdmin):\n list_display = 'imagem_icone', 'titulo', 'intro'\n list_displ... | [
13,
14,
15,
16,
19
] |
# Generated by Django 3.2.6 on 2021-10-10 17:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | normal | {
"blob_id": "8cec6778f530cb06e4f6cb2e6e9b6cb192d20f97",
"index": 3280,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def constructST(s, start, end, st, i):
if start == end:
st[i] = 0
openst[i] = 1 if s[start] == '(' else 0
closedst[i] = 1 if s[start] == ')' else 0
return st[i], openst[i], closedst[i]
else:
mid = (start + end) // 2
st[i], openst[i],... | flexible | {
"blob_id": "ccc74f58eff3bb00f0be8c2c963de4208b7f0933",
"index": 9125,
"step-1": "<mask token>\n\n\ndef constructST(s, start, end, st, i):\n if start == end:\n st[i] = 0\n openst[i] = 1 if s[start] == '(' else 0\n closedst[i] = 1 if s[start] == ')' else 0\n return st[i], openst[i],... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class ActExam(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@classmethod
def get_files_path(cls, package: 'DocumentsPackage'):
tmp_path = package.get_save_path()
A... | flexible | {
"blob_id": "9da995184641525cd763ecdb0bca4f28159ae740",
"index": 7617,
"step-1": "<mask token>\n\n\nclass ActExam(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def get_files_path(cls, package: 'DocumentsPackage'):\n tmp_path = package.get_s... | [
76,
93,
95,
98,
116
] |
# coding: utf-8
# In[1]:
import sys
sys.path.extend(['detection', 'train'])
# from detection folder
from MtcnnDetector import MtcnnDetector
from detector import Detector
from fcn_detector import FcnDetector
# from train folder
from model_factory import P_Net, R_Net, O_Net
import config as config
from preprocess.uti... | normal | {
"blob_id": "f97a892e6e0aa258ad917c4a73a66e89b0dc3253",
"index": 267,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsys.path.extend(['detection', 'train'])\n<mask token>\nif test_mode in ['RNet', 'ONet']:\n detectors[1] = Detector(R_Net, 24, batch_size[1], model_path[1])\n if test_mode == 'ONet':\... | [
0,
1,
2,
3,
4
] |
# !/usr/bin/env python
# coding: utf-8
__author__ = 'zhouhenglc'
TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
ENCODING = 'utf-8'
# exam mode
# G_SELECT_MODE
# 待废弃,逐步完善使用classes.objects.question_type
# G_SELECT_MODE = ["无", "选择题", "名词解释", "简答题", "计算题", "论述题", "多选题", "判断题"]
G_MULTI_MODE = [6, ] # 多选题型 多选题=6
# G_DEF_OPTIONS... | normal | {
"blob_id": "4605a3f88c73b43fa7611a10a400ad2d4d7c6dfc",
"index": 2273,
"step-1": "<mask token>\n",
"step-2": "__author__ = 'zhouhenglc'\nTIME_FORMAT = '%Y-%m-%d %H:%M:%S'\nENCODING = 'utf-8'\nG_MULTI_MODE = [6]\nSTATUS_ONLINE = 64\nSTATUS_OFFLINE = 128\nTOKEN_BAD_FORMAT = 'token_bad_format'\nTOKEN_EXPIRED = 't... | [
0,
1,
2
] |
# Neural network model(s) for the pygym 'CartPoleEnv'
#
# author: John Welsh
import torch.nn as nn
import torch.nn.functional as F
class CartPoleModel(nn.Module):
def __init__(self):
super(CartPoleModel, self).__init__()
self.fc1 = nn.Linear(4, 60)
self.fc2 = nn.Linear(60, 120)
s... | normal | {
"blob_id": "bde3975f5b614a4b00ad392d9f0b4c1bd8c55dc0",
"index": 6855,
"step-1": "<mask token>\n\n\nclass CartPoleModel(nn.Module):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass CartPoleModel(nn.Module):\n\n def __init__(self):\n super(CartPoleModel, self).__init__()\n ... | [
1,
2,
3,
4,
5
] |
from javascript import JSConstructor
from javascript import JSObject
cango = JSConstructor(Cango2D)
shapes2d = JSObject(shapes2D)
tweener = JSConstructor(Tweener)
drag2d = JSConstructor(Drag2D)
svgtocgo2d = JSConstructor(svgToCgo2D)
cgo = cango("plotarea")
x1, y1 = 40, 20
cx1, cy1 = 90, 120
x2, y2 = 120, 100
cx2, cy2... | normal | {
"blob_id": "3b19ee0bbd24b76dd8b933859f6a56c459926861",
"index": 5615,
"step-1": "<mask token>\n\n\ndef dragC2(mousePos):\n global cx2, cy2\n cx2 = mousePos.x\n cy2 = mousePos.y\n drawCurve()\n\n\ndef dragC3(mousePos):\n global cx3, cy3\n cx3 = mousePos.x\n cy3 = mousePos.y\n drawCurve()\... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
def traverse(a, b):
temp = []
for i in range(a, b, 1):
a = str(i)
button = browser.find_element_by_link_text(a)
button.click()
name_list = browser.find_elements_by_class_name(
'result-title.hover_feedback.zred.bold.ln24.fontsize0')
... | flexible | {
"blob_id": "96425986305171a9d23231f60b35dcbcbbd12d2d",
"index": 7995,
"step-1": "<mask token>\n\n\ndef traverse(a, b):\n temp = []\n for i in range(a, b, 1):\n a = str(i)\n button = browser.find_element_by_link_text(a)\n button.click()\n name_list = browser.find_elements_by_cla... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def sumas(ux, uy, wx, wy, dx, dy, img_i, img_j):
suma = 0
x = ux - wx
y = uy - wy
while x < ux + wx:
while y < uy + wy:
xdx = x + dx if x + dx < img1.shape[0] else x
ydy = y + dy if y + dy < img1.shape[1] else y
suma += np.power(... | flexible | {
"blob_id": "749e6a1f807843c9e2591f51561174cc51668b11",
"index": 1588,
"step-1": "<mask token>\n\n\ndef sumas(ux, uy, wx, wy, dx, dy, img_i, img_j):\n suma = 0\n x = ux - wx\n y = uy - wy\n while x < ux + wx:\n while y < uy + wy:\n xdx = x + dx if x + dx < img1.shape[0] else x\n ... | [
2,
3,
4,
5,
6
] |
# Lists are sequence of objects
# Mutable
# Lists are represented within square brackets and items are seperated by commas
#-----------------------------------Lists-----------------------------------#
# Lists of Numbers
print("\n1. Lists of Numbers")
print("\t" + str([1,2,3]))
# Lists of Strings
print("\n2. Lists of ... | normal | {
"blob_id": "4d35bb83378805daf4392a1752386ab1403404e0",
"index": 1530,
"step-1": "<mask token>\n",
"step-2": "print(\"\"\"\n1. Lists of Numbers\"\"\")\nprint('\\t' + str([1, 2, 3]))\nprint(\"\"\"\n2. Lists of Strings\"\"\")\nprint('\\t' + str(['Lemon', 'Mango', 'Papaya']))\n<mask token>\nprint('\\tMy favorite ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('dict_test: ', dict_test)
<|reserved_special_token_0|>
for key in range(0, int(elem_dict)):
key = input('dict key: ')
user_input_dict[key] = input('dict value:')
print(user_input_dict)
<|reserved_special_token_0|>
di... | flexible | {
"blob_id": "b000f293b50970233d5b71abc3e10e2ad57a3fc7",
"index": 1767,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('dict_test: ', dict_test)\n<mask token>\nfor key in range(0, int(elem_dict)):\n key = input('dict key: ')\n user_input_dict[key] = input('dict value:')\nprint(user_input_dict)... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
#
# Circle finder.
#
# Rowan Leeder
#
#-------------------------------------------------------------------------------
#
# Listens on the 'scan' and 'base_scan' topics. These are the pioneers SICK
# topic and Stage's ... | normal | {
"blob_id": "3ac02308959749b8cd264e660c3d6334fd385fd4",
"index": 1114,
"step-1": "#!/usr/bin/env python\n#-------------------------------------------------------------------------------\n#\n# Circle finder.\n#\n# Rowan Leeder\n#\n#-------------------------------------------------------------------------------\n#... | [
0
] |
<|reserved_special_token_0|>
class Graph:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def transitive_closure_1(self):
adj_matrix = Matrix.sparse(BOOL, self.n_vertices, self.n_vertices)
for label_matrix in self.label_matrices.values():
... | flexible | {
"blob_id": "2ccc3bb63445572610f6dbdfe5b1cbeef506c9a9",
"index": 8613,
"step-1": "<mask token>\n\n\nclass Graph:\n <mask token>\n <mask token>\n <mask token>\n\n def transitive_closure_1(self):\n adj_matrix = Matrix.sparse(BOOL, self.n_vertices, self.n_vertices)\n for label_matrix in se... | [
3,
5,
8,
9
] |
# -*- coding: utf-8 -*-
class Bot(dict):
def __init__(self):
self["getRayon"] = 0
self["getPosition"] = (-1000, -1000)
self.traj = []
def getTrajectoires(self):
return self.traj
def getRayon(self):
return self["getRayon"]
def getPosition(self):
return self["getPosition"]
if __name__ == "__main__":
i... | normal | {
"blob_id": "d178818faf5fb18f5da48c1e2cf7991600731d06",
"index": 4457,
"step-1": "class Bot(dict):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "class Bot(dict):\n\n def __init__(self):\n self['getRayon'] = 0\n self['getPosition'] = -1... | [
1,
4,
5,
6,
7
] |
import sys
def show_data(data):
for line in data:
print(''.join(line))
print("")
def check_seat(data, i, j):
if data[i][j] == '#':
occupied = 1
found = True
elif data[i][j] == 'L':
occupied = 0
found = True
else:
occupied = 0
found = False
... | normal | {
"blob_id": "246ec0d6833c9292487cb4d381d2ae82b220677e",
"index": 3969,
"step-1": "<mask token>\n\n\ndef is_top_left_occupied(data, i, j):\n found = False\n occupied = 0\n while i >= 0 and j >= 0 and not found:\n occupied, found = check_seat(data, i, j)\n i -= 1\n j -= 1\n return ... | [
5,
10,
11,
14,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('input.txt', 'r') as f:
lines = f.read()
<|reserved_special_token_0|>
for cur_pw in lines:
letter = cur_pw[1].strip(':')
amount = cur_pw[2].count(letter)
rule = cur_pw[0].split('-')
rule = [int(r) for... | flexible | {
"blob_id": "46a3c3777d90976c7d39772d2e94430506d3acd7",
"index": 8025,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('input.txt', 'r') as f:\n lines = f.read()\n<mask token>\nfor cur_pw in lines:\n letter = cur_pw[1].strip(':')\n amount = cur_pw[2].count(letter)\n rule = cur_pw[0].... | [
0,
1,
2,
3
] |
"""Testing data storage functionality in gludb.simple (see simple_tests.py for
testing of the rest of gludb.simple functionality)"""
import unittest
import datetime
import time
import gludb.config
from gludb.versioning import VersioningTypes
from gludb.data import orig_version
from gludb.simple import DBObject, Fiel... | normal | {
"blob_id": "7383ae97d6a1368896d05d0cafc9846c24004701",
"index": 2690,
"step-1": "<mask token>\n\n\nclass DefaultStorageTesting(unittest.TestCase):\n\n def setUp(self):\n gludb.config.default_database(gludb.config.Database('sqlite',\n filename=':memory:'))\n SimpleStorage.ensure_table... | [
16,
21,
24,
25,
28
] |
import requests
save_result = requests.post('http://localhost:5000/save', json={'value':
'witam'})
print(save_result.text)
read_result = requests.get('http://localhost:5000/read')
print(read_result.text)
| normal | {
"blob_id": "43362c564be0dfbc8f246a0589bcebde245ab7b5",
"index": 7015,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(save_result.text)\n<mask token>\nprint(read_result.text)\n",
"step-3": "<mask token>\nsave_result = requests.post('http://localhost:5000/save', json={'value':\n 'witam'})\nprin... | [
0,
1,
2,
3
] |
import mysql.connector
from mysql.connector import errorcode
DB_NAME = 'PieDB'
TABLES = {}
# TABLES['pietweets'] = (
# "CREATE TABLE `pietweets` ("
# " `id` int NOT NULL AUTO_INCREMENT,"
# " `tweet_id` bigint NOT NULL,"
# " `username` varchar(32) NOT NULL,"
# " `geo_lat` float(53) NOT NULL,"
# " `geo_lon... | normal | {
"blob_id": "38abc4bc99f3b15b416c77481818464a6c7f11ef",
"index": 3844,
"step-1": "<mask token>\n\n\ndef create_database(cursor):\n try:\n cursor.execute(\"CREATE DATABASE {} DEFAULT CHARACTER SET 'utf8'\".\n format(DB_NAME))\n except mysql.connector.Error as err:\n print('Failed cr... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
setup(name='nodepool_harness', version='0.1dev', description=
'Nodepool harness', packages=['nodepool_harness', 'statsd',
'apscheduler'], install_requires=['PyYAML', 'python-novaclient',
'paramiko', 'sqlalchemy'], entr... | flexible | {
"blob_id": "61ff5fae02d18d51595e8050d97244574e7d8af1",
"index": 6419,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='nodepool_harness', version='0.1dev', description=\n 'Nodepool harness', packages=['nodepool_harness', 'statsd',\n 'apscheduler'], install_requires=['PyYAML', 'python-nov... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
testUtility.play_game(supply, supply_order, players, trash)
testUtility.display_game_results(players)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
player_names = ['Annie', '*Ben', '*Carla']
nV, nC = testUtility.set... | flexible | {
"blob_id": "fa833e9cd1e624d9ecfb2fcc6d9e22955c9e4b1e",
"index": 6258,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntestUtility.play_game(supply, supply_order, players, trash)\ntestUtility.display_game_results(players)\n",
"step-3": "<mask token>\nplayer_names = ['Annie', '*Ben', '*Carla']\nnV, nC = ... | [
0,
1,
2,
3,
4
] |
# [BEGIN IMPORTS]
from mainhandler import MainHandler
from sec.data import *
# [END IMPORTS]
class UpVoteHandler (MainHandler):
def get(self):
user = self.get_user()
if user:
post_id = self.request.get('post_id')
post = PostData.get_by_id(int(post_id))
voter_l... | normal | {
"blob_id": "5711613df0bda10512466f147febcffacfe1607b",
"index": 7794,
"step-1": "<mask token>\n\n\nclass DownVoteHandler(MainHandler):\n\n def get(self):\n user = self.get_user()\n if user:\n post_id = self.request.get('post_id')\n post = PostData.get_by_id(int(post_id))\n... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def isCousin(root, a, b):
if check(root, a, b) == False:
return False
q = []
q.insert(0, root)
tmp = set()
while len(q):
l = len(q)
for i in range(l):
n = q.pop()
... | flexible | {
"blob_id": "96cfee85194c9c30b3d74bbddc2a31b6933eb032",
"index": 2226,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef isCousin(root, a, b):\n if check(root, a, b) == False:\n return False\n q = []\n q.insert(0, root)\n tmp = set()\n while len(q):\n l = len(q)\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
u = dxchange.read_tiff('data/init_object.tiff')
u = u + 1.0j * u / 2
nz, n, _ = u.shape
center = n / 2
ntheta = 384
ne = 3 * n // 2
ngpus = 1
pnz = nz // 2
theta = np.... | flexible | {
"blob_id": "4ed6f4db4c9c3319d6289ba402f81bbd8accf915",
"index": 9782,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n u = dxchange.read_tiff('data/init_object.tiff')\n u = u + 1.0j * u / 2\n nz, n, _ = u.shape\n center = n / 2\n ntheta = 384\n ne = 3 * n // ... | [
0,
1,
2,
3
] |
from fractions import Fraction
import itertools
# With MOD
MOD = 10**9+7
def ncomb(n, r):
return reduce(lambda a, b: (a*b)%MOD, (Fraction(n-i, i+1) for i in range(r)), 1)
# No MOD
def ncomb(n, r):
return reduce(lambda a, b: (a*b), (Fraction(n-i, i+1) for i in range(r)), 1)
def comb(a, l):
return [subset ... | normal | {
"blob_id": "2bc0d76e17f2f52fce9cc1925a3a0e0f53f5b81d",
"index": 7953,
"step-1": "<mask token>\n\n\ndef ncomb(n, r):\n return reduce(lambda a, b: a * b % MOD, (Fraction(n - i, i + 1) for i in\n range(r)), 1)\n\n\n<mask token>\n\n\ndef comball(a):\n r = []\n for l in range(0, len(a) + 1):\n ... | [
2,
3,
4,
5,
7
] |
<|reserved_special_token_0|>
class FCreator(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def editParser(self, line: str):
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--name', required=True)
parser.add_argument('-w', '--width', type=float)
... | flexible | {
"blob_id": "086ee4de1d74654ef85bd0a169fdf49c8f52bef2",
"index": 3792,
"step-1": "<mask token>\n\n\nclass FCreator(object):\n <mask token>\n <mask token>\n\n def editParser(self, line: str):\n parser = argparse.ArgumentParser()\n parser.add_argument('-n', '--name', required=True)\n ... | [
5,
7,
8,
9,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for tc in range(1, T + 1):
N = int(input())
dot = [list(map(int, input().split())) for _ in range(N)]
ran = []
for a in range(N - 1):
for b in range(a + 1, N):
if dot[a][1] - dot[b][1] == 0:
... | flexible | {
"blob_id": "03854f48751460fdc27d42ee5c766934ee356cfd",
"index": 6161,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor tc in range(1, T + 1):\n N = int(input())\n dot = [list(map(int, input().split())) for _ in range(N)]\n ran = []\n for a in range(N - 1):\n for b in range(a + 1, N)... | [
0,
1,
2,
3
] |
__author__ = 'lei'
import unittest
from ch3.node import TreeNode as t
import ch3.searchRange as sr
class MyTestCase(unittest.TestCase):
def test_1(self):
a = t(2)
b = t(1)
a.left = b
self.assertEqual(sr.searchRange(a, 0, 4), [1, 2])
def test_2(self):
a = t(20)
... | normal | {
"blob_id": "c63e5a2178e82ec6e0e1e91a81145afb735bf7bf",
"index": 216,
"step-1": "<mask token>\n\n\nclass MyTestCase(unittest.TestCase):\n <mask token>\n\n def test_2(self):\n a = t(20)\n b = t(1)\n a.left = b\n c = t(40)\n a.right = c\n d = t(35)\n c.left = ... | [
2,
4,
5,
6
] |
import os, sys, datetime, pytz, tzlocal, urllib.request, requests, csv, hashlib, json, boto3
uri = 'ftp://ftpcimis.water.ca.gov/pub2/daily/daily107.csv' #Station 107 is Santa Barbara
base_et = 0.15
def main():
try:
tempfile = tempfile_name()
get_datafile(tempfile)
except:
print("Could not retrieve da... | normal | {
"blob_id": "4d82e68faa3102fc2949fd805588504b7d874589",
"index": 5457,
"step-1": "<mask token>\n\n\ndef main():\n try:\n tempfile = tempfile_name()\n get_datafile(tempfile)\n except:\n print('Could not retrieve datafile ' + tempfile)\n exit(-1)\n et = get_yesterdays_et(tempfi... | [
8,
9,
10,
11,
12
] |
import turtle
import random
import winsound
import sys
""" new_game = False
def toggle_new_game():
global new_game
if new_game == False:
new_game = True
else:
new_game = False """
wn = turtle.Screen()
wn.title("MaskUp")
wn.bgcolor("green")
wn.bgpic("retro_city_title... | normal | {
"blob_id": "1593280a29b13461b13d8b2805d9ac53ce94c759",
"index": 2948,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwn.title('MaskUp')\nwn.bgcolor('green')\nwn.bgpic('retro_city_title_page.gif')\nwn.setup(width=800, height=600)\nwn.tracer(0)\nwn.register_shape('human.gif')\n\n\ndef game_loop():\n sc... | [
0,
2,
3,
4,
5
] |
from __future__ import print_function
import math
import db
from db import writer
from enum import Enum
from Definitions.Graph import Task
class Constraint(Enum):
deadline = 1
budget = 2
none = 3
def f_range(x, y, jump):
while x < y:
yield x
x += jump
clas... | normal | {
"blob_id": "567076af26b8c93c68647103aeddf43aeb24db13",
"index": 2054,
"step-1": "<mask token>\n\n\nclass Resources(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def ... | [
22,
28,
32,
36,
40
] |
<|reserved_special_token_0|>
def createPosts(posts):
conn = sqlite3.connect(dbname)
c = conn.cursor()
for post in posts:
c.execute('INSERT OR REPLACE INTO posts VALUES (?,?,?,?,?,?)', post)
conn.commit()
conn.close()
def readPosts():
conn = sqlite3.connect(dbname)
c = conn.cursor... | flexible | {
"blob_id": "602df213c0d588404597c566001cd9c96b5034d0",
"index": 4530,
"step-1": "<mask token>\n\n\ndef createPosts(posts):\n conn = sqlite3.connect(dbname)\n c = conn.cursor()\n for post in posts:\n c.execute('INSERT OR REPLACE INTO posts VALUES (?,?,?,?,?,?)', post)\n conn.commit()\n conn... | [
3,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mapGraph.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MapGraphTab(object):
def setupUi(self, MapGraphTab):
MapGra... | normal | {
"blob_id": "03a13037a9a102397c8be4d9f0f4c5e150965808",
"index": 8666,
"step-1": "<mask token>\n\n\nclass Ui_MapGraphTab(object):\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass Ui_MapGraphTab(object):\n\n def setupUi(self, MapGraphTab):\n MapGraphTab.setO... | [
1,
2,
3,
4,
5
] |
from django import forms
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
import time
from page.models import Submit, Assignment
class UploadFileForm(forms.ModelForm):
class Meta:
model = Submit
fields = ['email', 'student_no', 'file']
@csrf_exempt
def up... | normal | {
"blob_id": "dabc38db6a5c4d97e18be2edc9d4c6203e264741",
"index": 3849,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass UploadFileForm(forms.ModelForm):\n\n\n class Meta:\n model = Submit\n fields = ['email', 'student_no', 'file']\n\n\n<mask token>\n",
"step-3": "<mask token>\n... | [
0,
1,
2,
3,
4
] |
import json
import decimal
import threading
import websocket
from time import sleep
from supervisor.core.utils.math import to_nearest
def find_item_by_keys(keys, table, match_data):
for item in table:
matched = True
for key in keys:
if item[key] != match_data[key]:
matc... | normal | {
"blob_id": "ea4ec2e605ab6e8734f7631fe298c93467908b5f",
"index": 9582,
"step-1": "<mask token>\n\n\nclass TrailingShell:\n <mask token>\n\n def __init__(self, order, offset: int, tick_size: float, test=True,\n init_ws=True):\n self.tick_size = tick_size\n self.exited = False\n s... | [
14,
15,
16,
18,
25
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class ProjectionKernel(GrassmannianKernel):
<|reserved_special_token_0|>
def element_wise_operation(self, xi_j: Tuple) ->float:
"""
Compute the Projection kernel entry for a tuple of points on the Grassm... | flexible | {
"blob_id": "14ce803e3deb529b489c150c7ecc702118448acb",
"index": 9022,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ProjectionKernel(GrassmannianKernel):\n <mask token>\n\n def element_wise_operation(self, xi_j: Tuple) ->float:\n \"\"\"\n Compute the Projection kernel entr... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class life:
def __init__(self, world):
self.world = world
def get_world_size(self):
xs = [c[0] for c in self.world]
ys = [c[1] for c in self.world]
zs = [c[2] for c in self.world]
return (min(xs), min(ys), min(zs)), (max(xs), max(ys), max(... | flexible | {
"blob_id": "e7060658ae1838b0870b2a3adb61c9f8d78c93c7",
"index": 3245,
"step-1": "<mask token>\n\n\nclass life:\n\n def __init__(self, world):\n self.world = world\n\n def get_world_size(self):\n xs = [c[0] for c in self.world]\n ys = [c[1] for c in self.world]\n zs = [c[2] for ... | [
10,
11,
12,
14,
16
] |
<|reserved_special_token_0|>
class ZoomPanHandler:
<|reserved_special_token_0|>
def __init__(self, axes, scale_factor=2, mouse_button=2):
"""
Default constructor for the ZoomPanHandler class.
Parameters
axes: matplotlib.backend_bases.Axes
The axes to attach this h... | flexible | {
"blob_id": "6afcb8f17f7436f0ae9fa3a8c2a195245a9801f1",
"index": 6533,
"step-1": "<mask token>\n\n\nclass ZoomPanHandler:\n <mask token>\n\n def __init__(self, axes, scale_factor=2, mouse_button=2):\n \"\"\"\n Default constructor for the ZoomPanHandler class.\n\n Parameters\n ax... | [
13,
14,
15,
16,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "ccb6973910dba5897f6a12be23c74a35e848313b",
"index": 4005,
"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 = [('PleniApp', ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def find_components(adjacency_matrix):
visited = set()
components = []
for node in range(len(adjacency_matrix)):
if node not in visited:
component = []
build_component(adjacency_matrix... | flexible | {
"blob_id": "e71a23ef7a065bc4210e55552e19c83c428bc194",
"index": 3187,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef find_components(adjacency_matrix):\n visited = set()\n components = []\n for node in range(len(adjacency_matrix)):\n if node not in visited:\n component... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
nome = str(input('Nome: '))
nota1 = float(input('Nota 1: '))
nota2 = float(input('Nota 2: '))
media = (nota1 + nota2) / 2
alunos.append([nome, [nota1, nota2], media])
pergunta = str(input('Quer ... | flexible | {
"blob_id": "8dcd4914c58a7ecafdfdd70b698ef3b7141386a6",
"index": 2632,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n nome = str(input('Nome: '))\n nota1 = float(input('Nota 1: '))\n nota2 = float(input('Nota 2: '))\n media = (nota1 + nota2) / 2\n alunos.append([nome, [nota1,... | [
0,
1,
2,
3
] |
#alds13c
from collections import deque
d_stack=deque()
res_stack=deque()
s = input()
for i in range(len(s)):
#print(d_stack,res_stack)
if s[i]=="\\":
d_stack.append(i)
elif s[i]=="/":
if len(d_stack)==0:
continue
left = d_stack.pop()
area = i-left
#res_s... | normal | {
"blob_id": "48e3259698788904e000eb15b5443067b0c3e791",
"index": 5968,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(len(s)):\n if s[i] == '\\\\':\n d_stack.append(i)\n elif s[i] == '/':\n if len(d_stack) == 0:\n continue\n left = d_stack.pop()\n ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, uuid, re, sys
from decimal import Decimal
from datetime import date, time, datetime
from functools import lru_cache
from typing import Iterator
import pyodbc, pytest
# WARNING: Wow Microsoft always manages to do the stupidest thing possible always trying to be
# ... | normal | {
"blob_id": "51358ac7d4fc093f8291cfd9f098e3ac3db86cce",
"index": 8282,
"step-1": "<mask token>\n\n\ndef connect(autocommit=False, attrs_before=None):\n return pyodbc.connect(CNXNSTR, autocommit=autocommit, attrs_before=\n attrs_before)\n\n\n<mask token>\n\n\ndef test_nvarchar(cursor: pyodbc.Cursor):\n ... | [
47,
56,
70,
97,
108
] |
import csv
with open('faculty.csv') as facultycsv:
emails = list() #all email addresses
for line in facultycsv:
line = line.split(',')
if line[0] == 'name' : continue
try:
email = line[3].rstrip()
emails.append(email)
except:
continue
with o... | normal | {
"blob_id": "5af5c10c149c7b0e2a969be7895780d26a4294d0",
"index": 7326,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('faculty.csv') as facultycsv:\n emails = list()\n for line in facultycsv:\n line = line.split(',')\n if line[0] == 'name':\n continue\n try... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
format_string = '%s %s %s %s %s %s %s %s %s\n'
while True:
edit = [sys.stdin.readline() for i in range(14)]
if edit[13] == '':
break
revision = edit[0].split(' ')
a... | flexible | {
"blob_id": "f6b2169a4644f4f39bbdebd9bb9c7cc637b54f8b",
"index": 9920,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n format_string = '%s %s %s %s %s %s %s %s %s\\n'\n while True:\n edit = [sys.stdin.readline() for i in range(14)]\n if edit[13] == '':\n br... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class color:
PURPLE = '\x1b[95m'
CYAN = '\x1b[96m'
DARKCYAN = '\x1b[36m'
BLUE = '\x1b[94m'
GREEN = '\x1b[92m'
YELLOW = '\x1b[93m'
RED = '\x1b[91m'
BOLD = '\x1b[1m'
UNDERLINE = '\x1b[4m'
END = '\x1b[0m'
<|reserved_special_token_0|>
def hostIsUp(h... | flexible | {
"blob_id": "2c834c734de8f8740176bb5dbb6b123c49924718",
"index": 1697,
"step-1": "<mask token>\n\n\nclass color:\n PURPLE = '\\x1b[95m'\n CYAN = '\\x1b[96m'\n DARKCYAN = '\\x1b[36m'\n BLUE = '\\x1b[94m'\n GREEN = '\\x1b[92m'\n YELLOW = '\\x1b[93m'\n RED = '\\x1b[91m'\n BOLD = '\\x1b[1m'\n... | [
5,
7,
9,
10,
12
] |
from MyFeistel import MyFeistel, LengthPreservingCipher
import pytest
import base64
import os
class TestMyFeistel:
def test_Functionality(self):
key = base64.urlsafe_b64encode(os.urandom(16))
feistel = MyFeistel(key, 10)
# decrypt(encrypt(msg)) == msg
for i in xrange(20):
... | normal | {
"blob_id": "2464da1c4d2ddab3a053f0a14e3cc9a8beabe031",
"index": 6031,
"step-1": "<mask token>\n\n\nclass TestLengthPreservingCipher:\n\n def test_Functionality(self):\n key = base64.urlsafe_b64encode(os.urandom(16))\n lpc = LengthPreservingCipher(key, 10)\n for i in xrange(20):\n ... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(0, num):
element = float(input())
if i % 2 != 0:
even_sum += element
if element <= even_smallest:
even_smallest = element
if element > even_biggest:
even_bigge... | flexible | {
"blob_id": "69e8601a387d0987fbb6d1da5ac0f9412fffc63d",
"index": 8768,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(0, num):\n element = float(input())\n if i % 2 != 0:\n even_sum += element\n if element <= even_smallest:\n even_smallest = element\n ... | [
0,
1,
2,
3
] |
#
# @lc app=leetcode id=1121 lang=python3
#
# [1121] Divide Array Into Increasing Sequences
#
# https://leetcode.com/problems/divide-array-into-increasing-sequences/description/
#
# algorithms
# Hard (53.30%)
# Likes: 32
# Dislikes: 11
# Total Accepted: 1.7K
# Total Submissions: 3.2K
# Testcase Example: '[1,2,2,... | normal | {
"blob_id": "6b55a9061bb118558e9077c77e18cfc81f3fa034",
"index": 1092,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Solution:\n\n def canDivideIntoSubsequences(self, nums: List[int], K: int) ->bool:\n return len(nu... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def countLetters(self, S: str) ->int:
ans = 0
for _, g in itertools.groupby(S):
cnt = len(list(g))
ans += (1 + cnt) *... | flexible | {
"blob_id": "f9cee552dde5ecf229fda559122b4b0e780c3b88",
"index": 7350,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def countLetters(self, S: str) ->int:\n ans = 0\n for _, g in itertools.groupby(S):\n cnt = len(list(g... | [
0,
1,
2
] |
class String:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class String:
def reverse(self, s):
return s[::-1]
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class String:
def reverse(self, s):
return s[::-1]
<|reserved_specia... | flexible | {
"blob_id": "c27c29a5b4be9f710e4036f7f73a89c7d20acea5",
"index": 4317,
"step-1": "class String:\n <mask token>\n\n\n<mask token>\n",
"step-2": "class String:\n\n def reverse(self, s):\n return s[::-1]\n\n\n<mask token>\n",
"step-3": "class String:\n\n def reverse(self, s):\n return s[:... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(f.read())
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
f = open('1.txt', 'r', encoding='utf-8')
print(f.read())
<|reserved_special_token_0|>
<|reserved_special_token_1|>
'''
py... | flexible | {
"blob_id": "3a65565af4c55fa5479e323a737c48f7f2fdb8ce",
"index": 596,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(f.read())\n<mask token>\n",
"step-3": "<mask token>\nf = open('1.txt', 'r', encoding='utf-8')\nprint(f.read())\n<mask token>\n",
"step-4": "'''\npython open() 函数用于打开一个文件,创建一个 fil... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class MachineClient:
def __init__(self, host, port):
self.host = host
self.port = port
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.db = DataBase(
'C:\\Users\\user\\Documents\\RemoteControl\\Server\\pythonsqlite.db'
... | flexible | {
"blob_id": "ff1bb2634ffec6181a42c80a4b2a19c2c27a8f9f",
"index": 3136,
"step-1": "<mask token>\n\n\nclass MachineClient:\n\n def __init__(self, host, port):\n self.host = host\n self.port = port\n self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self.db = DataBase(\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def broadcast(message):
for client in clients:
client.send(message)
def handle(client):
while True:
try:
message = client.recv(1024)
broadcast(message)
except:
index = client.index(client)
clients.remove(cli... | flexible | {
"blob_id": "f1fbbbe4258d0fb0a43505f4718730934fd595ec",
"index": 1831,
"step-1": "<mask token>\n\n\ndef broadcast(message):\n for client in clients:\n client.send(message)\n\n\ndef handle(client):\n while True:\n try:\n message = client.recv(1024)\n broadcast(message)\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while t:
a = random.randint(1, 10)
if a not in s:
t = False
<|reserved_special_token_0|>
print(s)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s = {(1): 1, (2): 2, (3): 3, (4): 4, (5): 5}
t = True
w... | flexible | {
"blob_id": "b9b113bdc5d06b8a7235333d3b3315b98a450e51",
"index": 6562,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile t:\n a = random.randint(1, 10)\n if a not in s:\n t = False\n<mask token>\nprint(s)\n",
"step-3": "<mask token>\ns = {(1): 1, (2): 2, (3): 3, (4): 4, (5): 5}\nt = Tru... | [
0,
1,
2,
3,
4
] |
import unittest
from reactivex import interval
from reactivex import operators as ops
from reactivex.testing import ReactiveTest, TestScheduler
from reactivex.testing.marbles import marbles_testing
from reactivex.testing.subscription import Subscription
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_co... | normal | {
"blob_id": "03dd37346ed12bbd66cbebc46fadc37be319b986",
"index": 548,
"step-1": "<mask token>\n\n\nclass TestSwitchMapIndex(unittest.TestCase):\n\n def test_switch_map_indexed_uses_index(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, 'a'), on_next(400,\n... | [
5,
7,
8,
9,
10
] |
'''
# VariableScope.py
#
# Written by leezhm on 13th March, 2012.
#
# Copyright (C) leezhm(c)126.com. All Right Reserved.
#
# For Chapter 6 Dragon Realm
#
# <<Invent Your Own Computer Games with Python>>
'''
print('Why not ?')
print(True and not False)
# A global variable named "spam"
spam = 1208
# This b... | normal | {
"blob_id": "6af5faaaa9d894dd2b882cfe1bb8b8225780743c",
"index": 630,
"step-1": "<mask token>\n\n\ndef funky():\n spam = 302\n print(spam)\n\n\n<mask token>\n\n\ndef sayHello(name):\n print('Hello, ' + name)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef funky():\n spam = 302\n print(spa... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class ModelFetcher(object):
<|reserved_special_token_0|>
def train_data(self):
rng_state = np.random.get_state()
np.random.shuffle(self._train_data)
np.random.set_state(rng_state)
np.random.shuffle(self._train_label)
return self.next_train_... | flexible | {
"blob_id": "855bfc9420a5d5031cc673231cc7993ac67df076",
"index": 5515,
"step-1": "<mask token>\n\n\nclass ModelFetcher(object):\n <mask token>\n\n def train_data(self):\n rng_state = np.random.get_state()\n np.random.shuffle(self._train_data)\n np.random.set_state(rng_state)\n n... | [
3,
6,
8,
10,
11
] |
from django.db import models
import eav
from django.utils import timezone
class RiskType(models.Model):
"""A model class used for storing data
about risk types
"""
name = models.CharField(max_length=255)
created = models.DateTimeField(default=timezone.now)
modified = models.DateTimeField(auto_... | normal | {
"blob_id": "635b75bc12718bccdfb9d04a54476c93fa4685ce",
"index": 4661,
"step-1": "<mask token>\n\n\nclass RiskType(models.Model):\n <mask token>\n name = models.CharField(max_length=255)\n created = models.DateTimeField(default=timezone.now)\n modified = models.DateTimeField(auto_now=True)\n\n\n c... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = patterns('', url('^$', DomainListView.as_view()), url(
'^admin/', include(admin.site.urls)), url('^domains/', include(
'metainfo.urls', namespace='domains')))
<|reserved_special_token_1|>
from django.conf.... | flexible | {
"blob_id": "1599f5e49ec645b6d448e74719e240343077aedd",
"index": 5464,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = patterns('', url('^$', DomainListView.as_view()), url(\n '^admin/', include(admin.site.urls)), url('^domains/', include(\n 'metainfo.urls', namespace='domains')))\n",
... | [
0,
1,
2,
3
] |
# app/__init__.py
import json
from flask_api import FlaskAPI, status
import graphene
from graphene import relay
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import func
from flask import request, jsonify, abort, make_response
fr... | normal | {
"blob_id": "2f76bcfde11597f87bb9e058f7617e95c78ed383",
"index": 7950,
"step-1": "<mask token>\n\n\nclass Department(SQLAlchemyObjectType):\n\n\n class Meta:\n model = DepartmentModel\n interfaces = relay.Node,\n\n\nclass Query(graphene.ObjectType):\n node = relay.Node.Field()\n all_employ... | [
3,
4,
5,
6,
7
] |
from django.urls import path,include
from Income import views
urlpatterns = [
path('IncomeHome/',views.IncomeHome,name='IncomeHome'),
path('IncomeCreate/',views.IncomeCreate.as_view(),name='IncomeCreate'),
path('IncomeUpdate/<int:pk>',views.IncomeUpdate.as_view(),name='IncomeUpdate'),
path('IncomeDel... | normal | {
"blob_id": "ad3a7221883a847fc9d26097c3801973cbbda38e",
"index": 355,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('IncomeHome/', views.IncomeHome, name='IncomeHome'),\n path('IncomeCreate/', views.IncomeCreate.as_view(), name='IncomeCreate'\n ), path('IncomeUpdate/<int:pk>', ... | [
0,
1,
2,
3
] |
from numpy import sqrt
def Schout2ConTank(a, b, d):
# This function converts parameters from Schoutens notation to Cont-Tankov
# notation
## Code
th = d * b / sqrt(a ** 2 - b ** 2)
k = 1 / (d * sqrt(a ** 2 - b ** 2))
s = sqrt(d / sqrt(a ** 2 - b ** 2))
return th, k, s
| normal | {
"blob_id": "4dda122a8c3a2aab62bb202945f6fb9cb73cf772",
"index": 8330,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef Schout2ConTank(a, b, d):\n th = d * b / sqrt(a ** 2 - b ** 2)\n k = 1 / (d * sqrt(a ** 2 - b ** 2))\n s = sqrt(d / sqrt(a ** 2 - b ** 2))\n return th, k, s\n",
"step... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
plt.style.use('seaborn')
def animate(i):
data = pd.read_csv('data.csv')
global x_vals
global counter
x_vals.append(counter)
try:
x = data.iloc[x_vals, 0]
y = data.iloc[x_vals, 1]
if co... | flexible | {
"blob_id": "239f055fd76a3ecb5f384c256ad850ea42739b8f",
"index": 9710,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.style.use('seaborn')\n\n\ndef animate(i):\n data = pd.read_csv('data.csv')\n global x_vals\n global counter\n x_vals.append(counter)\n try:\n x = data.iloc[x_val... | [
0,
2,
3,
4,
5
] |
#!/usr/bin/env python3
import sql_manager
import Client
from getpass import getpass
from settings import EXIT_CMD
def main_menu():
print("""Welcome to our bank service. You are not logged in.
Please register or login""")
while True:
command = input("guest@hackabank$ ")
if command =... | normal | {
"blob_id": "ee4fd4aef7ecdfbc8ff53028fdedc558814f46a7",
"index": 2383,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef logged_menu(logged_user):\n print('Welcome you are logged in as: ' + logged_user.get_username())\n while True:\n command = input('{}@hackabank# '.format(logged_user.g... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
text += '\nHostname: ' + os.uname().nodename
emailgen.sendAlert(recipient, subject, text, sender, password)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
recipient = input('recipient: ')
sender = input('sender: ')
p... | flexible | {
"blob_id": "26a6fe0b2a98aa77b63a336cd6c2afcfe81d9058",
"index": 7680,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntext += '\\nHostname: ' + os.uname().nodename\nemailgen.sendAlert(recipient, subject, text, sender, password)\n",
"step-3": "<mask token>\nrecipient = input('recipient: ')\nsender = inp... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2017, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | normal | {
"blob_id": "6fdfcbcfdf2b680a1fbdb74f77fd5d1a9f7eac0b",
"index": 6105,
"step-1": "<mask token>\n\n\nclass VolttronWebRPC(object):\n\n def __init__(self, url, username='admin', password='admin'):\n \"\"\"\n :param url: Jsonrpc endpoint for posting data.\n :param username:\n :param p... | [
11,
12,
14,
15,
18
] |
import os
import time
import uuid
import subprocess
# Global variables. ADJUST THEM TO YOUR NEEDS
chia_executable = os.path.expanduser('~')+"/chia-blockchain/venv/bin/chia" # directory of chia binary file
numberOfLogicalCores = 16 # number of logical cores that you want to use overall
run_loop_interval = 10 # seconds ... | normal | {
"blob_id": "bc536440a8982d2d4a1bc5809c0d9bab5ac6553a",
"index": 2313,
"step-1": "<mask token>\n\n\ndef fetch_logs():\n item_in_location_list = os.listdir(logs_location)\n content_path_list = list(map(lambda log: logs_location + log,\n item_in_location_list))\n text_file_list = list(filter(lambda... | [
4,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [url('^$', TemplateView.as_view(template_name=
'visitor/landing-index.html'), name='landing_index'), url('^about$',
TemplateView.as_view(template_name='visitor/landing-about.html'), name=
'landing_about')... | flexible | {
"blob_id": "312a95c9514722157653365104d8cd0ada760ce8",
"index": 8084,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^$', TemplateView.as_view(template_name=\n 'visitor/landing-index.html'), name='landing_index'), url('^about$',\n TemplateView.as_view(template_name='visitor/lan... | [
0,
1,
2,
3
] |
import logging
loggers = {}
def create_logger(
log_level:str ='INFO',
log_name:str = 'logfile',
export_log: bool = True,
save_dir:str = ''):
if log_name in loggers.keys():
logger = loggers.get(log_name)
else:
# create logger
logger = logging.getLogger(log_name)
... | normal | {
"blob_id": "3146775c466368c25c92bd6074abb97408533500",
"index": 2956,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef create_logger(log_level: str='INFO', log_name: str='logfile',\n export_log: bool=True, save_dir: str=''):\n if log_name in loggers.keys():\n logger = loggers.get(log_... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from app.routes import home
from .home import bp as home
from .dashboard import bp as dashboard
| flexible | {
"blob_id": "358a4948ac1f60e0966328cebf401777042c3d0e",
"index": 5239,
"step-1": "<mask token>\n",
"step-2": "from app.routes import home\nfrom .home import bp as home\nfrom .dashboard import bp as dashboard\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
if(n % 4 != 0):
return True;
return False;
"""main():
sol = Solution();
sol.canWinNim(4);
"""
| normal | {
"blob_id": "9a539fd3ce4e3ff75af82407150ab4b550b255c1",
"index": 3284,
"step-1": "class Solution(object):\n def canWinNim(self, n):\n \"\"\"\n :type n: int\n :rtype: bool\n \"\"\"\n\tif(n % 4 != 0):\n\t\treturn True;\n\treturn False;\n\"\"\"main():\n\tsol = Solution();\n\tsol.canWi... | [
0
] |
from plprofiler_tool import main
from plprofiler import plprofiler
| normal | {
"blob_id": "6b616f5ee0a301b76ad3f7284b47f225a694d33c",
"index": 1281,
"step-1": "<mask token>\n",
"step-2": "from plprofiler_tool import main\nfrom plprofiler import plprofiler\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
#-*- coding:utf-8 -*-
"""
Django settings for hehotel project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.... | normal | {
"blob_id": "045ad27f46c2090ed39a49144c3aa17093b0d9c7",
"index": 7094,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nBASE_DIR = os.path.dirname(__file__)\nSECRET_KEY = '6@j!6%foulnrume$wc7i5cwc2ppf6hcxoa&xh_vtanfy_rc@yc'\nDEBUG = True\nEXCEPTION_INGORE_AJAX = True\nTEMPLATE_DEBUG = True\nTEMPLATE_DIRS =... | [
0,
1,
2,
3
] |
from mrjob.job import MRJob
from mrjob.step import MRStep
from collections import Counter
import csv
def read_csvLine(line):
# Given a comma delimited string, return fields
for row in csv.reader([line]):
return row
class MRTopVisitorCount(MRJob):
# Mapper1: emit page_id, 1
def mapper_coun... | normal | {
"blob_id": "471ce1eeb3293a424de74e25f36b76699a97ec2b",
"index": 7039,
"step-1": "<mask token>\n\n\nclass MRTopVisitorCount(MRJob):\n <mask token>\n <mask token>\n\n def mapper_sort(self, page, counts):\n top = Counter(counts).most_common(1)\n yield page, (top[0][0], top[0][1])\n\n def ... | [
3,
6,
7,
8,
10
] |
import cv2
import matplotlib.pyplot as plt
import numpy as np
ball = plt.imread('ball.png')
albedo = plt.imread('ball_albedo.png')
shading = cv2.cvtColor(plt.imread('ball_shading.png'), cv2.COLOR_GRAY2RGB)
x,y,z = np.where(albedo != 0)
print('Albedo:', albedo[x[0],y[0]])
print("Albedo in RGB space:", albedo[x[0],y[0]... | normal | {
"blob_id": "cc6f70e328b774972e272e9600274dfd9fca93ee",
"index": 3073,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Albedo:', albedo[x[0], y[0]])\nprint('Albedo in RGB space:', albedo[x[0], y[0]] * 255)\n<mask token>\nplt.subplot(1, 2, 1)\nplt.imshow(ball)\nplt.subplot(1, 2, 2)\nplt.imshow(albed... | [
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.