code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import logging import os import time import urllib from collections import namedtuple from statistics import mean from urllib.request import urlopen import bs4 import regex as re from tika import parser from scipy.stats import ks_2samp import config from TFU.trueformathtml import TrueFormatUpmarkerHTML from TFU.truefo...
normal
{ "blob_id": "4d2cb3e0bdd331a1de7f07eb0109f02c9cf832a8", "index": 7441, "step-1": "<mask token>\n\n\nclass PaperReader:\n <mask token>\n\n def __init__(self, _threshold=0.001, _length_limit=20000):\n with open(config.wordlist, 'r') as f:\n self.wordlist = [w for w in list(f.readlines()) if...
[ 8, 10, 11, 12, 13 ]
''' Created on Dec 18, 2011 @author: ppa ''' import unittest from ultrafinance.pyTaLib.indicator import Sma class testPyTaLib(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def testSma(self): sma = Sma(period = 3) expectedAvgs = [1, 1.5, 2, 3, 4] ...
normal
{ "blob_id": "fcd2bd91dff3193c661d71ade8039765f8498fd4", "index": 8317, "step-1": "<mask token>\n\n\nclass testPyTaLib(unittest.TestCase):\n\n def setUp(self):\n pass\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass testPyTaLib(unittest.TestCase):\n\n def setUp(self):\n ...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # Copyright (c) 2018-2020 Christiaan Frans Rademan <chris@fwiw.co.za>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
normal
{ "blob_id": "13e27c29839286988b37d2d3685f54d42fd57973", "index": 9773, "step-1": "<mask token>\n\n\n@register.resources()\nclass Roles(object):\n <mask token>\n\n def role(self, req, resp, id):\n return obj(req, infinitystone_role, sql_id=id)\n\n def roles(self, req, resp):\n return sql_li...
[ 3, 5, 6, 8, 9 ]
from base64 import b64encode from configparser import ConfigParser import functools from flask import ( Blueprint, flash, redirect, render_template, request, session, url_for, app ) from requests.exceptions import SSLError import spotipy from spotipy import oauth2 bp = Blueprint('auth', __name__, url_prefix='/auth...
normal
{ "blob_id": "8f7ecbe03e9a7a1d9df8cbe4596456e21b84653b", "index": 9114, "step-1": "<mask token>\n\n\n@bp.route('/login')\ndef login():\n \"\"\"\n : Create session and login user\n : PARAMS None\n : RETURN <view>\n \"\"\"\n try:\n session.clear()\n return redirect(SP_OAUTH.get_autho...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> websocket_urlpatterns = [path('ws/notifications', NotificationsConsumer)] <|reserved_special_token_1|> from django.urls import path from .consumers import NotificationsConsumer websocket_urlpatterns = [path('ws/notifications', ...
flexible
{ "blob_id": "31e5b249516f4e9d57d8fd82713966a69e0516b4", "index": 9185, "step-1": "<mask token>\n", "step-2": "<mask token>\nwebsocket_urlpatterns = [path('ws/notifications', NotificationsConsumer)]\n", "step-3": "from django.urls import path\nfrom .consumers import NotificationsConsumer\nwebsocket_urlpattern...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def bits2str(bits): ret = '' for row in bits: rowstr = '' for bit in row: rowstr += '1' if bit else '0' ret += rowstr + '\n' return ret def parse_xyi(inp): xpos = inp.find('X') ypos = inp.find('Y') ipos = inp.find('I') asse...
flexible
{ "blob_id": "95163a28a35cc88240d9d6edc2e9b416e5493909", "index": 6021, "step-1": "<mask token>\n\n\ndef bits2str(bits):\n ret = ''\n for row in bits:\n rowstr = ''\n for bit in row:\n rowstr += '1' if bit else '0'\n ret += rowstr + '\\n'\n return ret\n\n\ndef parse_xyi(in...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> class Ball(pygame.sprite.Sprite): def __init__(self, color, width, height): super().__init__() self.image = pygame.Surface([width, height]) self.image.fill(BLACK) self.image.set_colorkey(BLACK) pygame.draw.rect(self.image, color, [0, 0, width, ...
flexible
{ "blob_id": "6f216420f641c042bb2772b79c10f904ffa21938", "index": 8733, "step-1": "<mask token>\n\n\nclass Ball(pygame.sprite.Sprite):\n\n def __init__(self, color, width, height):\n super().__init__()\n self.image = pygame.Surface([width, height])\n self.image.fill(BLACK)\n self.im...
[ 2, 4, 6, 7, 8 ]
"""social_website URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Clas...
normal
{ "blob_id": "bf1221bc9768cff2edb67e0e5f5cea0ee2dd64e5", "index": 7740, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT\n )\n", "step-3": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestNetworkSimulatorService(TestCase): @patch( 'network_simulator.service.network_topology_handler.write_network_topology_to_file' ) def setUp(self, write_network_topology_to_file_mock): self.device_id = 'testid' self.device_type = 'vm' ...
flexible
{ "blob_id": "8e854398084e89b0b8436d6b0a2bf8f36a9c7bd5", "index": 187, "step-1": "<mask token>\n\n\nclass TestNetworkSimulatorService(TestCase):\n\n @patch(\n 'network_simulator.service.network_topology_handler.write_network_topology_to_file'\n )\n def setUp(self, write_network_topology_to_fil...
[ 5, 6, 7, 9, 10 ]
from .settings import * # Heroku Configurations # Parse database configuration from $DATABASE_URL import dj_database_url DATABASES = {'default': dj_database_url.config()} # Honor the 'X-Forwarded-Proto' header for request.is_secure() SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # loading local_se...
normal
{ "blob_id": "8bb86cae3387a0d4ce5987f3e3c458c8298174e0", "index": 7342, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from .local_settings import *\nexcept Exception as e:\n pass\n<mask token>\n", "step-3": "<mask token>\nDATABASES = {'default': dj_database_url.config()}\nSECURE_PROXY_SSL_...
[ 0, 1, 2, 3, 4 ]
from django.db import models # Create your models here. class Todo(models.Model): title = models.CharField(max_length=200) completed = models.IntegerField(default=0)
normal
{ "blob_id": "4b075d8211d7047f6f08fe6f6f55e4703bdb6f1f", "index": 3164, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Todo(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Todo(models.Model):\n title = models.CharField(max_length=200)\n completed...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Node: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right <|reserved_special_token_0|> def tree_to_array_bfs(root): q = Queue(maxsize=0) q.put(root) array = [] def bfs(): i...
flexible
{ "blob_id": "a52762fb13c04ced07a41a752578c4173d1eac42", "index": 8350, "step-1": "<mask token>\n\n\nclass Node:\n\n def __init__(self, value, left=None, right=None):\n self.value = value\n self.left = left\n self.right = right\n\n\n<mask token>\n\n\ndef tree_to_array_bfs(root):\n q = Q...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for row in screen: if row_count == 0: row_count = row_count + 1 continue row = row.split('\t') data[row[1]] = row print(data['55299']) print(data['51666']) print(data['28987']) <|reserved_special_token_...
flexible
{ "blob_id": "80c6dd1c76b3ac56f34e36f571e8db3927994311", "index": 8162, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in screen:\n if row_count == 0:\n row_count = row_count + 1\n continue\n row = row.split('\\t')\n data[row[1]] = row\nprint(data['55299'])\nprint(data['5166...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> meta.create_all(engine) <|reserved_special_token_0|> conn.execute(students.insert(), [{'name': 'Rajiv', 'lastname': 'Khanna'}, { 'name': 'Komal', 'lastname': 'Bhandari'}, {'name': 'Abdul', 'lastname': 'Sattar'}, {'name': '...
flexible
{ "blob_id": "7ea6fefa75d36ff45dcea49919fdc632e378a73f", "index": 9113, "step-1": "<mask token>\n", "step-2": "<mask token>\nmeta.create_all(engine)\n<mask token>\nconn.execute(students.insert(), [{'name': 'Rajiv', 'lastname': 'Khanna'}, {\n 'name': 'Komal', 'lastname': 'Bhandari'}, {'name': 'Abdul', 'lastna...
[ 0, 1, 2, 3, 4 ]
from selenium import webdriver from selenium.webdriver.common.keys import Keys import requests import time driver = webdriver.Chrome(executable_path='/home/bc/桌面/chromedriver') driver.get('https://www.zhaopin.com/') time.sleep(5) driver.find_element_by_id('KeyWord_kw2').send_keys('技术') driver.find_element_by_class_name...
normal
{ "blob_id": "fc5a4c27a21c2bd3900a6ad0bff68c249fe29d7a", "index": 1865, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.zhaopin.com/')\ntime.sleep(5)\ndriver.find_element_by_id('KeyWord_kw2').send_keys('技术')\ndriver.find_element_by_class_name('doSearch').click()\ntime.sleep(5)\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Blockchain: def __init__(self): self.chain = [] self.transactions = [] self.create_block(proof=0, previous_hash='0') self.nodes = set() def create_block(self, proof, previous_hash): block = {'index': len(self.chain) + 1, 'timestamp':...
flexible
{ "blob_id": "e85d3660968410b83b14ba610150c0c8cc880119", "index": 9191, "step-1": "<mask token>\n\n\nclass Blockchain:\n\n def __init__(self):\n self.chain = []\n self.transactions = []\n self.create_block(proof=0, previous_hash='0')\n self.nodes = set()\n\n def create_block(self...
[ 6, 15, 17, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_api(env): assert set(env.parameters.keys()) == {'knowledge_structure', 'action_space', 'learning_item_base'} <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ...
flexible
{ "blob_id": "b1ae3abb6decf4d70bc2372e70cf4f5b868e805d", "index": 8756, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_api(env):\n assert set(env.parameters.keys()) == {'knowledge_structure',\n 'action_space', 'learning_item_base'}\n\n\n<mask token>\n", "step-3": "<mask token>\n\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class State(Enum): ok = True error = False <|reserved_special_token_0|> def close_db_connection(): try: connection.close() except Exception: print('Error closing connection') def create_new_category(category): state = State.ok try: cur...
flexible
{ "blob_id": "9b3c2604b428295eda16030b45cf739e714f3d00", "index": 1614, "step-1": "<mask token>\n\n\nclass State(Enum):\n ok = True\n error = False\n\n\n<mask token>\n\n\ndef close_db_connection():\n try:\n connection.close()\n except Exception:\n print('Error closing connection')\n\n\nd...
[ 7, 8, 10, 11, 12 ]
import pandas as pd # 칼럼값으로 추가 - 함수 작성 # 1. cv_diff_value : 종가 일간 변화량 def cv_diff_value(prevalue, postvalue): return postvalue - prevalue # 2. cv_diff_rate : 종가 일간 변화율 def cv_diff_rate(prevalue, postvalue): return (postvalue - prevalue) / prevalue * 100 # 3. cv_maN_value : 종가의 N일 이동평균 def cv_maN_value(cv, ...
normal
{ "blob_id": "a967b97f090a71f28e33c5ca54cb64db3967aea3", "index": 7002, "step-1": "<mask token>\n\n\ndef cv_diff_value(prevalue, postvalue):\n return postvalue - prevalue\n\n\ndef cv_diff_rate(prevalue, postvalue):\n return (postvalue - prevalue) / prevalue * 100\n\n\ndef cv_maN_value(cv, N):\n str_repla...
[ 5, 6, 7, 8, 9 ]
# coding: utf-8 """ MailSlurp API MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://ww...
normal
{ "blob_id": "a4ccf373695b7df60039bc8f6440a6ad43d265c1", "index": 3750, "step-1": "<mask token>\n\n\nclass FormControllerApi(object):\n <mask token>\n <mask token>\n <mask token>\n\n def submit_form_with_http_info(self, **kwargs):\n \"\"\"Submit a form to be parsed and sent as an email to an ad...
[ 2, 3, 4, 5, 7 ]
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client account_sid = 'AC76d9b17b2c23170b7019924f709f366b' auth_token = '8fba7a54c6e3dc3754043b3865fa9d82' client = Client(account_sid, auth_token) user_sample = [ { "_id": "5e804c501c9d440000986adc", "name"...
normal
{ "blob_id": "67eb9985fc0ae9a00ce84a2460b69b00df1c9096", "index": 3310, "step-1": "<mask token>\n", "step-2": "<mask token>\nif user_sample[0].get('milesRan') >= user_sample[1].get('milesGoal'):\n message = client.messages.create(body='Oh, no! ' + user_sample[0].get(\n 'name') +\n ' surpassed y...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render,redirect,get_object_or_404 from .models import Blog,UseCase,Comment from courses.models import offerings from django.contrib.auth.models import User from django.contrib import auth from django.contrib.auth.decorators import login_required from django.utils import timezone from django...
normal
{ "blob_id": "70fcf25cd7d70972e8042dc882f6ecb12d36461a", "index": 3353, "step-1": "<mask token>\n\n\ndef blogs(request):\n only_pub_blog = Blog.objects.filter(status=1)\n return render(request, 'dlblog/blogs.html', {'blog': only_pub_blog})\n\n\n<mask token>\n\n\n@login_required\ndef newblog(request):\n r...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Normalizer: <|reserved_special_token_0|> def imageFromArg(self, image): if isinstance(image, (str, unicode)): return cv2.imread(image, 0) else: return image def videoReaderFromArg(self, video): if isinstance(video, (str, ...
flexible
{ "blob_id": "141e0f20ce912ecf21940f78e9f40cb86b91dc2b", "index": 6121, "step-1": "<mask token>\n\n\nclass Normalizer:\n <mask token>\n\n def imageFromArg(self, image):\n if isinstance(image, (str, unicode)):\n return cv2.imread(image, 0)\n else:\n return image\n\n def...
[ 5, 7, 10, 11, 13 ]
<|reserved_special_token_0|> def RectBivariateSplineZero(y1, x1, map1, kx=1, ky=1): return RectBivariateSpline(y1, x1, map1, kx=kx, ky=ky) y2 = numpy.zeros(numpy.size(y1) + 2) y2[1:-1] = y1 y2[0] = 2 * y2[1] - y2[2] y2[-1] = 2 * y2[-2] - y2[-3] x2 = numpy.zeros(numpy.size(x1) + 2) x2[1:-1]...
flexible
{ "blob_id": "2ab6488276c74da8c3d9097d298fc53d1caf74b1", "index": 6243, "step-1": "<mask token>\n\n\ndef RectBivariateSplineZero(y1, x1, map1, kx=1, ky=1):\n return RectBivariateSpline(y1, x1, map1, kx=kx, ky=ky)\n y2 = numpy.zeros(numpy.size(y1) + 2)\n y2[1:-1] = y1\n y2[0] = 2 * y2[1] - y2[2]\n y...
[ 13, 14, 15, 18, 23 ]
from test.demo_test_case import DemoTestCase class UserTest(DemoTestCase): def test_access_secure_area(self): r = self.get('/api/user') self.assertEqual(401, r.status_code) def test_login_bad_password(self): r = self.post('/api/connect', {'user': 'admin', 'password': 'bad...
normal
{ "blob_id": "0a1d102075cebee13e25f3eb703811d1e22f53c2", "index": 1957, "step-1": "<mask token>\n\n\nclass UserTest(DemoTestCase):\n <mask token>\n\n def test_login_bad_password(self):\n r = self.post('/api/connect', {'user': 'admin', 'password':\n 'badpassword'})\n self.assertEqual...
[ 3, 4, 5, 6 ]
from typing import List class Solution: def destCity(self, paths: List[List[str]]) ->str: departCity = set() destCity = [] for i in paths: if i[1] not in departCity: destCity.append(i[1]) if i[0] in destCity: destCity.remove(i[0]) ...
normal
{ "blob_id": "03cc3bf37ea8d971550a89107161005901d842de", "index": 2514, "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 destCity(self, paths: List[List[str]]) ->str:\n departCity = set()\n dest...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ZDT2: def __init__(self): self.dimension = 30 self.objFuncNum = 2 self.isMin = True self.min = np.zeros(self.dimension) self.max = np.zeros(self.dimension) + 1 self.span = self.min, self.max def Func(self, X): Y = np....
flexible
{ "blob_id": "8ca16947054b681a5f43d8b8029191d031d3a218", "index": 8352, "step-1": "<mask token>\n\n\nclass ZDT2:\n\n def __init__(self):\n self.dimension = 30\n self.objFuncNum = 2\n self.isMin = True\n self.min = np.zeros(self.dimension)\n self.max = np.zeros(self.dimension)...
[ 12, 13, 16, 17, 18 ]
# -*- coding: utf-8 -*- import os from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore class Config: SECRET_KEY = os.environ.get('SECRET_KEY') # github GITHUB_OAUTH2 = { #github上获取 'client_id': '', 'client_secret': '', 'callback_url': '', 'scope': 'user'...
normal
{ "blob_id": "af7a124c873dda02ba2a78e85965aa243d791863", "index": 3432, "step-1": "# -*- coding: utf-8 -*-\nimport os\nfrom apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore\n\n\nclass Config:\n SECRET_KEY = os.environ.get('SECRET_KEY')\n # github\n GITHUB_OAUTH2 = {\n #github上获取\n ...
[ 0 ]
#!/usr/bin/env python # coding: utf-8 # # Lesson 2 Demo 3: Creating Fact and Dimension Tables with Star Schema # # <img src="images/postgresSQLlogo.png" width="250" height="250"> # ### Walk through the basics of modeling data using Fact and Dimension tables. In this demo, we will:<br> # <ol><li>Create both Fact and...
normal
{ "blob_id": "70964ac617847dd4bf4a60a142afc94d0f284a24", "index": 7621, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n conn = psycopg2.connect(\n 'host=127.0.0.1 dbname=studentdb user=student password=student')\nexcept psycopg2.Error as e:\n print('Error: Could not make connection to t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> warnings.filterwarnings('ignore') <|reserved_special_token_0|> sns.set(style='white', color_codes=True) <|reserved_special_token_0|> sns.boxplot(x='Species', y='PetalLengthCm', data=iris) plt.show() <|reserved_special_token_1|> ...
flexible
{ "blob_id": "0125abab0312d8f007e76ee710348efc9daae31e", "index": 4989, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings('ignore')\n<mask token>\nsns.set(style='white', color_codes=True)\n<mask token>\nsns.boxplot(x='Species', y='PetalLengthCm', data=iris)\nplt.show()\n", "step-3":...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getTests(): tests = [] suite = testTemplate.testSuite('Sample Test Cases') testcase = testTemplate.testInstance('3\n1 1 1\n1 1 1\n1 1 1', '6', 'Sample #1') suite.add(testcase) testcase = testTempl...
flexible
{ "blob_id": "de4c31ad474b7ce75631214aceafbe4d7334f14b", "index": 6956, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getTests():\n tests = []\n suite = testTemplate.testSuite('Sample Test Cases')\n testcase = testTemplate.testInstance('3\\n1 1 1\\n1 1 1\\n1 1 1', '6',\n 'Sample #...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SIL(SVM): <|reserved_special_token_0|> <|reserved_special_token_0|> def fit(self, bags, y): """ @param bags : a sequence of n bags; each bag is an m-by-k array-like object containing m instances with k features @param y : an...
flexible
{ "blob_id": "f125269d5b52da41734ce94683139c44f0c4a66a", "index": 3402, "step-1": "<mask token>\n\n\nclass SIL(SVM):\n <mask token>\n <mask token>\n\n def fit(self, bags, y):\n \"\"\"\n @param bags : a sequence of n bags; each bag is an m-by-k array-like\n object contai...
[ 3, 4, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for jpg_file in jpg_files: basename = os.path.basename(jpg_file) if int(basename[:-4]) % 10 == 0: cnt += 1 dirname = os.path.dirname(jpg_file) dirs = dirname.split('/') new_fname = dirs[-2] ...
flexible
{ "blob_id": "a57059927a7bd3311c1d104bfc80877912c7d995", "index": 125, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor jpg_file in jpg_files:\n basename = os.path.basename(jpg_file)\n if int(basename[:-4]) % 10 == 0:\n cnt += 1\n dirname = os.path.dirname(jpg_file)\n dirs = d...
[ 0, 1, 2, 3, 4 ]
30. Convertir P libras inglesas a D dólares y C centavos. Usar el tipo de cambio $2.80 = 1 libra p=2.80 x=int(input("Desea convertir sus libras a dolar(1) o a centavos(2)")) if x == 1: d=float(input("¿Cuantas libras desea convertir a dólar?\n")) conversion = (d/p) if x == 2: c=float(input("¿Cuan...
normal
{ "blob_id": "ebc2acbcbab787b07c97b0a4ea8fbaeb9d8e30aa", "index": 9770, "step-1": "30. Convertir P libras inglesas a D dólares y C centavos. Usar el tipo de cambio $2.80 = 1 libra\r\np=2.80\r\n\r\nx=int(input(\"Desea convertir sus libras a dolar(1) o a centavos(2)\"))\r\n\r\nif x == 1:\r\n d=float(input(\"¿Cu...
[ 0 ]
<|reserved_special_token_0|> def get_program(filename): program = [] mask = None with open(filename, 'r') as f: for line in f: line = line[:-1] if 'mask' in line: if mask is not None: program.append(mask) mask = Mask(line)...
flexible
{ "blob_id": "56e8cdec854b3b7a2f925e70d7d59a73b76f9952", "index": 9340, "step-1": "<mask token>\n\n\ndef get_program(filename):\n program = []\n mask = None\n with open(filename, 'r') as f:\n for line in f:\n line = line[:-1]\n if 'mask' in line:\n if mask is n...
[ 1, 3, 4, 5, 6 ]
import json import pika import urllib.request def validate_urls(): connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) channel = connection.channel() channel.queue_declare(queue='urlValidationQueue') channel.basic_consume(validate_url, queue='urlValid...
normal
{ "blob_id": "4a09096abf073294afcf21b1eff9350329d4db33", "index": 5252, "step-1": "<mask token>\n\n\ndef validate_url(ch, method, properties, body):\n message = json.loads(body)\n valid = True\n print(f\"Got new URL to check: {message['url']}.\")\n try:\n urllib.request.urlopen('https://github....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def fcn_model_fn(features, labels, mode): L2 = tf.contrib.layers.l2_regularizer(scale=0.1) trainable = False if mode == tf.estimator.ModeKeys.TRAIN: trainable = True seed = 2019 with tf.name_scope('vgg16_pretrained'): x = tf.layers.conv2d(features, 64, ...
flexible
{ "blob_id": "df6fa0409500f97e5afde8f97796d6ed0cc4d746", "index": 1330, "step-1": "<mask token>\n\n\ndef fcn_model_fn(features, labels, mode):\n L2 = tf.contrib.layers.l2_regularizer(scale=0.1)\n trainable = False\n if mode == tf.estimator.ModeKeys.TRAIN:\n trainable = True\n seed = 2019\n w...
[ 1, 2, 3, 4, 5 ]
# Background: The Fibonacci numbers are defined by F(n) = F(n-1) + F(n-2). # There are different conventions on whether 0 is a Fibonacci number, # and whether counting starts at n=0 or at n=1. Here, we will assume that # 0 is not a Fibonacci number, and that counting starts at n=0, # so F(0)=F(1)=1, and F(2)=2. Wit...
normal
{ "blob_id": "40744a8530df28f0bd8648900beb8a66e2d44cd0", "index": 7730, "step-1": "<mask token>\n", "step-2": "def fun_nthfibonaccinumber(n):\n n1 = 1\n n2 = 1\n if n == 0:\n return n2\n else:\n for i in range(0, n - 1):\n sum = n1 + n2\n n1 = n2\n n2 =...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class ModelExtractor(object): def __init__(self, modelzip): self.modelzip = modelzip def __enter__(self): if not self.__is_model_good(): raise ValueError('Invalid model zip file') obj = self.__get_obj_filename() if obj is None: ...
flexible
{ "blob_id": "04670041dab49f8c2d4a0415030356e7ea92925f", "index": 902, "step-1": "<mask token>\n\n\nclass ModelExtractor(object):\n\n def __init__(self, modelzip):\n self.modelzip = modelzip\n\n def __enter__(self):\n if not self.__is_model_good():\n raise ValueError('Invalid model ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': data = load_data('train.json') words = text_to_words(get_all_text(data), as_set=False) cnt = Counter(words) save_il_to_word_cloud_file('cloudofw.txt', cnt, len(words), call_R=True) <|re...
flexible
{ "blob_id": "b3bba1119bfaf0c1e684e8835259ec6fa8c42cf7", "index": 1838, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n data = load_data('train.json')\n words = text_to_words(get_all_text(data), as_set=False)\n cnt = Counter(words)\n save_il_to_word_cloud_file('clou...
[ 0, 1, 2, 3 ]
from django.urls import path from django.conf.urls.i18n import urlpatterns from . import views urlpatterns = [ path('signup/', views.signup, name='signup'), path('home', views.home, name='home'), path('collab/', views.collab, name='collab'), ]
normal
{ "blob_id": "351963bee76ecaa9fa5c8d659f6d7c6ca9b22531", "index": 2182, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('signup/', views.signup, name='signup'), path('home',\n views.home, name='home'), path('collab/', views.collab, name='collab')]\n", "step-3": "from django.urls im...
[ 0, 1, 2, 3 ]
from robot.libraries.BuiltIn import BuiltIn from RoboGalaxyLibrary.utilitylib import logging as logger import re def block_no_keyword_warn(): pass class Compare_hpMCTP(object): def __init__(self): self.fusionlib = BuiltIn().get_library_instance('FusionLibrary') def do(self, expect, actual, ver...
normal
{ "blob_id": "17ba6aaa9009c258136b184ca6a8660cec1cfe40", "index": 3752, "step-1": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n\n def do(self, expect, actual, verbose=False):\n\n d...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> class Compare_hpMCTP(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Compare_hpMCTP(object): <|reserved_special_token_0|> def do(self, expect, actual, verbose=False): def smar...
flexible
{ "blob_id": "17ba6aaa9009c258136b184ca6a8660cec1cfe40", "index": 3752, "step-1": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n\n def do(self, expect, actual, verbose=False):\n\n d...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fibonacciModified(t1, t2, n): ti = t1 ti_1 = t2 for i in range(2, n): ti_2 = ti + ti_1 ** 2 ti = ti_1 ti_1 = ti_2 return ti_2 <|reserved_special_token_0|> <|reserved_special_token_...
flexible
{ "blob_id": "3838df627318b25767738da912f44e494cef40f3", "index": 6833, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fibonacciModified(t1, t2, n):\n ti = t1\n ti_1 = t2\n for i in range(2, n):\n ti_2 = ti + ti_1 ** 2\n ti = ti_1\n ti_1 = ti_2\n return ti_2\n\n\n<...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 # __author__ = 'lyl' import json import csv import sys reload(sys) sys.setdefaultencoding('utf-8') def read_json(filename): """ 读取json格式的文件 :param filename: json文件的文件名 :return: [{}, {}, {}, {}, {},{} ......] """ return json.loads(open(filename).read()) def...
normal
{ "blob_id": "7531480f629c1b3d28210afac4ef84b06edcd420", "index": 3825, "step-1": "<mask token>\n\n\ndef write_csv(filename, data_list):\n \"\"\"\n 将python对象 [{}, {}. {}, {} ...] 写入到csv文件中\n :param filename: 生成的csv文件名\n :param data_list: [{}, {}. {}, {} ...]\n :return: None\n \"\"\"\n with ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class AIns: <|reserved_special_token_0|> <|reserved_special_token_0|> class CIns: comp = {'0': '101010', '1': '111111', '-1': '111010', 'D': '001100', 'A': '110000', 'M': '110000', '!D': '001101', '!A': '110001', '!M': '110001', '-D': '001111', '-A': '110011'...
flexible
{ "blob_id": "11e9e4dd5c9c6158fed40080d4cc221f28a0eba0", "index": 8097, "step-1": "<mask token>\n\n\nclass AIns:\n <mask token>\n <mask token>\n\n\nclass CIns:\n comp = {'0': '101010', '1': '111111', '-1': '111010', 'D': '001100',\n 'A': '110000', 'M': '110000', '!D': '001101', '!A': '110001', '!M...
[ 9, 14, 15, 16, 19 ]
""" Utilities used by other modules. """ import csv import datetime import hashlib import json import re import string import subprocess import uuid import xml.etree.ElementTree as ET from alta import ConfigurationFromYamlFile from pkg_resources import resource_filename from ..__details__ import __appname__ from appd...
normal
{ "blob_id": "b16c847912944e0563492d35768b5b5bf3a506c7", "index": 1569, "step-1": "<mask token>\n\n\nclass IEMRunInfoReader:\n \"\"\"\n Illumina Experimental Manager RunInfo xml reader.\n \"\"\"\n\n def __init__(self, f):\n self.xml_file = f\n self.tree = ET.parse(self.xml_file)\n ...
[ 25, 27, 28, 36, 38 ]
from flask import render_template, request, Response from flask.views import MethodView, View from flask.views import View from repo import ClassifierRepo from services import PredictDigitService from settings import CLASSIFIER_STORAGE class IndexView(View): def dispatch_request(self): return render_temp...
normal
{ "blob_id": "3ea42e7ad5301314a39bf522280c084342cd18c5", "index": 332, "step-1": "<mask token>\n\n\nclass PredictDigitView(MethodView):\n\n def post(self):\n repo = ClassifierRepo(CLASSIFIER_STORAGE)\n service = PredictDigitService(repo)\n image_data_uri = request.json['image']\n pr...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ErrorResponseCollection(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class ResponseCollection(object): def __init__(self, message=None, data=None): self.message = message self.data = data if ...
flexible
{ "blob_id": "ade4d797a83eaa06e8bde90972a56376d7e0f55a", "index": 6086, "step-1": "<mask token>\n\n\nclass ErrorResponseCollection(object):\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass ResponseCollection(object):\n\n def __init__(self, message=None, data=None):\n self.message = messa...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> root.title('Expanding GUI') <|reserved_special_token_0|> my_label.pack() <|reserved_special_token_0|> buttonquit.pack() root.mainloop() <|reserved_special_token_1|> <|reserved_special_token_0|> root = Tk() root.title('Expanding...
flexible
{ "blob_id": "2da10163a40c9720ca9deecd9afb0e39aa885546", "index": 5523, "step-1": "<mask token>\n", "step-2": "<mask token>\nroot.title('Expanding GUI')\n<mask token>\nmy_label.pack()\n<mask token>\nbuttonquit.pack()\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nroot.title('Expanding GUI')\nmy_im...
[ 0, 1, 2, 3, 4 ]
import sgc import multiprocessing as mp # import json import argparse import os import re #Process argument passed to the script parser = argparse.ArgumentParser(description='Execute commands parallel on remote servers') parser.add_argument('-f', action='store', required=True, dest='file', help='servers list') group...
normal
{ "blob_id": "ace7e5676fcb01c3542952eaacdada9963b8467a", "index": 5168, "step-1": "<mask token>\n\n\ndef worker(server, commands):\n output = {}\n output['server'] = server\n session = sgc.Ssh(server=server)\n if session.ping == 'Alive':\n session.connect()\n if session.connection == Fal...
[ 1, 2, 3, 4, 5 ]
# helper functions to handle intcode from collections import defaultdict def read_code(string): """ string should be a comma-separated string. """ code = defaultdict(int) for i, x in enumerate(string.split(',')): code[i] = int(x) return code def to_ascii(line): """ Writes a ...
normal
{ "blob_id": "68c2fd1d8ca9e1dd9373ca9f641c2920c87b2392", "index": 1346, "step-1": "<mask token>\n\n\nclass IntCode:\n\n def __init__(self, code):\n self.code = code\n self.base = 0\n self.idx = 0\n self.terminated = False\n\n @staticmethod\n def load_code(code_string):\n ...
[ 10, 11, 12, 13, 14 ]
import subprocess class Audio: def __init__(self): self.sox_process = None def kill_sox(self, timeout=1): if self.sox_process is not None: self.sox_process.terminate() try: self.sox_process.wait(timeout=timeout) except subprocess.TimeoutExpir...
normal
{ "blob_id": "d35d26cc50da9a3267edd2da706a4b6e653d22ac", "index": 6555, "step-1": "<mask token>\n\n\nclass Audio:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Audio:\n\n def __init__(self):...
[ 1, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> dbutils.widgets.removeAll() dbutils.widgets.text('input_path', 'Not found', 'input_path') <|reserved_special_token_0|> dbutils.widgets.text('model_path', 'Not found', 'model_path') <|reserved_special_token_0|> if test: print(d...
flexible
{ "blob_id": "e48addecdde632607a9c782ff78a769122daab6f", "index": 1738, "step-1": "<mask token>\n", "step-2": "<mask token>\ndbutils.widgets.removeAll()\ndbutils.widgets.text('input_path', 'Not found', 'input_path')\n<mask token>\ndbutils.widgets.text('model_path', 'Not found', 'model_path')\n<mask token>\nif t...
[ 0, 1, 2, 3, 4 ]
from pymongo import MongoClient, GEOSPHERE, GEO2D import os, sys, json, pprint sys.path.insert(0, '../utils') import path_functions client = MongoClient( 'localhost', 27017 ) db = client[ 'nfcdata' ] json_files_path_list = path_functions.get_json_files('../../ftp-data/geojson-files/quikscat-l2b12') for json_fil...
normal
{ "blob_id": "cceda9a8a0188499ae0aa588701bb8104b5ed313", "index": 1041, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, '../utils')\n<mask token>\nfor json_file in json_files_path_list:\n current_collection = ('GeoJSON-quikscat-l2b12-' + path_functions.\n get_file_name(json_fil...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv('PLOTTER_ROOT', '~/.plotter/mainnet'))).resolve() <|reserved_special_token_1|> import os from pathlib import Path DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv('...
flexible
{ "blob_id": "3a8164299fa51b7d781f2b80d77cfba05b5f6915", "index": 4157, "step-1": "<mask token>\n", "step-2": "<mask token>\nDEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv('PLOTTER_ROOT',\n '~/.plotter/mainnet'))).resolve()\n", "step-3": "import os\nfrom pathlib import Path\nDEFAULT_ROOT_PATH = Path...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for song in songs: track, title = song print(' track number {}\t, title {}'.format(track, title)) <|reserved_special_token_1|> Album, artist, year, songs = 'More Mayhem', 'Imelda May', 2001, ((1, 'pulling the rug'),...
flexible
{ "blob_id": "30f02b956af68960804f0cb57695bdbf8510bc43", "index": 7290, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor song in songs:\n track, title = song\n print(' track number {}\\t, title {}'.format(track, title))\n", "step-3": "Album, artist, year, songs = 'More Mayhem', 'Imelda May', 200...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DrawingBrush: def __init__(self, size, color, radius): self.drawSurface = pygame.Surface(size, pygame.SRCALPHA, 32 ).convert_alpha() self.drawColor = color self.size = radius self.winSize = size self.winSurface = pygame.displa...
flexible
{ "blob_id": "45658cdfcd1529bbf803294cd7cec32d6d2c2198", "index": 7638, "step-1": "<mask token>\n\n\nclass DrawingBrush:\n\n def __init__(self, size, color, radius):\n self.drawSurface = pygame.Surface(size, pygame.SRCALPHA, 32\n ).convert_alpha()\n self.drawColor = color\n self...
[ 3, 4, 5, 6, 7 ]
"""CPU functionality.""" import sys HLT = 0b00000001 LDI = 0b10000010 PRN = 0b01000111 MUL = 0b10100010 PUSH = 0b01000101 POP = 0b01000110 CMP = 0b10100111 CALL = 0b01010000 RET = 0b00010001 ADD = 0b10100000 CMP = 0b10100111 JMP = 0b01010100 JEQ = 0b01010101 JNE = 0b01010110 AND = 0b10101000 NOT = 0b01101001 OR = 0b10...
normal
{ "blob_id": "58d144b2c6c307719cef0b5097945c8206135ccf", "index": 6048, "step-1": "<mask token>\n\n\nclass CPU:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def op_ldi(self, operand_a, operand_b):\n self.reg[operand_a] = operand_b\n\n def op_prn(self, ...
[ 13, 22, 23, 27, 32 ]
# models.py- Team from django.db import models class Team(models.Model): teamName = models.TextField() #Seasons associated #Registrants unique return
normal
{ "blob_id": "331b5f0a34db4d12d713439db3d2818e8c922310", "index": 4236, "step-1": "<mask token>\n\n\nclass Team(models.Model):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Team(models.Model):\n teamName = models.TextField()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ncl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', views.homepage, name='homepage'), url('^search/', views.my_search_view, name='article_detail')] <|reserved_special_token_1|> from django.conf.urls import url from myapp import views urlpatterns = [u...
flexible
{ "blob_id": "388e43850a2e114cfe7869293ee814831a088b3e", "index": 8468, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.homepage, name='homepage'), url('^search/',\n views.my_search_view, name='article_detail')]\n", "step-3": "from django.conf.urls import url\nfrom myapp...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class StackFrontExtractor(FrontExtractorOp): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StackFrontExtractor(FrontExtractorOp): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "dd71feda1ed5ff7ef9dee1573ad63939a3e09691", "index": 7526, "step-1": "<mask token>\n\n\nclass StackFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StackFrontExtractor(FrontExtractorOp):\n <mask token>\n <mask token...
[ 1, 2, 3, 4, 5 ]
from __future__ import annotations from VersionControl.Branch import Branch from Branches.Actions.Actions import Actions from VersionControl.Git.Branches.Develop.Init import Init class Develop(Branch): def process(self): if self.action is Actions.INIT: self.start_message('Develop Init') ...
normal
{ "blob_id": "338bf2406c233d857e1a688391161d58e1dab23c", "index": 8910, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Develop(Branch):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Develop(Branch):\n\n def process(self):\n if self.action is Actions.INIT:\n self...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class settings: def __init__(self, xmax, xmin, ymax, ymin, yrange, xrange): self.xmax = xmax self.xmin = xmin self.ymax = ymax self.ymin = ymin self.yrange = yrange self.xrange = xrange pass <|reserved_special_token_0|> clas...
flexible
{ "blob_id": "e4a66617adbe863459e33f77c32c89e901f66995", "index": 2309, "step-1": "<mask token>\n\n\nclass settings:\n\n def __init__(self, xmax, xmin, ymax, ymin, yrange, xrange):\n self.xmax = xmax\n self.xmin = xmin\n self.ymax = ymax\n self.ymin = ymin\n self.yrange = yra...
[ 7, 8, 9, 11, 12 ]
try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET import data_helpers def write_to_file(file,line): file.write(line+"\n") def cat_map(): catmap={} id=1 f=open("cat") cat=set([s.strip() for s in list(f.readlines())]) for i in cat: catmap[i]=id id=id+1 return c...
normal
{ "blob_id": "04538cc5c9c68582cc9aa2959faae2d7547ab2ee", "index": 302, "step-1": "<mask token>\n\n\ndef write_to_file(file, line):\n file.write(line + '\\n')\n\n\n<mask token>\n", "step-2": "try:\n import xml.etree.cElementTree as ET\nexcept ImportError:\n import xml.etree.ElementTree as ET\n<mask toke...
[ 1, 3, 4, 5, 6 ]
# Taken from: https://github.com/flyyufelix/cnn_finetune/blob/master/vgg16.py # based on: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3 # -*- coding: utf-8 -*- import keras import itertools import sys from sklearn.metrics import confusion_matrix import numpy as np import matplotlib import ma...
normal
{ "blob_id": "906b7f02d6a7968bbf4780e682d4f9a92526326a", "index": 9123, "step-1": "\r\n# Taken from: https://github.com/flyyufelix/cnn_finetune/blob/master/vgg16.py \r\n# based on: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3\r\n\r\n# -*- coding: utf-8 -*-\r\nimport keras\r\nimport itertools\r\nimp...
[ 0 ]
from rest_framework import serializers from django.contrib.auth import password_validation from rest_framework.validators import UniqueValidator from .models import CustomUser, Role, Permission, ActionEntity from .utils import create_permission class ActionEntitySerializer(serializers.ModelSerializer): id = ser...
normal
{ "blob_id": "b10a50ce649650542d176a2f6fb8c35c500fbc38", "index": 3644, "step-1": "<mask token>\n\n\nclass UserCreateSerializer(serializers.ModelSerializer):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = CustomUser\n fields =...
[ 7, 17, 18, 23, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, n + 1): if i % 2 == 1: print('1 ', end='') else: print('0 ', end='') <|reserved_special_token_1|> n = int(input("Please input the number of 1's and 0's you want to print:")) for i in ra...
flexible
{ "blob_id": "bd96b31c5de2f0ad4bbc28c876b86ec238db3184", "index": 9108, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n if i % 2 == 1:\n print('1 ', end='')\n else:\n print('0 ', end='')\n", "step-3": "n = int(input(\"Please input the number of 1's and 0's ...
[ 0, 1, 2, 3 ]
import sys def read(inp): res = [] n, v = map(int, inp.readline().split()) for i in range(n): x, y = map(int, inp.readline().split()) res.append((x, y)) return v, res def solve(v, items): res = 0 rem_v = v for item in items: if rem_v > item[1]: res +...
normal
{ "blob_id": "8b0e7e8f2031df217894e980758e15d7401c0981", "index": 2750, "step-1": "<mask token>\n\n\ndef read(inp):\n res = []\n n, v = map(int, inp.readline().split())\n for i in range(n):\n x, y = map(int, inp.readline().split())\n res.append((x, y))\n return v, res\n\n\n<mask token>\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2 * int(input())): a.append(int(input())) if 1 in a: c = a.index(max(a)) if a[c + 1] == 1: print(c) else: del a[c] s = a.index(max(a)) if a[s + 1] == 1: pr...
flexible
{ "blob_id": "e3e50df47ef074f13382e249832c065ebdce18a6", "index": 8406, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2 * int(input())):\n a.append(int(input()))\nif 1 in a:\n c = a.index(max(a))\n if a[c + 1] == 1:\n print(c)\n else:\n del a[c]\n s = a.ind...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: print('\nPlayer Items:') for item in player.items: print('\t', item) print('Room - ', player.current_room) print('Items in Room:') for item in player.current_room.items: print('\t', ...
flexible
{ "blob_id": "beb536b6d8883daaa7e41da03145dd98aa223cbf", "index": 5036, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n print('\\nPlayer Items:')\n for item in player.items:\n print('\\t', item)\n print('Room - ', player.current_room)\n print('Items in Room:')\n for item...
[ 0, 1, 2, 3, 4 ]
def check_orthogonal(u, v): return u.dot(v) == 0 def check_p(): import inspect import re local_vars = inspect.currentframe().f_back.f_locals return len(re.findall("p\\s*=\\s*0", str(local_vars))) == 0
normal
{ "blob_id": "36e538ca7fbdbf6e2e6ca1ae126e4e75940bb5cd", "index": 4316, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_p():\n import inspect\n import re\n local_vars = inspect.currentframe().f_back.f_locals\n return len(re.findall('p\\\\s*=\\\\s*0', str(local_vars))) == 0\n", "...
[ 0, 1, 2, 3 ]
import sys heights = [] for i in range(10): line = sys.stdin.readline() height = int(line) heights.append(height) heights.sort() heights.reverse() for i in range(3): print(heights[i])
normal
{ "blob_id": "3e48de2e3b12965de1b3b5cb6c3cf68c90ec6212", "index": 2274, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(10):\n line = sys.stdin.readline()\n height = int(line)\n heights.append(height)\nheights.sort()\nheights.reverse()\nfor i in range(3):\n print(heights[i])\n", ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import sys def add_them(a, b): return a + b def main(): print add_them(10, 21) if __name__ == '__main__': sys.exit(main())
normal
{ "blob_id": "aebf1d64923c5f325c9d429be092deaa06f20963", "index": 6232, "step-1": "#!/usr/bin/env python\n\nimport sys\n\ndef add_them(a, b):\n return a + b\n\ndef main():\n print add_them(10, 21)\n\nif __name__ == '__main__':\n sys.exit(main())\n", "step-2": null, "step-3": null, "step-4": null, ...
[ 0 ]
#Merge Sort #O(nlogn) #Merge Part from __future__ import division #use for python2 def merge(A, B): #Merge A[0:m], B[0,n] (C, m, n) = ([], len(A), len(B)) (i, j) = (0, 0) #Current positions in A, B while (i + j) < (m + n): #i+j is no. of elements merged so far ...
normal
{ "blob_id": "7b4c2689ad1d4601a108dd8aa6e3c4d1e9730dc5", "index": 5257, "step-1": "<mask token>\n\n\ndef merge(A, B):\n C, m, n = [], len(A), len(B)\n i, j = 0, 0\n while i + j < m + n:\n if i == m:\n C.append(B[j])\n j = j + 1\n elif j == n:\n C.append(A[i]...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(A): N = len(A) min_avg = (A[0] + A[1]) / 2.0 min_idx = 0 now_avg = 0.0 for i in xrange(1, N - 1): now_avg = (A[i] + A[i + 1]) / 2.0 if now_avg < min_avg: min_avg = now_avg min_idx = i ...
flexible
{ "blob_id": "caa92eb5582135f60a6034cb83d364501361d00e", "index": 7726, "step-1": "<mask token>\n", "step-2": "def solution(A):\n N = len(A)\n min_avg = (A[0] + A[1]) / 2.0\n min_idx = 0\n now_avg = 0.0\n for i in xrange(1, N - 1):\n now_avg = (A[i] + A[i + 1]) / 2.0\n if now_avg < ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class VehicleViewSet(viewsets.ModelViewSet): queryset = Vehicle.objects.all().order_by('id') serializer_class = VehicleSerializer permission_classes = [permissions.IsAuthenticated] <|reserved_special_token_1|> <|reserved_special_token_0|> class OwnerViewSet(viewsets.Model...
flexible
{ "blob_id": "9290294b5df081ef0cae5450a9ea3baef789c041", "index": 6421, "step-1": "<mask token>\n\n\nclass VehicleViewSet(viewsets.ModelViewSet):\n queryset = Vehicle.objects.all().order_by('id')\n serializer_class = VehicleSerializer\n permission_classes = [permissions.IsAuthenticated]\n", "step-2": "...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Sorts: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Sorts: def quick_sort(self, elements): """quick sort implementation""" if len(elements) < 2:...
flexible
{ "blob_id": "2044140fb2678f9507946007fdfb7edbaf11798e", "index": 5683, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Sorts:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Sorts:\n\n def quick_sort(self, elements):\n \"\"\"quick sort implementation\"\"\"\n if len(el...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # project: fshell # author: s0nnet # time: 2017-01-08 # desc: data_fuzzhash import sys sys.path.append("./dao") from fss_data_fuzzhash_dao import * class FssFuzzHash: @staticmethod def insert_node(agent_id, data): return FssFuzzHashDao.insert_node(agent_id, data)
normal
{ "blob_id": "398f9f52b83ffddfb452abbeaad2e83610580fee", "index": 9763, "step-1": "<mask token>\n\n\nclass FssFuzzHash:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FssFuzzHash:\n\n @staticmethod\n def insert_node(agent_id, data):\n return FssFuzzHashDao.insert_node(agent_id, data)\n", ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from yuancloud import models, fields, api, _ import yuancloud.addons.decimal_precision as dp from yuancloud.exceptions import UserError from yuancloud.osv import fields as old_fields class event_event(models.Model): _inherit = 'event.event' event_ticket_ids = fields.One2many( ...
normal
{ "blob_id": "bddba2fd710829db17c6419878ce535df0aba01c", "index": 2760, "step-1": "<mask token>\n\n\nclass event_ticket(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 7, 12, 14, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if A <= X and A + B >= X: print('YES') else: print('NO') <|reserved_special_token_1|> a = input().split(' ') A = int(a[0]) B = int(a[1]) X = int(a[2]) if A <= X and A + B >= X: print('YES') else: print('NO')
flexible
{ "blob_id": "9a60449aa13bc5e7e413d0e47a1972d93ccfe69f", "index": 7194, "step-1": "<mask token>\n", "step-2": "<mask token>\nif A <= X and A + B >= X:\n print('YES')\nelse:\n print('NO')\n", "step-3": "a = input().split(' ')\nA = int(a[0])\nB = int(a[1])\nX = int(a[2])\nif A <= X and A + B >= X:\n pr...
[ 0, 1, 2 ]
from pig_util import outputSchema @outputSchema('word:chararray') def reverse(word): """ Return the reverse text of the provided word """ return word[::-1] @outputSchema('length:int') def num_chars(word): """ Return the length of the provided word """ return len(word)
normal
{ "blob_id": "94560d8f6528a222e771ca6aa60349d9682e8f4b", "index": 6558, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@outputSchema('word:chararray')\ndef reverse(word):\n \"\"\"\n Return the reverse text of the provided word\n \"\"\"\n return word[::-1]\n\n\n<mask token>\n", "step-3": "<...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Primera consulta SQL Server') <|reserved_special_token_0|> print('Intentando conectar...') <|reserved_special_token_0|> print('Conectado!!!') <|reserved_special_token_0|> cursor.execute(sql) <|reserved_special_token_0|> pri...
flexible
{ "blob_id": "0438f92aa9a36eaf1059244ec3be4397381f7a86", "index": 6703, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Primera consulta SQL Server')\n<mask token>\nprint('Intentando conectar...')\n<mask token>\nprint('Conectado!!!')\n<mask token>\ncursor.execute(sql)\n<mask token>\nprint(row)\n<mas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def save(parameters): with open('saves/save.zs', 'wb') as game_save: dump(parameters, game_save) game_save.close() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "9d27b8844ab4070bb53afd89620177b89013956e", "index": 4164, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save(parameters):\n with open('saves/save.zs', 'wb') as game_save:\n dump(parameters, game_save)\n game_save.close()\n\n\n<mask token>\n", "step-3": "<mask toke...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def compare(long, short): print(len(long) > len(short)) <|reserved_special_token_0|> def exchange(a, b): b = b - a a = a + b b = a - b print('a=', a, 'b=', b) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def compare(...
flexible
{ "blob_id": "f29637cd670524baebac6549962a1c50fc1b91c6", "index": 6835, "step-1": "<mask token>\n\n\ndef compare(long, short):\n print(len(long) > len(short))\n\n\n<mask token>\n\n\ndef exchange(a, b):\n b = b - a\n a = a + b\n b = a - b\n print('a=', a, 'b=', b)\n\n\n<mask token>\n", "step-2": "...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, n): for j in range(i + 1, n): for k in range(j + 1, n): tmp = li[i] + li[j] + li[k] if tmp <= m and max < tmp: max = tmp print(max) <|reserved_special_token_1...
flexible
{ "blob_id": "83d0a32ef2d365d17caa9d311c367ed5828559ac", "index": 4153, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, n):\n for j in range(i + 1, n):\n for k in range(j + 1, n):\n tmp = li[i] + li[j] + li[k]\n if tmp <= m and max < tmp:\n m...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class EtherminePool(BasePool): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def build_creation_parameters(self, pool, pool_attrs, pool_classname): params = super(EtherminePool, self).build_...
flexible
{ "blob_id": "921c7255fad46c767f2ec1030ef9498da05b9bb1", "index": 9958, "step-1": "<mask token>\n\n\nclass EtherminePool(BasePool):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build_creation_parameters(self, pool, pool_attrs, pool_classname):\n params = super(Ethermin...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class DISTRICT: def __init__(self, cdcode, county, district, street, city, zipcode, state, mailstreet, mailcity, mailzip, mailstate, phone, extphone, faxnumber, email, admfname, admlname, admemail, lat, long, distrownercode, doctype, statustype, lastupdate): ...
flexible
{ "blob_id": "462d73195680118d19a3d4e8a855e65aaeecb3c6", "index": 892, "step-1": "<mask token>\n\n\nclass DISTRICT:\n\n def __init__(self, cdcode, county, district, street, city, zipcode,\n state, mailstreet, mailcity, mailzip, mailstate, phone, extphone,\n faxnumber, email, admfname, admlname, a...
[ 5, 9, 10, 12, 13 ]
<|reserved_special_token_0|> class TestTask(unittest.TestCase): <|reserved_special_token_0|> def test_init_bad_invalid_filename(self): task_attr = [ 'filename=C:\\Users\\kcheng\\PycharmProjects\\first_project\\sadfsda.py' , 'frequency=1D', 'time=09:45', 'description=invalid fi...
flexible
{ "blob_id": "86c053b7d4c752182965755ad5b6ba6937ce6f86", "index": 5984, "step-1": "<mask token>\n\n\nclass TestTask(unittest.TestCase):\n <mask token>\n\n def test_init_bad_invalid_filename(self):\n task_attr = [\n 'filename=C:\\\\Users\\\\kcheng\\\\PycharmProjects\\\\first_project\\\\sadf...
[ 2, 5, 6, 7, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_last(s): try: return max(s) except: return s <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> OUTPUT_EXCEL = '월별원내약품사용현황.xlsx' data_source_dir = '사용량월별통계...
flexible
{ "blob_id": "16b425d7b8cde1aabe038ccae6922091afb84415", "index": 411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_last(s):\n try:\n return max(s)\n except:\n return s\n\n\n<mask token>\n", "step-3": "<mask token>\nOUTPUT_EXCEL = '월별원내약품사용현황.xlsx'\ndata_source_dir = '사...
[ 0, 1, 3, 4, 5 ]
<|reserved_special_token_0|> class Beautyleg7Spider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def parse(self, response): if self.db_s...
flexible
{ "blob_id": "eb853e430b996a81dc2ef20c320979a3e04d956a", "index": 237, "step-1": "<mask token>\n\n\nclass Beautyleg7Spider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n if self.db_session is No...
[ 3, 6, 8, 9, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def grouping(w): d = dd(list) for k, v in ((len([y for y in x if y.isupper()]), x) for x in sorted(w, key=str.casefold)): d[k].append(v) return dict(sorted(d.items())) <|reserved_special_token_1|> ...
flexible
{ "blob_id": "545794cf4f0b2ab63b6a90951a78f8bdaca3c9e6", "index": 390, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef grouping(w):\n d = dd(list)\n for k, v in ((len([y for y in x if y.isupper()]), x) for x in sorted(w,\n key=str.casefold)):\n d[k].append(v)\n return dict(so...
[ 0, 1, 2 ]
#!/usr/bin/python3 """ list = list(range(97, 123) for (i in list): if (i % 2 == 0): i = (i - 32) """ for letter in "zYxWvUtSrQpOnMlKjIhGfEdCbA": print('{:s}'.format(letter), end = "")
normal
{ "blob_id": "55a061a1c0cd20e5ab7413c671bc03573de1bbdf", "index": 7754, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor letter in 'zYxWvUtSrQpOnMlKjIhGfEdCbA':\n print('{:s}'.format(letter), end='')\n", "step-3": "#!/usr/bin/python3\n\"\"\"\nlist = list(range(97, 123)\nfor (i in list):\n if (i ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', ListUser.as_view(), name='list'), path('register/', UserRegister.as_view(), name='register'), path('login/', UserLogin. as_view(), name='login'), path('delete/', UserDelete.as_view(), name= 'del...
flexible
{ "blob_id": "5fe4f2738285d2f4b8bbfee2c4c6d15665737ea4", "index": 8627, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', ListUser.as_view(), name='list'), path('register/',\n UserRegister.as_view(), name='register'), path('login/', UserLogin.\n as_view(), name='login'), path('d...
[ 0, 1, 2, 3 ]
import sys import random #coming into existence, all does not begin and end at this moment; #not yet fully conscious, you pick up only snippets of your environment for line in sys.stdin: line = line.strip() randLow = random.randint(0, 10) randHigh = random.randint(11, 20) print line[randLow:randHigh]
normal
{ "blob_id": "f3d61a9aa4205e91811f17c4e9520811445cc6a9", "index": 3957, "step-1": "import sys\nimport random\n\n#coming into existence, all does not begin and end at this moment; \n#not yet fully conscious, you pick up only snippets of your environment\nfor line in sys.stdin:\n\tline = line.strip()\n\n\trandLow =...
[ 0 ]
<|reserved_special_token_0|> def kepler(mean_anomaly, eccentricity): mean_anomaly = np.ascontiguousarray(mean_anomaly, dtype=np.float64) eccentricity = np.ascontiguousarray(eccentricity, dtype=np.float64) sinf = np.empty_like(mean_anomaly) cosf = np.empty_like(mean_anomaly) driver.solve_kepler(mea...
flexible
{ "blob_id": "ccd32a6ca98c205a6f5d4936288392251522db29", "index": 4896, "step-1": "<mask token>\n\n\ndef kepler(mean_anomaly, eccentricity):\n mean_anomaly = np.ascontiguousarray(mean_anomaly, dtype=np.float64)\n eccentricity = np.ascontiguousarray(eccentricity, dtype=np.float64)\n sinf = np.empty_like(m...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def calculate(self, s: str) ->int: nums = [] ops = [] def cal(): a = nums.pop() b = nums.pop() c...
flexible
{ "blob_id": "0ff8743e54509a76e9a7add4be9da279bdee82a6", "index": 5032, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def calculate(self, s: str) ->int:\n nums = []\n ops = []\n\n def cal():\n a = nums.pop()\n ...
[ 0, 1, 2 ]
import random import colorama from termcolor import colored from reusables.string_manipulation import int_to_words from app.common_functions import comma_separated, add_dicts_together, remove_little_words, odds from app.load_data import items, buildings, wild_mobs, names, adjectives colorama.init() def find_uniqu...
normal
{ "blob_id": "535c0975c688a19963e4c53f6029626d286b41d6", "index": 5630, "step-1": "<mask token>\n\n\nclass Player:\n\n def __init__(self, name, location):\n self.name = name\n self.location = location\n self.square = None\n self.money = 0\n self.quest = None\n self.job...
[ 23, 31, 32, 38, 42 ]
__version__ = '3.13.7'
normal
{ "blob_id": "01852f6dbeb78df3098b14d2f0538ad9193ea511", "index": 9873, "step-1": "<mask token>\n", "step-2": "__version__ = '3.13.7'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from ParseTree import ParseTree from Node import Node from NodeInfo import NodeInfo from TreeAdjustor import TreeAdjustor from model.SchemaGraph import SchemaGraph class TreeAdjustorTest: schema = None def __init__(self): return def getAdjustedTreesTest(self): T = ParseTree() ...
normal
{ "blob_id": "1db397df2d030b2f622e701c46c15d653cb79e55", "index": 5079, "step-1": "<mask token>\n\n\nclass TreeAdjustorTest:\n <mask token>\n\n def __init__(self):\n return\n\n def getAdjustedTreesTest(self):\n T = ParseTree()\n nodes = [Node(index=-1, word='DEFAULT', posTag='DEFAULT...
[ 3, 4, 8, 9, 10 ]