code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import numpy as np
import pandas as pd
def fetch_data(faultNumber, position):
df1 = pd.read_csv("./data/TEP_CaseStudy_Fault_" + str(faultNumber) + "_Pos_" + str(position) + "%.csv")
df1.set_index(df1.columns[0])
df1 = df1.drop(columns=[df1.columns[0]])
df2 = pd.read_csv("./data/TEP_CaseStudy_Fault_" ... | normal | {
"blob_id": "d71ec86f68cc81c93a39f15c785c75c2a1023f14",
"index": 2129,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fetch_data(faultNumber, position):\n df1 = pd.read_csv('./data/TEP_CaseStudy_Fault_' + str(faultNumber) +\n '_Pos_' + str(position) + '%.csv')\n df1.set_index(df1.col... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindo... | normal | {
"blob_id": "2d503c93160b6f44fba2495f0ae0cf9ba0eaf9d6",
"index": 8930,
"step-1": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n\n def retranslateUi(self, MainWindow):\n _translate = ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Sprite:
def __init__(self, name: str, index: str, xCoord: int, yCoord: int,
heading: int, scale: float, volume: int, pan: int, rotation: int,
draggable: bool, hidden: bool, costumes: str, color: (float, float,
float), pen: str, id: int):
self.nam... | flexible | {
"blob_id": "575768c200ad81f878c132d68569c84f497091f2",
"index": 8137,
"step-1": "<mask token>\n\n\nclass Sprite:\n\n def __init__(self, name: str, index: str, xCoord: int, yCoord: int,\n heading: int, scale: float, volume: int, pan: int, rotation: int,\n draggable: bool, hidden: bool, costumes:... | [
2,
3,
4,
5
] |
<|reserved_special_token_0|>
@unittest.skipIf(sys.platform.startswith('win'),
'subprocess complications on Windows')
class TestSharedModules(unittest.TestCase):
def setUp(self):
pass
def test_shared_modules(self):
jep_pipe(build_java_process_cmd('jep.test.TestSharedModules'))
<|reser... | flexible | {
"blob_id": "39bc90f34cccebe9a8b1475e396caa1c14f6b2df",
"index": 9004,
"step-1": "<mask token>\n\n\n@unittest.skipIf(sys.platform.startswith('win'),\n 'subprocess complications on Windows')\nclass TestSharedModules(unittest.TestCase):\n\n def setUp(self):\n pass\n\n def test_shared_modules(self):... | [
3,
4,
5,
6,
7
] |
# Generated by Django 3.2.7 on 2021-09-11 19:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cryptocurrency', '0012_rename_cancel_exists_order_cancel_exist'),
]
operations = [
migrations.AlterField(
model_name='order',
... | normal | {
"blob_id": "de347b41cd88947690cb42e043880a80d81e2c5c",
"index": 436,
"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 = [('cryptocurren... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestTransliteratePackage(unittest.TestCase):
<|reserved_special_token_0|>
def test_romanize_royin_basic(self):
for word in _BASIC_TESTS:
expect = _BASIC_TESTS[word]
self.assertEqual(romanize(word, engine='royin'), expect)
def test_romani... | flexible | {
"blob_id": "486cfc4bb4b46d78715b11cba44656e8ba077c9b",
"index": 2551,
"step-1": "<mask token>\n\n\nclass TestTransliteratePackage(unittest.TestCase):\n <mask token>\n\n def test_romanize_royin_basic(self):\n for word in _BASIC_TESTS:\n expect = _BASIC_TESTS[word]\n self.assert... | [
6,
8,
10,
11,
12
] |
import sys
from random import randint
if len(sys.argv) != 2:
print "Usage: generate.py <number of orders>"
sys.exit(1)
n = int(sys.argv[1])
for i in range(0, n):
action = 'A'
orderid = i + 1
side = 'S' if (randint(0,1) == 0) else 'B'
quantity = randint(1,100)
price = randint(100,200)
... | normal | {
"blob_id": "6267c999d3cec051c33cbcde225ff7acaa6bff74",
"index": 5383,
"step-1": "import sys\nfrom random import randint\n\nif len(sys.argv) != 2:\n print \"Usage: generate.py <number of orders>\"\n sys.exit(1)\n\nn = int(sys.argv[1])\n\nfor i in range(0, n):\n action = 'A'\n orderid = i + 1\n sid... | [
0
] |
<|reserved_special_token_0|>
class Baidu:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, count):
cfg = ConfigParser.ConfigParser()
cfg.read('config/setting.conf')
self.baidu_page_size = int(cfg.get('search', 'baidu_page_size'))
self.savefile =... | flexible | {
"blob_id": "b724b04c6303cc9021539ad7df5a198000491029",
"index": 5436,
"step-1": "<mask token>\n\n\nclass Baidu:\n <mask token>\n <mask token>\n\n def __init__(self, count):\n cfg = ConfigParser.ConfigParser()\n cfg.read('config/setting.conf')\n self.baidu_page_size = int(cfg.get('s... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def with_metaclass(meta, *bases):
class metaclass(meta):
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, 'temporary_class', (), {})
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if PY2:
tex... | flexible | {
"blob_id": "414cb9a173ac70ad9ad1fc540aec569321fd3f8b",
"index": 9477,
"step-1": "<mask token>\n\n\ndef with_metaclass(meta, *bases):\n\n\n class metaclass(meta):\n\n def __new__(cls, name, this_bases, d):\n return meta(name, bases, d)\n return type.__new__(metaclass, 'temporary_class', (... | [
1,
2,
3,
4,
5
] |
# Imports
import os
import time
import math
import random
from lib import *
def MT19937_keystream_generator(seed: int) -> bytes:
"""
Generate keystream for MT19937
"""
# Verify that the seed is atmost 16 bit long.
assert math.log2(seed) <= 16
prng = MT19937(seed)
while True:
nu... | normal | {
"blob_id": "66b7d928bc2c98a12f7adb8a375ced21edce8333",
"index": 8492,
"step-1": "<mask token>\n\n\ndef main():\n plaintext = 'Hello World!'\n string = b''\n for _ in range(random.randint(0, 10)):\n i = random.randint(33, 126)\n string += chr(i).encode()\n string += plaintext.encode()\n... | [
1,
3,
4,
5,
6
] |
#!/usr/bin/python
debug = 0
if debug == 1:
limit = [8,20]
n = 3
p = [[2,10],[10,12],[8,30],[1,5]]
#n = 1
# p = [[8,30]]
print limit
print n
print p
def isIn(arr):
if arr[0] > limit[1] or arr[1] < limit[0] or \
arr[1] == 0:
return False
else:
return True
... | normal | {
"blob_id": "c8d27965df83eb3e673b3857ee700a8474826335",
"index": 3895,
"step-1": "#!/usr/bin/python\n\n\ndebug = 0\n\nif debug == 1:\n limit = [8,20]\n n = 3\n p = [[2,10],[10,12],[8,30],[1,5]]\n #n = 1\n # p = [[8,30]] \n print limit\n print n\n print p\n\ndef isIn(arr):\n\n if arr[0]... | [
0
] |
strings = ['(())())', '(((()())()', '(()())((()))', '((()()(()))(((())))()', '()()()()(()()())()', '(()((())()(']
#print(string[0])
'''
for i in string:
testlist = []
for j in string[i]:
if j == ')':
if
'''
def isVPS(phrase):
testlist = []
for char in phrase:
if char == '(... | normal | {
"blob_id": "d9f055301f050eea4281ce418974546c1245ac7e",
"index": 4621,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef isVPS(phrase):\n testlist = []\n for char in phrase:\n if char == '(':\n testlist.append(char)\n elif len(testlist) == 0:\n return 'NO'\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def home(request):
blogs = Blog.objects
return render(request, 'home.html', {'blogs': blogs})
def detail(request, blog_id):
blog_detail = get_object_or_404(Blog, pk=blog_id)
return render(request, 'detail.html', {'blog': blog_detail})
<|reserved_special_token_0|>
def... | flexible | {
"blob_id": "bc25338612f525f616fb26c64d8b36667d297d40",
"index": 3921,
"step-1": "<mask token>\n\n\ndef home(request):\n blogs = Blog.objects\n return render(request, 'home.html', {'blogs': blogs})\n\n\ndef detail(request, blog_id):\n blog_detail = get_object_or_404(Blog, pk=blog_id)\n return render(... | [
3,
4,
5,
6,
7
] |
from getMerriamWebster import searchMerriamWebster
from searchWikipedia import searchWikipedia
from synonyms import searchSynonyms
class Scraping:
def __init__(self, clues, answers, gridIndex):
self.clues = clues
self.domains = {"across": {}, "down":{}}
self.answers = answers
self.g... | normal | {
"blob_id": "138abb40fda0f19b4a74a294d5cd0dd326dc59ce",
"index": 7722,
"step-1": "<mask token>\n\n\nclass Scraping:\n\n def __init__(self, clues, answers, gridIndex):\n self.clues = clues\n self.domains = {'across': {}, 'down': {}}\n self.answers = answers\n self.gridIndex = gridIn... | [
4,
6,
9,
11,
12
] |
<|reserved_special_token_0|>
class illumination(object):
<|reserved_special_token_0|>
class darkfield(object):
def __init__(self, basePath, darkframePath=None, flip_image_across_axis
=None, show_image=False, save_image=False, save_img_type='.tif',
savePath=None, savename=None, save_plot=Fal... | flexible | {
"blob_id": "6ca7b896cc20220f790c06d4ba08fef7bda8400f",
"index": 3301,
"step-1": "<mask token>\n\n\nclass illumination(object):\n <mask token>\n\n\nclass darkfield(object):\n\n def __init__(self, basePath, darkframePath=None, flip_image_across_axis\n =None, show_image=False, save_image=False, save_i... | [
37,
41,
45,
48,
50
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
a.sort()
<|reserved_special_token_0|>
for l, h in a:
if h0 < h:
s += (l - l0) * h0
l0, h0 = l, h
<|reserved_special_token_0|>
for l, h in a[::-1]:
if h > h1:
s += (l1 - l) * h1
l1, h1 = l, h... | flexible | {
"blob_id": "62dab85b7ab5fdae8117827b2f56bccf99615cb7",
"index": 7341,
"step-1": "<mask token>\n",
"step-2": "<mask token>\na.sort()\n<mask token>\nfor l, h in a:\n if h0 < h:\n s += (l - l0) * h0\n l0, h0 = l, h\n<mask token>\nfor l, h in a[::-1]:\n if h > h1:\n s += (l1 - l) * h1\n... | [
0,
1,
2,
3
] |
import xl2dict
myxlobject= XlToDict()
myxlobject.convert_sheet_to_dict(file_path="Soul Breaks.xlsx", sheet="First Sheet",
filter_variables_dict={"User Type" : "Admin", "Environment" : "Dev"}) | normal | {
"blob_id": "8ec981bf8746e09d3865bc20dcfbf2fbd797c145",
"index": 7511,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmyxlobject.convert_sheet_to_dict(file_path='Soul Breaks.xlsx', sheet=\n 'First Sheet', filter_variables_dict={'User Type': 'Admin',\n 'Environment': 'Dev'})\n",
"step-3": "<mask t... | [
0,
1,
2,
3,
4
] |
## Import modules
import matplotlib, sys, datetime, time
matplotlib.use('TkAgg')
from math import *
from numpy import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from matplotlib import dates
import matplotlib.pyplot as plt
from Tkinter ... | normal | {
"blob_id": "2de12085ddc73fed85dda8ce3d6908b42fdc4bcc",
"index": 3046,
"step-1": "<mask token>\n\n\ndef show_humidity():\n a.clear()\n a.plot(fds, humidity, 'b.--')\n a.set_ylabel('Humidity %', color='b')\n a.xaxis.set_major_formatter(hfmt)\n a.grid(color='blue')\n for tick in a.xaxis.get_major... | [
2,
3,
5,
6,
7
] |
"""Exercise 7.2. Encapsulate this loop in a function called square_root that takes a as a parameter,
chooses a reasonable value of x, and returns an estimate of the square root of a."""
def my_square_root(a,x) :
e = 0.0001
while True :
y=(x+a/x)/2
if abs(y-x) < e :
return y
... | normal | {
"blob_id": "c9f4ae94dc901d34a3c0fb4371c8d35a7fe94507",
"index": 5095,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef my_square_root(a, x):\n e = 0.0001\n while True:\n y = (x + a / x) / 2\n if abs(y - x) < e:\n return y\n break\n x = y\n\n\n<mask ... | [
0,
1,
2,
3,
4
] |
"""
Base cache mechanism
"""
import time
import string
import codecs
import pickle
from functools import wraps
from abc import ABCMeta, abstractmethod
from asyncio import iscoroutinefunction
class BaseCache(metaclass=ABCMeta):
"""Base cache class."""
@abstractmethod
def __init__(self, kvstore, makekey, li... | normal | {
"blob_id": "e810cde7f77d36c6a43f8c277b66d038b143aae6",
"index": 6746,
"step-1": "<mask token>\n\n\nclass BaseCache(metaclass=ABCMeta):\n <mask token>\n\n @abstractmethod\n def __init__(self, kvstore, makekey, lifetime, fail_silent):\n self._kvstore = kvstore\n self._makekey = makekey\n ... | [
3,
4,
5,
6,
7
] |
import chars2vec
import sklearn.decomposition
import matplotlib.pyplot as plt
import csv
# Load Inutition Engineering pretrained model
# Models names: 'eng_50', 'eng_100', 'eng_150' 'eng_200', 'eng_300'
from sklearn.cluster import KMeans
c2v_model = chars2vec.load_model('eng_50')
words=[]
etichette=[]
with open('da... | normal | {
"blob_id": "084579152a2cc7feb2c31e0209ce1e32f4905d81",
"index": 5316,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('datasetParsing2DEF.csv') as csv_file:\n csv_reader = csv.reader(csv_file, delimiter=',')\n line_count = 0\n for row in csv_reader:\n if line_count == 0:\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('total ball:', a * 6)
<|reserved_special_token_0|>
print("computer's run:", comp_runs)
<|reserved_special_token_0|>
print('runs need to win:', comp_runs)
<|reserved_special_token_0|>
print("""--------------------------------... | flexible | {
"blob_id": "00312f57e8a78444937f46cecb62a2b684b4fc91",
"index": 8779,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('total ball:', a * 6)\n<mask token>\nprint(\"computer's run:\", comp_runs)\n<mask token>\nprint('runs need to win:', comp_runs)\n<mask token>\nprint(\"\"\"--------------------------... | [
0,
1,
2,
3,
4
] |
from distributions.zero_inflated_poisson import ZeroInflatedPoisson
from distributions.negative_binomial import NegativeBinomial
from distributions.zero_inflated_negative_binomial import ZeroInflatedNegativeBinomial
from distributions.zero_inflated import ZeroInflated
from distributions.categorized import Categorized
f... | normal | {
"blob_id": "dfae1007adc557a15d03b78f2bf790fb5b06141a",
"index": 4442,
"step-1": "<mask token>\n",
"step-2": "from distributions.zero_inflated_poisson import ZeroInflatedPoisson\nfrom distributions.negative_binomial import NegativeBinomial\nfrom distributions.zero_inflated_negative_binomial import ZeroInflated... | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def longestConsecutive(self, num):
sted = {}
n = len(num)
for item in num:
if item in sted:
continue
... | flexible | {
"blob_id": "d7c4bee7245dab1cbb90ee68b8e99994ce7dd219",
"index": 3295,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def longestConsecutive(self, num):\n sted = {}\n n = len(num)\n for item in num:\n if item in s... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):
<|reserved_special... | flexible | {
"blob_id": "f7c6990b4ddbe5ef9d79ef2326e60cdf1f761db3",
"index": 4542,
"step-1": "<mask token>\n\n\nclass Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Test_Ranges_Case(unittest.TestCase, mixins.CategoricalMixins):\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "9dfbf14a2005aad87be82e5e482c6b0347f32f2c",
"index": 8007,
"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 = [('settings', ... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from math import acos, pi, sqrt
from decimal import Decimal, getcontext
getcontext().prec = 30
class Vector(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, coordinates):
try:
if not coordinates:
raise ValueError
self.coordin... | normal | {
"blob_id": "1253e052865860a6895f91204a70152745b04652",
"index": 8498,
"step-1": "<mask token>\n\n\nclass Vector(object):\n <mask token>\n\n def __init__(self, coordinates):\n try:\n if not coordinates:\n raise ValueError\n self.coordinates = tuple([Decimal(x) fo... | [
15,
17,
23,
27,
29
] |
#! /usr/bin/env python3
"""Publishes joint trajectory to move robot to given pose"""
import rospy
from trajectory_msgs.msg import JointTrajectory
from trajectory_msgs.msg import JointTrajectoryPoint
from std_srvs.srv import Empty
import argparse
import time
def argumentParser(argument):
""" Argument parser """
pa... | normal | {
"blob_id": "ee7c63f36b4720566389826680b90c6f68de85b2",
"index": 5200,
"step-1": "<mask token>\n\n\ndef moveFingers(jointcmds, prefix, nbJoints):\n topic_name = '/' + prefix + '/effort_finger_trajectory_controller/command'\n pub = rospy.Publisher(topic_name, JointTrajectory, queue_size=1)\n jointCmd = J... | [
1,
2,
4,
5,
6
] |
'''
This file creates the model of Post, which maps to the post table in the mysql database.
The model Provider contains four attributes: author, title, content, and created time.
'''
from django.db import models
class Post(models.Model):
'''
The education post by provider database model
'''
author ... | normal | {
"blob_id": "4fa9c00a07c8263a6a3afd460b84f21637a771ec",
"index": 3081,
"step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return '{}'.format(self.title)\n",
"step-2": "<mask token>\n... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def checkSides():
rightC, frontC, leftC = True, True, True
drivetrain.turn_for(RIGHT, 90, DEGREES)
if front_eye.near_object() and distance.get_distance(MM) < 3000:
rightC = False
drivetrain.turn_for(LEFT, 90, DEGREES)
if front_eye.near_object() and distance.get... | flexible | {
"blob_id": "e560f2f202e477822729d1361b8d7ef7831a00e6",
"index": 8339,
"step-1": "<mask token>\n\n\ndef checkSides():\n rightC, frontC, leftC = True, True, True\n drivetrain.turn_for(RIGHT, 90, DEGREES)\n if front_eye.near_object() and distance.get_distance(MM) < 3000:\n rightC = False\n drive... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Start simulation!')
<|reserved_special_token_0|>
if os.path.exists(figurefolderName):
shutil.rmtree(figurefolderName)
os.makedirs(figurefolderName)
<|reserved_special_token_0|>
print('Common parameters were set.')
<|res... | flexible | {
"blob_id": "ad1aa69f92f104ac8b82aca3c0a64ce3de48b36d",
"index": 3847,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Start simulation!')\n<mask token>\nif os.path.exists(figurefolderName):\n shutil.rmtree(figurefolderName)\nos.makedirs(figurefolderName)\n<mask token>\nprint('Common parameters ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'trees'
urlpatterns = [path('list/', TreeListView.as_view(), name='list'), path(
'create/', TreeCreateView.as_view(), name='create'), path(
'<int:pk>/update/', TreeCreateView.as_view(), name='update')]
<|reser... | flexible | {
"blob_id": "0c1de2c1eb5a4de7aeb14ad6b27aa61e07bc4c51",
"index": 602,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'trees'\nurlpatterns = [path('list/', TreeListView.as_view(), name='list'), path(\n 'create/', TreeCreateView.as_view(), name='create'), path(\n '<int:pk>/update/', TreeCr... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def test_get_from_hell():
try:
url = (
'http://127.0.0.1:5000/api/lahman2017/people?children=appearances%2Cbatting&people.nameLast=Williams&batting.yearID=1960&appearances.yearID=1960&fields=people.playerID%2Cpeople.nameLast%2Cpeople.nameFirst%2Cbatting.AB%2Cbattin... | flexible | {
"blob_id": "31761b9469cc579c209e070fbe7b71943404a1ff",
"index": 3992,
"step-1": "<mask token>\n\n\ndef test_get_from_hell():\n try:\n url = (\n 'http://127.0.0.1:5000/api/lahman2017/people?children=appearances%2Cbatting&people.nameLast=Williams&batting.yearID=1960&appearances.yearID=1960&fi... | [
1,
2,
3,
4,
5
] |
from math import *
def eval_loop():
line = input('Please enter a sting')
while True:
if line == 'done':
break
else:
output = eval(line)
print(output)
line = input('Please enter a sting')
eval_loop()
| normal | {
"blob_id": "b0062dde448c450131f578a2afe130ca663f0902",
"index": 2041,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef eval_loop():\n line = input('Please enter a sting')\n while True:\n if line == 'done':\n break\n else:\n output = eval(line)\n ... | [
0,
1,
2,
3
] |
def tort(n, a, b):
return min(n * a, b)
def main():
n, a, b = map(int, input().split())
print(tort(n, a, b))
if __name__ == '__main__':
main()
| normal | {
"blob_id": "7c06bd52c924d3e401f50625109c5b8b489df157",
"index": 7434,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n n, a, b = map(int, input().split())\n print(tort(n, a, b))\n\n\n<mask token>\n",
"step-3": "def tort(n, a, b):\n return min(n * a, b)\n\n\ndef main():\n n,... | [
0,
1,
2,
3
] |
import argparse, os, joblib, json, torch
import pandas as pd
from utils import regression, dataset, lstm
PREDICT_X_SKIP_COLS = ["date", "weight", "ts_id", "resp", "resp_1", "resp_2", "resp_3", "resp_4"]
X_COLS = ["resp_1", "resp_2", "resp_3", "resp_4"]
Y_OUTPUT_COLS = ["date", "ts_id"]
Y_COL = ["resp"]
METRICS_INFO = ... | normal | {
"blob_id": "4bdff51a4e277889f4d54d4ace7a0f5384e74f1e",
"index": 9017,
"step-1": "<mask token>\n\n\ndef get_prediction_data(data, model_path):\n x = data.drop(PREDICT_X_SKIP_COLS, axis=1)\n y = data[X_COLS]\n model = joblib.load(model_path)\n y_pred, metrics = regression.evaluate(model, x, y, METRICS... | [
6,
7,
8,
9,
10
] |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmagic.registry import MODELS
def test_colorization_net():
model_cfg = dict(
type='ColorizationNet', input_nc=4, output_nc=2, norm_type='batch')
# build model
model = MODELS.build(model_cfg)
# test attributes
assert mode... | normal | {
"blob_id": "94be205e516c1f1248b6028419c04c927236596e",
"index": 618,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_colorization_net():\n model_cfg = dict(type='ColorizationNet', input_nc=4, output_nc=2,\n norm_type='batch')\n model = MODELS.build(model_cfg)\n assert model._... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
q.append((1, 0, 0))
while q:
e, clip, t = q.popleft()
if e == s:
print(t)
exit(0)
if 0 < e < 1001:
if visited[e][e] is False:
visited[e][e] = True
q.append((e, e, t + 1))... | flexible | {
"blob_id": "0c14a6fa8b25e1791a6eb9c71290db8bb316819a",
"index": 5684,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nq.append((1, 0, 0))\nwhile q:\n e, clip, t = q.popleft()\n if e == s:\n print(t)\n exit(0)\n if 0 < e < 1001:\n if visited[e][e] is False:\n visit... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MemberClient(models.Model):
<|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_special_token_0|>
class MemberClient(models.M... | flexible | {
"blob_id": "b419e26cbf5bbb746f897367ddaa829773a6860c",
"index": 7742,
"step-1": "<mask token>\n\n\nclass MemberClient(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MemberClient(models.Model):\n <mask token>\n ... | [
1,
2,
3,
4,
5
] |
#!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
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. Redistributions of source code must retain th... | normal | {
"blob_id": "f4ae34be2be2b47b3394e6da751c53c51a1c3174",
"index": 6678,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n fieldnames = None\n field_max_width = dict()\n result = {'headers': [], 'details': []}\n is_header = True\n tidpid = dict()\n for line in su... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from datetime import datetime
try:
from unittest.mock import patch
except ImportError:
from mock import patch
import pytest
from django.test import TestCase
try:
from django.test import override_settings
except ImportError:
... | normal | {
"blob_id": "71f9d9d7973809654db3ea613073f2d431f2d65f",
"index": 1510,
"step-1": "<mask token>\n\n\n@override_settings(USE_TZ=False)\nclass TestEmailUserManager(TestCase):\n\n def setUp(self):\n self.email = 'user@example.com'\n self.password = 'default'\n\n def test_private_create_user_witho... | [
7,
9,
10,
11,
12
] |
import pandas
from sklearn.externals import joblib
import TrainTestProcesser
from sklearn.ensemble import RandomForestClassifier
from Select_OF_File import get_subdir
import matplotlib.pyplot as mp
import sklearn.model_selection as ms
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classificati... | normal | {
"blob_id": "b0bc55ab05d49605e2f42ea036f8405727c468d2",
"index": 3504,
"step-1": "<mask token>\n\n\ndef main():\n data_set = pandas.read_csv('dataset.csv', index_col=False, encoding='gbk')\n print('数据集的shape:', data_set.shape)\n dnumpy_x, dnumpy_y = TrainTestProcesser.split_dframe_x_y(data_set)\n fol... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
train_station.add_platform(platform)
<|reserved_special_token_0|>
platform.accept_train(train_1)
<|reserved_special_token_0|>
train_1.dock_section(train_section_1)
train_1.dock_section(train_section_2)
train_1.dock_section(train_s... | flexible | {
"blob_id": "5900dc0acde45ac9a31dc9d489aa8dae304d626b",
"index": 1791,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntrain_station.add_platform(platform)\n<mask token>\nplatform.accept_train(train_1)\n<mask token>\ntrain_1.dock_section(train_section_1)\ntrain_1.dock_section(train_section_2)\ntrain_1.doc... | [
0,
1,
2,
3,
4
] |
class Solution(object):
def countSmaller(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
naive -- o(n^2)
"""
## StefanPochmann solution #2
def countSmaller(self, nums):
def sort(enum):
half = len(enum) / 2
if half:
left = sort(enum... | normal | {
"blob_id": "42021b762737a2eb21866ba029ece4ac120152cd",
"index": 5902,
"step-1": "class Solution(object):\n\n def countSmaller(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: List[int]\n naive -- o(n^2)\n \"\"\"\n\n\n<mask token>\n\n\ndef mergesort(x):\n if len(x)... | [
6,
7,
8,
9,
10
] |
import random
def createRandomPhoneNumber():
phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136',
'137', '138', '139', '150', '151', '152', '153', '158', '159',
'177', '180', '181', '182', '183', '186', '188', '189']
phoneNumberBack = []
for i in range(8):
phoneNumb... | normal | {
"blob_id": "5e8f9a222fb2c35b4720e48f0277481e410aee47",
"index": 2791,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef createRandomPhoneNumber():\n phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136',\n '137', '138', '139', '150', '151', '152', '153', '158', '159',\n ... | [
0,
1,
2
] |
import sys, getopt
import sys, locale
import httplib
import json
#sys.argv = [sys.argv[0], '--id=275', '--ofile=275.json']
def getRouteId(routeName, out_filename):
conn = httplib.HTTPConnection("data.ntpc.gov.tw")
qryString = "/od/data/api/67BB3C2B-E7D1-43A7-B872-61B2F082E11B?$format=json&$filter=nameZh%20eq%... | normal | {
"blob_id": "87c413051ed38b52fbcc0b0cf84ecd75cd1e3f0c",
"index": 3139,
"step-1": "import sys, getopt\nimport sys, locale\nimport httplib\nimport json\n\n#sys.argv = [sys.argv[0], '--id=275', '--ofile=275.json']\n\ndef getRouteId(routeName, out_filename):\n conn = httplib.HTTPConnection(\"data.ntpc.gov.tw\")\n... | [
0
] |
#!/usr/bin/python
from cagd.polyline import polyline
from cagd.spline import spline, knots
from cagd.vec import vec2
import cagd.scene_2d as scene_2d
from math import sin,cos,pi, sqrt
#returns a list of num_samples points that are uniformly distributed on the unit circle
def unit_circle_points(num_samples):
a = 2... | normal | {
"blob_id": "35e61add90b5c12f94d5f8071f00d98316461dd6",
"index": 8497,
"step-1": "<mask token>\n\n\ndef unit_circle_points(num_samples):\n a = 2 * pi / num_samples\n return [vec2(cos(a * i), sin(a * i)) for i in range(num_samples)]\n\n\ndef calculate_circle_deviation(spline):\n ideal_d = 1.0\n center... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
c = int(input())
t = input()
m = []
for i in range(12):
aux = []
for j in range(12):
aux.append(float(input()))
m.append(aux)
aux = []
soma = 0
for i in range(12):
soma += m[i][c]
resultado = soma / (t == 'S' and 1 or 12)
print('%.1f' % resultado)
| normal | {
"blob_id": "6edb1f99ca9af01f28322cbaf13f278e79b94e92",
"index": 5882,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(12):\n aux = []\n for j in range(12):\n aux.append(float(input()))\n m.append(aux)\n aux = []\n<mask token>\nfor i in range(12):\n soma += m[i][c]\n<m... | [
0,
1,
2,
3
] |
# Generated by Django 2.2.2 on 2019-10-19 14:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='account',
name='phone_number',
... | normal | {
"blob_id": "7d25a8eb61b6fb9069616745c2b68fd3ceeca9fb",
"index": 6600,
"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 = [('account', '... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class PBAR(object):
<|reserved_special_token_0|>
def __init__(self, model):
"""
Defines the PCOMP object.
:param self: the PCOMP object
:param model: the BDF object
:param cards: the list of PCOMP cards
"""
self.model = mod... | flexible | {
"blob_id": "8f960ad465d0a7bf48752db35c73169be6da27d8",
"index": 9092,
"step-1": "<mask token>\n\n\nclass PBAR(object):\n <mask token>\n\n def __init__(self, model):\n \"\"\"\n Defines the PCOMP object.\n\n :param self: the PCOMP object\n :param model: the BDF object\n :p... | [
3,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def main(_):
writer_train = tf.python_io.TFRecordWriter('./data/train.record')
writer_test = tf.python_io.TFRecordWriter('./data/test.record')
filename_list = tf.train.match_filenames_once('./data/annotations/*.xml')
init = tf.global_variables_initializer(), tf.local_varia... | flexible | {
"blob_id": "8142585827590f6d951f0fcc375e8511aa75e9c8",
"index": 7320,
"step-1": "<mask token>\n\n\ndef main(_):\n writer_train = tf.python_io.TFRecordWriter('./data/train.record')\n writer_test = tf.python_io.TFRecordWriter('./data/test.record')\n filename_list = tf.train.match_filenames_once('./data/a... | [
1,
2,
3,
4,
5
] |
class Mood(object):
GENERIC = 1
HIGH_TEMP = 2
LOW_TEMP = 3
HIGH_DUST = 4
LOW_DUST = 5
def decision(self, data):
temp = float(data)
if temp <= 10:
return self.LOW_TEMP
if temp > 30:
return self.HIGH_TEMP
if (10 < temp <=30):
... | normal | {
"blob_id": "511016b9cd54f6824360d609ede233b9cc3e4447",
"index": 7564,
"step-1": "<mask token>\n",
"step-2": "class Mood(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "class Mood(object):\n <mask token>\n <mask token>\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Category(Document):
<|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_special_token_0|>
class Category(Document):
<|res... | flexible | {
"blob_id": "63d9a0fa0d0747762e65f6f1e85e53090035454c",
"index": 583,
"step-1": "<mask token>\n\n\nclass Category(Document):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Category(Document):\n <mask token>\n <mask token>\n... | [
1,
2,
3,
4
] |
/home/pushkar/anaconda3/lib/python3.6/_bootlocale.py | normal | {
"blob_id": "ea4e4c8067d9e910b8d4c6a1c4c01f1ef70d7341",
"index": 7410,
"step-1": "/home/pushkar/anaconda3/lib/python3.6/_bootlocale.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
<|reserved_special_token_0|>
def downgrade():
op.drop_index(op.f('ix_account_sub_int'), table_name='account')
op.drop_index(op.f('ix_account_mac'), table_name='account')
op.drop_index(op.f('ix_account_interface'), table_name='account')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def upg... | flexible | {
"blob_id": "db49313d2bc8b9f0be0dfd48c6065ea0ab3294cb",
"index": 4032,
"step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_index(op.f('ix_account_sub_int'), table_name='account')\n op.drop_index(op.f('ix_account_mac'), table_name='account')\n op.drop_index(op.f('ix_account_interface'), table_name='a... | [
1,
2,
3,
4,
5
] |
import sys
import os
from pyparsing import *
import csv
def parse_cave_details(details):
##########################################################################
# Define the Bretz Grammar.
# Sample cave description:
# Boring Caverns SE1/4 NW1/4 sec. 16, T. 37 N., R. 10 W., Pulaski County ... | normal | {
"blob_id": "1fc1d2e1a7d18b1ef8ee6396210afe47a63ab09f",
"index": 3267,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_cave_details(details):\n aliquotQuadrantID = Literal('NE') | Literal('SE') | Literal('SW'\n ) | Literal('NW')\n aliquotQuadrantString = aliquotQuadrantID + Supp... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class _HINDERED(_HINDER):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class _HINDERED(_HINDER):
def __init__(self):
_HINDER.__init__(self)
self.name = 'HIN... | flexible | {
"blob_id": "420beba5b6fd575ab9be0c907ae0698ba7be5220",
"index": 4622,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass _HINDERED(_HINDER):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass _HINDERED(_HINDER):\n\n def __init__(self):\n _HINDER.__init__(self)\n self.name ... | [
0,
1,
2,
3,
4
] |
"""
クリップボードのamazonのURLから不要な部分を削除する
"""
# -*- coding: utf-8 -*-
import re
import pyperclip as clip
from urllib.parse import urlparse
#print(clip.paste())
def urlShortner():
# text = "https://www.amazon.co.jp/Jupyter-Cookbook-Dan-Toomey/dp/1788839447/ref=sr_1_5?s=books&ie=UTF8&qid=1535164277&sr=1-5&keywords=Jupyte... | normal | {
"blob_id": "c3c82b9ba198b7818cc8e63710140bbb6e28a9ea",
"index": 6628,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef urlShortner():\n if clip.paste():\n text = clip.paste()\n o = urlparse(text)\n if not (o.scheme == 'http' or o.scheme == 'https'):\n print('This... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app_name = 'user'
urlpatterns = [path('detalhes/', user_views.painel, name='painel'), path(
'produto/ajax/delete_prod/', prod_views.deleteProd, name='deleteProd'),
path('produto/', user_views.painelProdutos, name='painel_p... | flexible | {
"blob_id": "a7f2791e359b848a217beadc77fc983d971ef8b0",
"index": 8436,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'user'\nurlpatterns = [path('detalhes/', user_views.painel, name='painel'), path(\n 'produto/ajax/delete_prod/', prod_views.deleteProd, name='deleteProd'),\n path('produt... | [
0,
1,
2,
3
] |
#-*- coding: utf-8 -*-
import django
if django.get_version() <= '1.3.1':
import apps.settings as settings
from django.core.management import setup_environ
setup_environ(settings)
elif django.get_version() >= '1.7.0':
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apps.settings")
... | normal | {
"blob_id": "8894b73829978cec29aab6ee8bf09700da7fb59f",
"index": 5659,
"step-1": "#-*- coding: utf-8 -*-\n\nimport django\n\nif django.get_version() <= '1.3.1':\n import apps.settings as settings\n from django.core.management import setup_environ\n setup_environ(settings)\nelif django.get_version() >= '... | [
0
] |
from django.shortcuts import render
from django.template import loader
# Create your views here.
from django.http import HttpResponse
from .models import Student
def index(request):
student_objects = Student.objects.all()
context = {"students": student_objects}
return render(request, 'student_list.html', context... | normal | {
"blob_id": "00e8e0b5aeccd2a67f6cfdad63012a0d8b066e6f",
"index": 9551,
"step-1": "<mask token>\n\n\ndef addstudent(request):\n context = {}\n return render(request, 'add_student.html', context)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n student_objects = Student.objects.a... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while income_number != 0:
num_exp = 10 ** (len(str(income_number)) - 1)
deleted_number = int(income_number / num_exp)
if max_number < deleted_number:
max_number = deleted_number
income_number = income_numbe... | flexible | {
"blob_id": "18e0ece7c38169d2de91a07dddd4f40b7427848f",
"index": 3759,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile income_number != 0:\n num_exp = 10 ** (len(str(income_number)) - 1)\n deleted_number = int(income_number / num_exp)\n if max_number < deleted_number:\n max_number = ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def add_data(g):
g.add_node(1)
g.add_node(2, x=5)
g.add_edge(1, 2, y=6)
g.add_edge(2, 3, z=[])
def assert_graph_data(g1, g2):
assert g1 is not g2
assert g2.nodes[1] == {}
assert g2.nodes[2] == {'x': 5}
assert g2.edges[1, 2] == {'y': 6}
assert g2.edges... | flexible | {
"blob_id": "7fe7ea89908f9d233dbdb9e46bf2d677406ab324",
"index": 1050,
"step-1": "<mask token>\n\n\ndef add_data(g):\n g.add_node(1)\n g.add_node(2, x=5)\n g.add_edge(1, 2, y=6)\n g.add_edge(2, 3, z=[])\n\n\ndef assert_graph_data(g1, g2):\n assert g1 is not g2\n assert g2.nodes[1] == {}\n as... | [
6,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@Client.on_callback_query(filters.regex('^change_lg_'))
async def on_change_language(_, callback):
settings_id = int(callback.data.split('_')[2])
with db_session:
settings = SettingsInstance.get(id=settings_id)
... | flexible | {
"blob_id": "dd053da45d2577772414b1373ba324b0bfdc0d94",
"index": 6605,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@Client.on_callback_query(filters.regex('^change_lg_'))\nasync def on_change_language(_, callback):\n settings_id = int(callback.data.split('_')[2])\n with db_session:\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class BuildCommand(ServerCommand):
def __init__(self, tile: tuple, building_name: str):
ServerCommand.__init__(self)
self._tile = tile
self._building_name = building_name
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_... | flexible | {
"blob_id": "22b9868063d6c5fc3f8b08a6e725fff40f4a1a03",
"index": 3886,
"step-1": "<mask token>\n\n\nclass BuildCommand(ServerCommand):\n\n def __init__(self, tile: tuple, building_name: str):\n ServerCommand.__init__(self)\n self._tile = tile\n self._building_name = building_name\n <ma... | [
72,
74,
84,
86,
98
] |
import numpy
numpy.random.seed(1)
M = 20
N = 100
import numpy as np
x = np.random.randn(N, 2)
w = np.random.randn(M, 2)
f = np.einsum('ik,jk->ij', w, x)
y = f + 0.1*np.random.randn(M, N)
D = 10
from bayespy.nodes import GaussianARD, Gamma, SumMultiply
X = GaussianARD(0, 1, plates=(1,N), shape=(D,))
alpha = Gamma(1e-5, ... | normal | {
"blob_id": "9af2b94c6eef47dad0348a5437593cc8561a7deb",
"index": 3593,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnumpy.random.seed(1)\n<mask token>\nY.observe(y)\n<mask token>\nC.initialize_from_random()\n<mask token>\nQ.set_callback(R.rotate)\nQ.update(repeat=1000)\n<mask token>\nbpplt.hinton(C)\n"... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def tile_number(lon_deg, lat_deg, zoom):
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((lat_deg + 90.0) / 180.0 * n)
return xtile, ytile
<|reserved_special_token_1|>
<|reserved_special... | flexible | {
"blob_id": "f3f5b14917c89c5bc2866dd56e212bd3ec8af1cd",
"index": 4841,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef tile_number(lon_deg, lat_deg, zoom):\n n = 2.0 ** zoom\n xtile = int((lon_deg + 180.0) / 360.0 * n)\n ytile = int((lat_deg + 90.0) / 180.0 * n)\n return xtile, ytile\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def print_json(obj, err=False):
if isinstance(obj, Iterator):
obj = list(obj)
click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False
), err=err)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def print... | flexible | {
"blob_id": "d340ac979f57cf4650131665e4fa5b9923f22a3e",
"index": 6691,
"step-1": "<mask token>\n\n\ndef print_json(obj, err=False):\n if isinstance(obj, Iterator):\n obj = list(obj)\n click.echo(json.dumps(obj, sort_keys=True, indent=4, ensure_ascii=False\n ), err=err)\n\n\n<mask token>\n",
... | [
1,
2,
3,
4,
5
] |
#CALCULATE NUMBER OF UPPER AND LOWER CASES
def cnt():
s1=input("enter a string :").strip()
count=0
countu=0
for i in s1:
if(i.islower()):
count+=1
elif(i.isupper()):
countu+=1
else:
pass
print("... | normal | {
"blob_id": "6cfda09f360aaa560011b91db8316e5e3889eea1",
"index": 2017,
"step-1": "<mask token>\n",
"step-2": "def cnt():\n s1 = input('enter a string :').strip()\n count = 0\n countu = 0\n for i in s1:\n if i.islower():\n count += 1\n elif i.isupper():\n countu +... | [
0,
1,
2
] |
# 체크는 오른쪽+아래로만 체크합니다.
def check22(y, x, board) :
dirs = [[0,1], [1,0], [1,1]]
ret = [(y,x)]
for d in dirs :
dy, dx = y+d[0], x+d[1]
if not ( (0<=dy<len(board)) and (0<=dx<len(board[0])) and board[dy][dx]!='0' and board[y][x]==board[dy][dx] ) :
return False
else... | normal | {
"blob_id": "938c4325480608b904bfbe0b11c081166aad694b",
"index": 7291,
"step-1": "def check22(y, x, board):\n dirs = [[0, 1], [1, 0], [1, 1]]\n ret = [(y, x)]\n for d in dirs:\n dy, dx = y + d[0], x + d[1]\n if not (0 <= dy < len(board) and 0 <= dx < len(board[0]) and board[\n d... | [
1,
2,
3,
4,
5
] |
# Dependancies
import pandas as pd
# We can use the read_html function in Pandas
# to automatically scrape any tabular data from a page.
# URL of website to scrape
url = 'https://en.wikipedia.org/wiki/List_of_capitals_in_the_United_States'
# Read HTML
tables = pd.read_html(url)
tables
# What we get in return is a ... | normal | {
"blob_id": "f4fca5ce20db0e27da11d76a7a2fd402c33d2e92",
"index": 4731,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntables\n<mask token>\ndf.head()\n<mask token>\ndf.head()\ndf.set_index('State', inplace=True)\ndf.head()\ndf.loc['Alabama']\n<mask token>\nhtml_table\nhtml_table.replace('\\n', '')\ndf.to... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
initCors(app)
initRoutes(app)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
app = FastAPI(debug=True, title='Recipe API')
initCors(app)
initRoutes(app)
<|reserved_special_token_1|>
from fastapi import FastAPI
fro... | flexible | {
"blob_id": "1857d76b8c68c58d2d721de529811a6aeb09fcbb",
"index": 5407,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ninitCors(app)\ninitRoutes(app)\n",
"step-3": "<mask token>\napp = FastAPI(debug=True, title='Recipe API')\ninitCors(app)\ninitRoutes(app)\n",
"step-4": "from fastapi import FastAPI\nf... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(cosinus_real)
print(cosinus_imaginary)
print(sinus_real)
print(sinus_imag)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
z = 1.0j
cosinus_real = math.cos(z.real)
cosinus_imaginary = math.cos(z.imag)
sinus_real... | flexible | {
"blob_id": "7ea608b73f592cffc7723b4319cf1a87b3e9b443",
"index": 4220,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(cosinus_real)\nprint(cosinus_imaginary)\nprint(sinus_real)\nprint(sinus_imag)\n",
"step-3": "<mask token>\nz = 1.0j\ncosinus_real = math.cos(z.real)\ncosinus_imaginary = math.cos(... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class Command(BaseCommand):
<|reserved_special_token_0|>
help = (
'Will auto populate the database with all the Spells from 5th Edition Dungeons and Dragons.'
)
def handle(self, *args, **kwargs):
for spell in SPELLS:
spell_entry = Spell.obj... | flexible | {
"blob_id": "010f78d952657b3d7c11fbf8e46912d0294f6cc1",
"index": 9103,
"step-1": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n help = (\n 'Will auto populate the database with all the Spells from 5th Edition Dungeons and Dragons.'\n )\n\n def handle(self, *args, **kwargs)... | [
3,
4,
5,
6,
7
] |
import tkinter as tk
from tkinter import Tk, ttk
from tkinter import filedialog
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg, NavigationToolbar2Tk)
from matplotlib.figure import Figure
import matplotlib.animation as animation
... | normal | {
"blob_id": "137ed9c36265781dbebabbd1ee0ea84c9850201a",
"index": 1642,
"step-1": "<mask token>\n\n\nclass mainwin:\n\n def __init__(self, master):\n self.master = master\n master.title\n master.title('University of Utah XRD Analysis Multi-tool')\n self.tab_parent = ttk.Notebook(mas... | [
2,
3,
4,
5,
6
] |
Dict={0:0, 1:1}
def fibo(n):
if n not in Dict:
val=fibo(n-1)+fibo(n-2)
Dict[n]=val
return Dict[n]
n=int(input("Enter the value of n:"))
print("Fibonacci(", n,")= ", fibo(n))
# uncomment to take input from the user
nterms = int(input("How many terms? "))
# check if the number of terms is valid
... | normal | {
"blob_id": "5a1c4cc572431f89709d20296d43e8d889e8c5b0",
"index": 5180,
"step-1": "Dict={0:0, 1:1}\ndef fibo(n):\n if n not in Dict:\n val=fibo(n-1)+fibo(n-2)\n Dict[n]=val\n return Dict[n]\nn=int(input(\"Enter the value of n:\"))\nprint(\"Fibonacci(\", n,\")= \", fibo(n))\n\n# uncomment to ta... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def classify_question(query):
try:
"""
Get answer-type from google autoML classifier
(by making POST requests with authorization key)
"""
question_classifier = GoogleQuestionClassifie... | flexible | {
"blob_id": "db231ea92319414dd10ca8dfbc14e5a70ed2fe44",
"index": 7343,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef classify_question(query):\n try:\n \"\"\"\n Get answer-type from google autoML classifier \n (by making POST requests with authorization key)\n \"\"... | [
0,
1,
2,
3
] |
from cpp_service.SubService import SubService
import config
if __name__ == "__main__":
gateway = config.gateway["trading_system_gateway"]
host = gateway["host"]
port = gateway["port"]
server_id = gateway["server_id"]
licences = gateway["licences"]
service = SubService(host, port, server_id, li... | normal | {
"blob_id": "f72cdf8d91c31760335b96052a34615307f48727",
"index": 9774,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n gateway = config.gateway['trading_system_gateway']\n host = gateway['host']\n port = gateway['port']\n server_id = gateway['server_id']\n licen... | [
0,
1,
2,
3
] |
# EXERCISE:
# Plotting distributions pairwise (2)
# In this exercise, you will generate pairwise joint distributions again. This time, you will make two particular
# additions:
# - You will display regressions as well as scatter plots in the off-diagonal subplots. You will do this with the
# argument kind='reg' (whe... | normal | {
"blob_id": "0eaaa81d3c8bc61368701e1916b42ede88b90d04",
"index": 412,
"step-1": "<mask token>\n",
"step-2": "print(auto.head())\nsns.pairplot(auto, kind='reg', hue='origin')\nplt.show()\n",
"step-3": "# EXERCISE:\n\n# Plotting distributions pairwise (2)\n\n# In this exercise, you will generate pairwise joint... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class ButtonActions(object):
<|reserved_special_token_0|>
def plot_rdf(self, display):
matplotlib.rcParams.update({'font.size': 10})
self.fig = plt.figure(figsize=(display.width, display.height))
self.display = display
rows, cols = self._get_rows_a... | flexible | {
"blob_id": "8c42e06fd92f0110b3ba8c4e7cc0ac45b9e44378",
"index": 3150,
"step-1": "<mask token>\n\n\nclass ButtonActions(object):\n <mask token>\n\n def plot_rdf(self, display):\n matplotlib.rcParams.update({'font.size': 10})\n self.fig = plt.figure(figsize=(display.width, display.height))\n ... | [
3,
8,
9,
10,
11
] |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 20:29:49 2019
@author: kzx789
"""
from PIL import Image
import os, glob, numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
import cv2
import pymysql
import MySQLdb as mysql
"""
#csv를 읽어서 영양정보 출력
def get_Nutrition(str) :
nutrition = pd.r... | normal | {
"blob_id": "1255a9df2fbe11d92991f3f0f7054b92cb017628",
"index": 2941,
"step-1": "<mask token>\n\n\ndef drawing_plt():\n thisImg = os.listdir(caltech_dir)\n row = 4\n cols = int(math.ceil(len(thisImg) / 4))\n fig = plt.figure()\n i = 1\n for image in glob.glob('C:/cnnTest/*.jpg'):\n img ... | [
3,
4,
5,
6,
7
] |
import configparser
# CONFIG
config = configparser.ConfigParser()
config.read('dwh.cfg')
# DROP TABLES
drop_schema="DROP SCHEMA IF EXISTS sparkifydb;"
set_search_path="SET SEARCH_PATH to sparkifydb;"
staging_events_table_drop = "DROP TABLE IF EXISTS staging_events;"
staging_songs_table_drop = "DROP TABLE IF EXISTS s... | normal | {
"blob_id": "652918e09a3506869c939be39b71a06467459f8a",
"index": 5992,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nconfig.read('dwh.cfg')\n<mask token>\n",
"step-3": "<mask token>\nconfig = configparser.ConfigParser()\nconfig.read('dwh.cfg')\ndrop_schema = 'DROP SCHEMA IF EXISTS sparkifydb;'\nset_se... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
"""
Created on Mon May 2 17:24:00 2016
@author: pasca
"""
# -*- coding: utf-8 -*-
import os.path as op
from nipype.utils.filemanip import split_filename as split_f
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec
from nipype.interfaces.base import traits, File, Trait... | normal | {
"blob_id": "d9cdcf64042c3c6c4b45ec0e3334ba756dd43fcd",
"index": 5066,
"step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon May 2 17:24:00 2016\n\n@author: pasca\n\"\"\"\n\n# -*- coding: utf-8 -*-\nimport os.path as op\n\nfrom nipype.utils.filemanip import split_filename as split_f\n\nfrom nipype.interfac... | [
0
] |
<|reserved_special_token_0|>
def create_sensor_input_file(rad, chunk_n):
sensor_file_path = os.path.join(rad.data_folder_path, 'points_' + str(
chunk_n) + '.pts')
sensor_file = open(sensor_file_path, 'w')
sensor_pts_data = py2radiance.write_rad.sensor_file(rad.
sensor_positions, rad.sensor... | flexible | {
"blob_id": "164b0afde225119a8fbd4ccfccbbbc3550aa75fe",
"index": 2634,
"step-1": "<mask token>\n\n\ndef create_sensor_input_file(rad, chunk_n):\n sensor_file_path = os.path.join(rad.data_folder_path, 'points_' + str(\n chunk_n) + '.pts')\n sensor_file = open(sensor_file_path, 'w')\n sensor_pts_da... | [
6,
7,
9,
10,
11
] |
# coding: utf-8
"""
SevOne API Documentation
Supported endpoints by the new RESTful API # noqa: E501
OpenAPI spec version: 2.1.18, Hash: db562e6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from swagger_client.models.d... | normal | {
"blob_id": "25d4fa44cb17048301076391d5d67ae0b0812ac7",
"index": 3988,
"step-1": "<mask token>\n\n\nclass RawDataSettingsV1(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, data_aggregation_setting=None, raw_data_setting=None,\n units_setting=None,... | [
8,
15,
17,
18,
19
] |
'''给定一个只包含小写字母的有序数组letters 和一个目标字母 target,寻找有序数组里面比目标字母大的最小字母。
数组里字母的顺序是循环的。举个例子,如果目标字母target = 'z' 并且有序数组为 letters = ['a', 'b'],则答案返回 'a'。输入:
示例:
letters = ["c", "f", "j"]
target = "a"
输出: "c"
'''
class Solution(object):
def nextGreatestLetter(self, letters, target):
"""
:type letters: List[str]
... | normal | {
"blob_id": "9cb3d8bc7af0061047136d57abfe68cbb5ae0cd7",
"index": 3344,
"step-1": "<mask token>\n\n\nclass SolutionBest(object):\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass SolutionBest(object):\n\n def nextGreatestLetter(self, letters, target):\n \"\"\"\n :type letters: List[str]\... | [
1,
2,
3,
4,
5
] |
class Solution:
def commonFactors(self, a: int, b: int) ->int:
gcd = math.gcd(a, b)
return sum(a % i == 0 and b % i == 0 for i in range(1, gcd + 1))
| normal | {
"blob_id": "ea696329a0cfd558fb592ffaf6339a35e8950a3c",
"index": 6721,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def commonFactors(self, a: int, b: int) ->int:\n gcd = math.gcd(a, b)\n return sum(a % i == 0 and b % i == 0 for ... | [
0,
1,
2
] |
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
import json
from bll.plugins import service
import logging
import pecan
import pymysql.cursors
LOG = logging.getLogger(__name__)
class PreferencesSvc(service.SvcBase):
"""
Simple service to manage user preferenc... | normal | {
"blob_id": "fb787e688da975d37f9fcc39bf5e02957b186982",
"index": 7512,
"step-1": "<mask token>\n\n\nclass PreferencesSvc(service.SvcBase):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super(PreferencesSvc, self).__init__(*args, **kwargs)\n config = pecan.conf.db.to_dict()\n ... | [
8,
10,
11,
13,
14
] |
<|reserved_special_token_0|>
class AdminCityTable(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class AdminAreaModel(models.Model):
area_id = models.AutoField(primary_key=True)
area_name = models.CharField(m... | flexible | {
"blob_id": "5d4ef314bb7169f5de4795e5c1aca62a1a060bae",
"index": 772,
"step-1": "<mask token>\n\n\nclass AdminCityTable(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AdminAreaModel(models.Model):\n area_id = models.AutoField(primary_key=True)\n area_name ... | [
7,
10,
14,
15,
16
] |
<|reserved_special_token_0|>
class Sudoku:
def __init__(self, grid):
"""
Initializes the grid
"""
self.grid = grid
self.sub_grid = self.create_sub_grid(self.grid)
def create_sub_grid(self, grid):
"""
Creates a Sub grid, containing the possible... | flexible | {
"blob_id": "4032503bba8a1dd273015d503f52b6ea2d932d1d",
"index": 3564,
"step-1": "<mask token>\n\n\nclass Sudoku:\n\n def __init__(self, grid):\n \"\"\"\n Initializes the grid\n \"\"\"\n self.grid = grid\n self.sub_grid = self.create_sub_grid(self.grid)\n\n def create... | [
10,
12,
13,
14,
15
] |
'''
Created on June 24, 2019
@author: Andrew Habib
'''
import json
import jsonref
import sys
from jsonsubschema.api import isSubschema
def main():
assert len(
sys.argv) == 3, "jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema"
s1_file = sys.argv[1]
s2_file = sys.argv[2]
... | normal | {
"blob_id": "ba78a1e29736c4f109a0efc6f5b9993994661058",
"index": 3527,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n assert len(sys.argv\n ) == 3, 'jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema'\n s1_file = sys.argv[1]\n s2_file = sys.argv[2]\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('news/', NewsCreateListView.as_view()), path(
'news_detailed/<int:id>/', NewsDetailGenericView.as_view())]
<|reserved_special_token_1|>
from django.contrib import admin
from django.urls import path
from ... | flexible | {
"blob_id": "afdb14d60374049753b3c980c717a13456c7ff5c",
"index": 9745,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('news/', NewsCreateListView.as_view()), path(\n 'news_detailed/<int:id>/', NewsDetailGenericView.as_view())]\n",
"step-3": "from django.contrib import admin\nfrom... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
import crawl
import logging
from elasticsearch import Elasticsearch
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
logging.getLogger("crawl").setLevel(logging.INFO)
logging.getLogger("elasticsearch").setLevel(logging.ERROR)
es = Elasticsearch()
crawl... | normal | {
"blob_id": "21d07c2b80aa00d0c75da342d37195b6829593b6",
"index": 1110,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n logging.basicConfig(level=logging.INFO)\n logging.getLogger('crawl').setLevel(logging.INFO)\n logging.getLogger('elasticsearch').setLevel(logging.ERR... | [
0,
1,
2,
3
] |
from function import *
from .propogation import optimize
from .initialize import initialize_with_zeros
def predict(weight, intercept, x_vector):
"""
Predict whether the label is 0 or 1 using learned logistic regression parameters (w, b)
Arguments:
w -- weights, a numpy array of size (num_px * num_px ... | normal | {
"blob_id": "63360ec9693a916375b49d0881008b1d7d4ec953",
"index": 4546,
"step-1": "<mask token>\n\n\nclass Logistic(object):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n \"\"\"\n Initializing the model parameter\n :param args:\n :param kwargs:\n X_train,\n... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def dot_product(a, b):
ans = 0
for i in range(len(a)):
ans += a[i] * b[i]
return ans
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def dot_product(a, b):
ans = 0
for i in range(len(a)):
ans += a[i] * b[i]
... | flexible | {
"blob_id": "fc273a286a462cb673edaa2de2ecc6b9ca631004",
"index": 9824,
"step-1": "<mask token>\n",
"step-2": "def dot_product(a, b):\n ans = 0\n for i in range(len(a)):\n ans += a[i] * b[i]\n return ans\n\n\n<mask token>\n",
"step-3": "def dot_product(a, b):\n ans = 0\n for i in range(l... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
# @Time : 2018/12/13 21:32
# @Author : sundongjian
# @Email : xiaobomentu@163.com
# @File : __init__.py.py
# @Software: PyCharm | normal | {
"blob_id": "00ec56420831d8f4ab14259c7b07f1be0bcb7d78",
"index": 9161,
"step-1": "# -*- coding: utf-8 -*-\r\n# @Time : 2018/12/13 21:32\r\n# @Author : sundongjian\r\n# @Email : xiaobomentu@163.com\r\n# @File : __init__.py.py\r\n# @Software: PyCharm",
"step-2": null,
"step-3": null,
"step-4": null,... | [
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
rc('font', family=font_name)
<|reserved_special_token_0|>
print(df1)
df1.plot()
plt.show()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
font_name = font_manager.FontProperties(fname='c:/windows/Fonts/malgun.ttf'
... | flexible | {
"blob_id": "fb82724aab7e0819c9921d41dcb612b304b25753",
"index": 9723,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrc('font', family=font_name)\n<mask token>\nprint(df1)\ndf1.plot()\nplt.show()\n",
"step-3": "<mask token>\nfont_name = font_manager.FontProperties(fname='c:/windows/Fonts/malgun.ttf'\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def merge_model(model_1, model_2):
"""
keras将两个独立的模型融合起来
:param model_1:
:param model_2:
:return:
"""
inp1 = model_1.input
inp2 = model_2.input
r1 = model_1.output
r2 = model_2.output
x = keras.layers.Concatenate(axis=1)([r1, r2])
model = Mo... | flexible | {
"blob_id": "cce1b6f8e4b3f78adfa2243fe49b4994d35c5a38",
"index": 9898,
"step-1": "<mask token>\n\n\ndef merge_model(model_1, model_2):\n \"\"\"\n keras将两个独立的模型融合起来\n :param model_1:\n :param model_2:\n :return:\n \"\"\"\n inp1 = model_1.input\n inp2 = model_2.input\n r1 = model_1.outpu... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def vol_shell(r1, r2):
a = abs(4 / 3 * math.pi * (r1 ** 3 - r2 ** 3))
return round(a, 3)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def vol_shell(r1, r2):
a = abs(4 ... | flexible | {
"blob_id": "cd234911c1f990b8029dfa792d132847bf39a6aa",
"index": 445,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef vol_shell(r1, r2):\n a = abs(4 / 3 * math.pi * (r1 ** 3 - r2 ** 3))\n return round(a, 3)\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef vol_shell(r1, r2):\n a = ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python3
"""
Test of Rectangle class
"""
from contextlib import redirect_stdout
import io
import unittest
from random import randrange
from models.base import Base
from models.rectangle import Rectangle
from models.square import Square
class TestRectangle(unittest.TestCase):
""" Test Rectangle methods "... | normal | {
"blob_id": "ca00091b7ebcb9ee45b77c919c458c75e3db5b1e",
"index": 4783,
"step-1": "<mask token>\n\n\nclass TestRectangle(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\" setUp \"\"\"\n Base._Base__nb_objects = 0\n\n def tearDown(self):\n \"\"\" tearDown destroys any e... | [
23,
25,
26,
28,
31
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.