code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python3 import sys import os import math import tempfile import zlib import lzma import struct import bitstruct # a swf file unpacker and analyzer # majority of information taken from https://www.adobe.com/devnet/swf.html (version 19) # some additional information taken from https://github.com/cla...
normal
{ "blob_id": "4556febd5fddf390f370a8e24871eacf08d34c9f", "index": 7087, "step-1": "<mask token>\n\n\nclass SWFRect(object):\n\n def __init__(self, xmin, xmax, ymin, ymax):\n self.xmin = xmin\n self.xmax = xmax\n self.ymin = ymin\n self.ymax = ymax\n\n def __str__(self):\n ...
[ 17, 18, 20, 22, 24 ]
# Generated by Django 2.2.7 on 2019-11-15 23:43 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('quizzapp', '0005_auto_20191115_2339'), ] operations = [ migrations.RemoveField( model_name='question', name='titre', ...
normal
{ "blob_id": "b2fa6104f03dc76522a51f352101cef199ddc665", "index": 675, "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 = [('quizzapp', '...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-08-24 22:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0026_auto_20160712_1541'), ] operations = [ migrations.CreateModel(...
normal
{ "blob_id": "04c1765e6c2302098be2a7f3242dfd536683f742", "index": 6138, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
import sys sys.path.append("..") from packages import bitso as BS from packages import account as ACCOUNT from packages import currency_pair as CP account=ACCOUNT.Account('577e4a03-540f9610-f686d434-qz5c4v5b6n','dd7b02f5-c286e9d4-f2cc78c3-bfab3') bs=BS.Bitso(account) currency_pair=CP.CurrencyPair('btc','xmn') depth=b...
normal
{ "blob_id": "03147de944c4f75417006a5087e75354dba644ec", "index": 6339, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('..')\n<mask token>\n", "step-3": "<mask token>\nsys.path.append('..')\n<mask token>\naccount = ACCOUNT.Account('577e4a03-540f9610-f686d434-qz5c4v5b6n',\n 'dd7b02f5-c...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.autodiscover() <|reserved_special_token_0|> urlpatterns += staticfiles_urlpatterns() urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) <|reserved_special_token_1|> <|reserved_special_token_0|> a...
flexible
{ "blob_id": "538e582df7bfcf281973a5296adc14ca067be0a5", "index": 2581, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\nurlpatterns += staticfiles_urlpatterns()\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n", "step-3": "<mask token>\na...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/python import math import sys import os import subprocess #PTYPES = [ "eth_ip_udp_head_t", "ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64ip64_64udp_head_t", "eth6464_64ip64_64udp_head_t" ] #PTYPES = [ "eth_ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64...
normal
{ "blob_id": "9101fc5b8ba04a1b72e0c79d5bf3e4118e1bad75", "index": 5676, "step-1": "#! /usr/bin/python\n\nimport math\nimport sys\nimport os\nimport subprocess\n\n\n#PTYPES = [ \"eth_ip_udp_head_t\", \"ip_udp_head_t\", \"eth_32ip_udp_head_t\", \"eth_64ip_udp_head_t\", \"eth64_64ip64_64udp_head_t\", \"eth6464_64ip...
[ 0 ]
<|reserved_special_token_0|> def test_playable_hts_in_hand(): assert playable_hts_in_hand(hand_3playable_hts) == 3 assert playable_hts_in_hand(hand_2playable_hts) == 2 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_playable_hts_in_hand(): assert play...
flexible
{ "blob_id": "43179b8b096836758271a791b4aacb7bbe398ea9", "index": 1807, "step-1": "<mask token>\n\n\ndef test_playable_hts_in_hand():\n assert playable_hts_in_hand(hand_3playable_hts) == 3\n assert playable_hts_in_hand(hand_2playable_hts) == 2\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_pl...
[ 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": "9905559909f10831373e659cde0f275dc5d71e0d", "index": 7041, "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 = [('training_ar...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): n, a, b = map(int, input().split()) print(tort(n, a, b)) <|reserved_special_token_0|> <|reserved_special_token_1|> def tort(n, a, b): return min(n * a, b) def main(): n, a, b = map(int, input()...
flexible
{ "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 ]
''' Author: Dustin Spicuzza Date: 3/22/2012 Description: This mode only feeds another robot, does not move or anything ''' class FeedOnlyAutonomousMode(object): # this name should be descriptive and unique. This will be shown to the user # on the SmartDashboard MODE_NAME = ...
normal
{ "blob_id": "3596ef12ce407a8d84319daa38a27a99ed0de763", "index": 5208, "step-1": "<mask token>\n\n\nclass FeedOnlyAutonomousMode(object):\n <mask token>\n <mask token>\n <mask token>\n\n def OnEnable(self):\n \"\"\"\n This function is called when Autonomous mode is enabled. You shou...
[ 3, 4, 5, 6, 7 ]
""" GetState Usage: get_state.py <pem-file> <ip-file> [options] Options: -h, --help print help message and exit --output DIR set the output directory [default: logs] """ from docopt import docopt import paramiko import os def get_logs(ip_addr, pem_file, log_dir): pem = paramiko.RSAKey...
normal
{ "blob_id": "a1df804325a074ed980ec864c72fe231e2968997", "index": 4024, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_logs(ip_addr, pem_file, log_dir):\n pem = paramiko.RSAKey.from_private_key_file(pem_file)\n client = paramiko.SSHClient()\n client.set_missing_host_key_policy(paramik...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'variables': {'node_shared_openssl%': 'true'}, 'targets': [{'target_name': 'keypair', 'sources': ['secp256k1/keypair.cc'], 'conditions': [[ 'OS=="win"', {'conditions': [['target_arch=="x64"', {'variables': { 'openssl_root%': 'C:/OpenSSL-Win64'}},...
flexible
{ "blob_id": "e7b30353fd25beb9d5cdeee688e4ffa6955d4221", "index": 8437, "step-1": "<mask token>\n", "step-2": "{'variables': {'node_shared_openssl%': 'true'}, 'targets': [{'target_name':\n 'keypair', 'sources': ['secp256k1/keypair.cc'], 'conditions': [[\n 'OS==\"win\"', {'conditions': [['target_arch==\"x6...
[ 0, 1, 2 ]
from tdm.lib.device import DddDevice, DeviceAction, DeviceWHQuery, Validity class CallJohnDevice(DddDevice): class MakeCall(DeviceAction): def perform(self, select_contact, select_number): contact = self.device.CONTACTS.get(select_contact) number_type = self.device.CONTACT...
normal
{ "blob_id": "1dd235ecfe577b508d0777e8c70026114aeb154f", "index": 6648, "step-1": "from tdm.lib.device import DddDevice, DeviceAction, DeviceWHQuery, Validity\r\n\r\n\r\nclass CallJohnDevice(DddDevice):\r\n\r\n class MakeCall(DeviceAction):\r\n def perform(self, select_contact, select_number):\r\n ...
[ 0 ]
# -*- coding: utf-8 -*- """ Copyright (C) 2015, MuChu Hsu Contributed by Muchu Hsu (muchu1983@gmail.com) This file is part of BSD license <https://opensource.org/licenses/BSD-3-Clause> """ import unittest import logging from cameo.spiderForCROWDCUBE import SpiderForCROWDCUBE """ 測試 抓取 CROWDCUBE """ class SpiderForCRO...
normal
{ "blob_id": "45856b4c5cbf1d3b414ad769135b2d974bc0a22b", "index": 7120, "step-1": "<mask token>\n\n\nclass SpiderForCROWDCUBETest(unittest.TestCase):\n\n def setUp(self):\n logging.basicConfig(level=logging.INFO)\n self.spider = SpiderForCROWDCUBE()\n self.spider.initDriver()\n <mask to...
[ 3, 4, 6, 7, 8 ]
# ------------------------------------# # Title: Mailroom Part 1 # Dev: SChang # Date: Feb 2nd, 2019 # ChangeLog: (Who, When, What) # SChang,02/02/2019, Created Script # ------------------------------------# import os import sys import math donor_list = {"William Gates": [1010, 2020, 3030], ...
normal
{ "blob_id": "f2292d1816699392663bdbf7a06c334de3b2022c", "index": 7118, "step-1": "<mask token>\n\n\ndef send_ty():\n DonorName = 'list'\n while DonorName == 'list':\n DonorName = input(\n '\"Provide Donor Full Name, or type: \"List\" to display a list of all donors => '\n )\n ...
[ 7, 9, 10, 12, 13 ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt import csv file_open = open("C:/Users/DI_Lab/Desktop/20년도 Kisti 과제/HMM/HMM(Up,Down).csv", 'r', encoding='UTF8') save_file = open("C:/Users/DI_Lab/Desktop/20년도 Kisti 과제/HMM/HMM사후확률.csv", 'w', encoding='UTF8',newline='') write = csv.writer(save_file)...
normal
{ "blob_id": "55977a673bb36900e1d797cb9ec330ce6d9aa717", "index": 8232, "step-1": "<mask token>\n\n\ndef count(a, b):\n a = int(a)\n b = int(b)\n if a == 0 and b == 0:\n return 0\n elif a == 0 and b == 1:\n return 1\n elif a == 1 and b == 0:\n return 2\n elif a == 1 and b ==...
[ 1, 2, 3, 4, 5 ]
from django.conf.urls.defaults import * #from wiki.feeds import * from django.conf import settings from django.conf.urls.defaults import * # feeds for wikiPages and wikiNews """ feeds = { 'latestpages': LatestPages, } sitemaps = { 'wiki': Wiki, } """ urlpatterns = patterns('', # Example: # (r'^goimcommu...
normal
{ "blob_id": "f44ff7488ae8fc64bc1785fb6cbe80c4cc011fbe", "index": 6808, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', ('^admin/', include('django.contrib.admin.urls')\n ), ('^polls/', include('goimcommunity.polls.urls')), ('^league/',\n include('goimcommunity.leaguesystem...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(b) print(c) <|reserved_special_token_1|> <|reserved_special_token_0|> a = hashlib.pbkdf2_hmac('sha256', b'hallo', b'salt', 1) b = hashlib.pbkdf2_hmac('sha256', a, b'salt', 1) c = hashlib.pbkdf2_hmac('sha256', b'hallo', b'...
flexible
{ "blob_id": "20ac73789fa7297a9230a6a2b814349d2b7da5fb", "index": 1851, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(b)\nprint(c)\n", "step-3": "<mask token>\na = hashlib.pbkdf2_hmac('sha256', b'hallo', b'salt', 1)\nb = hashlib.pbkdf2_hmac('sha256', a, b'salt', 1)\nc = hashlib.pbkdf2_hmac('sha25...
[ 0, 1, 2, 3, 4 ]
from unittest import TestCase from spiral.spiral_matrix import SpiralMatrix class TestOutwardCounterClockwise(TestCase): def test_traverse_empty(self): matrix = [] actual = [i for i in SpiralMatrix(matrix, clockwise=False, inward=False)] self.assertEqual([], actual) def test_traverse_...
normal
{ "blob_id": "84f6336261e1c276f029822754842514715791df", "index": 3604, "step-1": "<mask token>\n\n\nclass TestOutwardCounterClockwise(TestCase):\n <mask token>\n <mask token>\n\n def test_traverse_single_element(self):\n matrix = [[1]]\n actual = [i for i in SpiralMatrix(matrix, clockwise=...
[ 5, 7, 11, 14, 15 ]
import pymysql import pymssql import socket import threading from time import sleep address = ('127.0.0.1', 20176) usermode = {1: 'Wangcz_Students', 2: 'Wangcz_Teachers', 3: 'Wangcz_Admin' } def checkuser(username, password, cursor, user_db): cursor.execute('''select * from %s...
normal
{ "blob_id": "758e5b9a65132c4bdee4600e79c27f9c0f272312", "index": 8308, "step-1": "<mask token>\n\n\ndef checkuser(username, password, cursor, user_db):\n cursor.execute('select * from %s WHERE username = %d AND password = %d' %\n (user_db, int(username), int(password)))\n return cursor.fetchall()\n\...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 import cgitb import sys from auth import is_admin cgitb.enable() sys.stdout.write('Content-Type: application/octet-stream\n\n') sys.stdout.write('yes' if is_admin() else 'no') sys.stdout.flush()
normal
{ "blob_id": "be9972d899a167a8ca2728960e55cda538793cc5", "index": 1576, "step-1": "<mask token>\n", "step-2": "<mask token>\ncgitb.enable()\nsys.stdout.write('Content-Type: application/octet-stream\\n\\n')\nsys.stdout.write('yes' if is_admin() else 'no')\nsys.stdout.flush()\n", "step-3": "import cgitb\nimport...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico): lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico] return lixos[n]
flexible
{ "blob_id": "71a9c9b8f47dcfbecc154c44d5a72ddbd852145a", "index": 328, "step-1": "<mask token>\n", "step-2": "def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico):\n lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico]\n return lixos...
[ 0, 1 ]
from PyQt4 import QtGui from PyQt4.QtCore import pyqtSignal, pyqtSlot, QObject, Qt from twisted.internet.defer import inlineCallbacks import numpy as np from connection import connection import pyqtgraph as pg from pyqtgraph.SignalProxy import SignalProxy import sys import time global harwareConfiguration class grap...
normal
{ "blob_id": "8173afbd82b8da04db4625ac686c0d052e65a21c", "index": 9470, "step-1": "<mask token>\n\n\nclass graphingwidget(QtGui.QWidget):\n <mask token>\n <mask token>\n\n def __init__(self, reactor, configpath):\n super(graphingwidget, self).__init__()\n self.reactor = reactor\n sel...
[ 7, 8, 9, 10, 11 ]
n=int(input("Enter any int number:\n")) x=1 while(x<13): print(n ," x ", x ," = ", n*x) x=x+1
normal
{ "blob_id": "a6c07146f1cbc766cd464dab620d1fb075759c12", "index": 4213, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile x < 13:\n print(n, ' x ', x, ' = ', n * x)\n x = x + 1\n", "step-3": "n = int(input('Enter any int number:\\n'))\nx = 1\nwhile x < 13:\n print(n, ' x ', x, ' = ', n * x)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @user.route('/users/add', methods=['GET', 'POST']) def add_user(): """ load form page and add to the database """ if request.method == 'POST': user = User(username=request.form['username'], password=request. form['password'], is_admin=request.form.getli...
flexible
{ "blob_id": "9a6f4f0eac5d9e5b4b92fcb2d66d39df15b3b281", "index": 6303, "step-1": "<mask token>\n\n\n@user.route('/users/add', methods=['GET', 'POST'])\ndef add_user():\n \"\"\"\n load form page and add to the database\n \"\"\"\n if request.method == 'POST':\n user = User(username=request.form[...
[ 2, 4, 5, 6, 7 ]
import cv2 img = cv2.imread('Chapter1/resources/jacuzi.jpg') imgGrey = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) imgCanny = cv2.Canny(img,240,250) cv2.imshow("output",imgCanny) cv2.waitKey(0)
normal
{ "blob_id": "292cfecb701ecc179381d4453063aff532a0e877", "index": 8961, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('output', imgCanny)\ncv2.waitKey(0)\n", "step-3": "<mask token>\nimg = cv2.imread('Chapter1/resources/jacuzi.jpg')\nimgGrey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\nimgCanny ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SyncRecv: def __init__(self): self._comport = '/dev/ttyUSB0' self._baudrate = '115200' self._epwm_sync_pin = 'GPIO2_23' self._sync_in_pin = 'GPIO2_25' self._sync_out_pin = 'GPIO1_14' self.setup_pins() <|reserved_special_token_...
flexible
{ "blob_id": "c716f43dbe62f662c60653f09be946a27c3fff66", "index": 8069, "step-1": "<mask token>\n\n\nclass SyncRecv:\n\n def __init__(self):\n self._comport = '/dev/ttyUSB0'\n self._baudrate = '115200'\n self._epwm_sync_pin = 'GPIO2_23'\n self._sync_in_pin = 'GPIO2_25'\n self...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class retrieve_open_space(dml.Algorithm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None ): ...
flexible
{ "blob_id": "2c82dd33180a7442607e5cbedf8846bd72b37150", "index": 9914, "step-1": "<mask token>\n\n\nclass retrieve_open_space(dml.Algorithm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=Non...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_statement(month=None): def _get_pdfkit_config(): if os.getenv('FLASK_ENV') == 'production': WKHTMLTOPDF_CMD = subprocess.Popen(['which', os.environ.get( 'WKHTMLTOPDF_BINARY', '...
flexible
{ "blob_id": "55df8d13ddf28f7b0477329bee743471a0780f24", "index": 3253, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_statement(month=None):\n\n def _get_pdfkit_config():\n if os.getenv('FLASK_ENV') == 'production':\n WKHTMLTOPDF_CMD = subprocess.Popen(['which', os.env...
[ 0, 1, 2, 3 ]
# ============================================================================= # Created By : Mohsen Malmir # Created Date: Fri Nov 09 8:10 PM EST 2018 # Purpose : this file implements the gui handling to interact with emulators # ============================================================================= from...
normal
{ "blob_id": "043ea0efd490522de4f6ee4913c8d66029b34ff5", "index": 5136, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef activate_emu():\n \"\"\"\n This function scans all the open windows and returns a handle to the first known\n and supported emulator-game pair.\n Args:\n None\n...
[ 0, 2, 3, 4, 5 ]
from PIL import Image, ImageDraw, ImageFont import sys ### Create 1024,1024 pixel image with a white background. img = Image.new("RGB", (1024, 1024), color = (255,255,255)) ### Take text to be drawn on the image from the command terminal. text = sys.argv[1] ### Chose favourite font and set size of the font. fnt = Im...
normal
{ "blob_id": "053fa80c80d40cd28acb7d6a8bf1b2c30be9b36e", "index": 7786, "step-1": "<mask token>\n", "step-2": "<mask token>\nd.text(xy=(320, 420), text=text, font=fnt, fill=(0, 0, 0))\nimg.save(text + '.png')\n", "step-3": "<mask token>\nimg = Image.new('RGB', (1024, 1024), color=(255, 255, 255))\ntext = sys....
[ 0, 1, 2, 3, 4 ]
# 出现频率特别高的和频率特别低的词对于文本分析帮助不大,一般在预处理阶段会过滤掉。 # 在英文里,经典的停用词为 “The”, "an".... # 方法1: 自己建立一个停用词词典 stop_words = ["the", "an", "is", "there"] # 在使用时: 假设 word_list包含了文本里的单词 word_list = ["we", "are", "the", "students"] filtered_words = [word for word in word_list if word not in stop_words] print (filtered_words) # ...
normal
{ "blob_id": "d14937aaa7a80d6b95825afa2a2d6ff8202e5f5c", "index": 2498, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(filtered_words)\n<mask token>\nprint(' '.join(singles))\n", "step-3": "stop_words = ['the', 'an', 'is', 'there']\nword_list = ['we', 'are', 'the', 'students']\nfiltered_words = [w...
[ 0, 1, 2, 3, 4 ]
import sys def caesar( plaintext, key ): if int( key ) < 0: return plaintext_ascii = [ ( ord( char ) + int( key ) ) for char in plaintext ] for ascii in plaintext_ascii: if ( ascii < 97 and ascii > 90 ) or ascii > 122: ascii -= 25 ciphertext = ''.join( [ chr( ascii ) for a...
normal
{ "blob_id": "9a7c6998e9e486f0497d3684f9c7a422c8e13521", "index": 7076, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef caesar(plaintext, key):\n if int(key) < 0:\n return\n plaintext_ascii = [(ord(char) + int(key)) for char in plaintext]\n for ascii in plaintext_ascii:\n if ...
[ 0, 1, 2, 3, 4 ]
from packer.utils import hello_world
normal
{ "blob_id": "d549303228e860ae278a5a9497a4a3a68989aeca", "index": 6097, "step-1": "<mask token>\n", "step-2": "from packer.utils import hello_world\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> rc('font', **{'family': 'serif'}) <|reserved_special_token_0|> for i, nafm in enumerate(nafms): detuning = 6.44 a1, a2 = fetchdata.fetch_data_A1A2({'afmsize': nafm, 'ai': 0.0}, 'det', datfile) sunits = 9 * 6.71...
flexible
{ "blob_id": "feac1092d1aaf70eb4d4df919e434cdc1aa9c826", "index": 9171, "step-1": "<mask token>\n", "step-2": "<mask token>\nrc('font', **{'family': 'serif'})\n<mask token>\nfor i, nafm in enumerate(nafms):\n detuning = 6.44\n a1, a2 = fetchdata.fetch_data_A1A2({'afmsize': nafm, 'ai': 0.0}, 'det',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def inception_2d_fields(img, fields, num_classes=30, is_training=True, dropout_keep_prob=0.6, prediction_fn=layers_lib.softmax, spatial_squeeze=True, reuse=None, scope='InceptionV1_Fields'): with arg_scope([layers.co...
flexible
{ "blob_id": "ca93f49fbdc1d64e0616bca035a6043b3cc80ddc", "index": 1485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef inception_2d_fields(img, fields, num_classes=30, is_training=True,\n dropout_keep_prob=0.6, prediction_fn=layers_lib.softmax,\n spatial_squeeze=True, reuse=None, scope='Ince...
[ 0, 1, 2, 3 ]
import firebase_admin from firebase_admin import credentials from firebase_admin import db import paho.mqtt.client as mqtt # Fetch the service account key JSON file contents cred = credentials.Certificate('iot_mikro.json') # Initialize the app with a service account, granting admin privileges firebase_admin.initialize...
normal
{ "blob_id": "acff8618754658104ac36214901d346447a0134f", "index": 811, "step-1": "<mask token>\n", "step-2": "<mask token>\nfirebase_admin.initialize_app(cred, {'databaseURL':\n 'https://mikro-b4844.firebaseio.com/'})\n<mask token>\nprint(ref.get())\n<mask token>\nwhile True:\n print(ref.get())\n if re...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from __future__ import print_function import weechat import sys import pickle import json import math import os.path from datetime import datetime from datetime import date from datetime import timedelta from dateutil.parser import parse as datetime_parse from os.path import expanduser from goog...
normal
{ "blob_id": "0ed0fb6f9bcc768bb005222c9ae9b454f6d962ec", "index": 9148, "step-1": "<mask token>\n\n\ndef _load_credentials(creds_file=None):\n \"\"\"Loads the credentials from a credentials.json file or by prompting for authentication.\n Returns a credentials object to be used by the Google Sheets API.\n ...
[ 7, 10, 11, 12, 13 ]
from django.shortcuts import render from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponse from .models import Document, Organization, UserProfile, Shop #from .forms import DocUploadForm, ShopEditForm from django.shortcuts import render_to_response, get_object_or_404 fro...
normal
{ "blob_id": "d2c5d306591216e100b5bd8e8822b24fd137d092", "index": 9208, "step-1": "<mask token>\n\n\nclass DocUploadForm(forms.ModelForm):\n tags = forms.ModelMultipleChoiceField(queryset=Tag.objects.all())\n\n\n class Meta:\n model = Document\n exclude = ['organization', 'private_user', 'is_p...
[ 23, 24, 32, 34, 37 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(argv): for com in argv: with open(com, 'rb') as f: txt = f.read() if 'tzvp tzvpfit' in txt: parts = txt.split('tzvp tzvpfit', 1) new_txt = parts[0] + 'tzvp/tzvpfit...
flexible
{ "blob_id": "85974e48c7eafdf39379559820ed7f0bdc07fb7a", "index": 3680, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(argv):\n for com in argv:\n with open(com, 'rb') as f:\n txt = f.read()\n if 'tzvp tzvpfit' in txt:\n parts = txt.split('tzvp tzvpfit',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IEMRunInfoReader: """ Illumina Experimental Manager RunInfo xml reader. """ def __init__(self, f): self.xml_file = f self.tree = ET.parse(self.xml_file) self.root = self.tree.getroot() def get_reads(self): reads = [r.attrib for r...
flexible
{ "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 ]
def maths(num): int(num) if num % 5 == 0 and num % 3 == 0: print("bizzfizz") elif num % 3 == 0: print("fizz") elif num % 5 == 0: print("bizz") else: print(num) value=input("enter the value ") maths(int(value))
normal
{ "blob_id": "91f83adbe01e2d8070f9286031b77eae71beb83e", "index": 1107, "step-1": "<mask token>\n", "step-2": "def maths(num):\n int(num)\n if num % 5 == 0 and num % 3 == 0:\n print('bizzfizz')\n elif num % 3 == 0:\n print('fizz')\n elif num % 5 == 0:\n print('bizz')\n else:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for file in flist: print(file) name = file.split('.nc')[0] ds = xr.open_dataset(path_to_regrided_files + file, decode_times=False) timespan = [ds.timespan] print(timespan) ti, tf = timespan[0].split(' to ')...
flexible
{ "blob_id": "4fc4bb81d47a33e4669df46033033fddeca6544e", "index": 8858, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file in flist:\n print(file)\n name = file.split('.nc')[0]\n ds = xr.open_dataset(path_to_regrided_files + file, decode_times=False)\n timespan = [ds.timespan]\n print(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python def findSubset(s0, s, t): mys0 = s0.copy() mys = s.copy() if t == 0 and mys0: return mys0 elif t == 0: # and mys0 == set() return True else: if len(mys) > 0: p = mys.pop() mys1 = mys0.copy() mys1.add(p) ...
normal
{ "blob_id": "079610f2aaebec8c6e46ccf21a9d5728df1be8de", "index": 4155, "step-1": "<mask token>\n", "step-2": "def findSubset(s0, s, t):\n mys0 = s0.copy()\n mys = s.copy()\n if t == 0 and mys0:\n return mys0\n elif t == 0:\n return True\n elif len(mys) > 0:\n p = mys.pop()\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def _push_test_data(app, model, data=None): app.authmodel(model, ['insert']) resp = app.post('/', json={'_data': [{**res, '_op': 'insert', '_type': model} for res in data or test_data]}) assert resp.status_code == 200, resp.json() resp = resp.json() assert '_da...
flexible
{ "blob_id": "57e9c1a4ac57f68e0e73c2c67c6828de8efb1b16", "index": 3903, "step-1": "<mask token>\n\n\ndef _push_test_data(app, model, data=None):\n app.authmodel(model, ['insert'])\n resp = app.post('/', json={'_data': [{**res, '_op': 'insert', '_type':\n model} for res in data or test_data]})\n as...
[ 43, 48, 56, 58, 63 ]
#! /usr/bin/env python3 __all__ = [ 'FrameCorners', 'CornerStorage', 'build', 'dump', 'load', 'draw', 'without_short_tracks' ] import click import cv2 import numpy as np import pims from _corners import FrameCorners, CornerStorage, StorageImpl from _corners import dump, load, draw, withou...
normal
{ "blob_id": "0b5fb649dc421187820677ce75f3cd0e804c18a3", "index": 7055, "step-1": "<mask token>\n\n\nclass _CornerStorageBuilder:\n\n def __init__(self, progress_indicator=None):\n self._progress_indicator = progress_indicator\n self._corners = dict()\n\n def set_corners_at_frame(self, frame, ...
[ 10, 12, 14, 15, 17 ]
import datetime count = 0 for y in xrange(1901,2001): for m in xrange(1,13): if datetime.date(y,m,1).weekday() == 6: count += 1 print count
normal
{ "blob_id": "7430e17d1c424362399cf09a0c3ecae825d04567", "index": 2996, "step-1": "import datetime\ncount = 0\nfor y in xrange(1901,2001):\n\tfor m in xrange(1,13):\n\t\tif datetime.date(y,m,1).weekday() == 6:\n\t\t\tcount += 1\n\nprint count\n", "step-2": null, "step-3": null, "step-4": null, "step-5": n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def predict(text, phobert, tokenizer): model = load_model('model.h5') X_test = word2vec(text, phobert, tokenizer) x_test_tensor = tf.convert_to_tensor(X_test) X_tests = [] X_tests.append(x_test_tensor) X_...
flexible
{ "blob_id": "d2c9ee64472c74767812d842d2c49eec962e28c6", "index": 4451, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef predict(text, phobert, tokenizer):\n model = load_model('model.h5')\n X_test = word2vec(text, phobert, tokenizer)\n x_test_tensor = tf.convert_to_tensor(X_test)\n X_te...
[ 0, 1, 2, 3, 4 ]
import requests seesion = requests.Session() header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.3387.400 QQBrowser/9.6.11984.400' } cookie = {'Cookie': '_ga=GA1.2.1866009938.1500885157; xmuuid=XMGUEST-B6484440-71B...
normal
{ "blob_id": "8c652f30cd256912512b6b91d1682af7da0ff915", "index": 8265, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(html.decode('utf-8'))\n", "step-3": "<mask token>\nseesion = requests.Session()\nheader = {'User-Agent':\n 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like...
[ 0, 1, 2, 3 ]
import SCons.Util import xml.dom.minidom, re, os.path ################################################################################ # DocBook pseudobuilder # TODO: Only generate the output formats that are known ################################################################################ def generate(env) : ...
normal
{ "blob_id": "cae49da8dd436fc51b472c4a88703d8bc6c79bda", "index": 427, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate(env):\n\n def remove_doctype(target, source, env):\n f = open(str(target[0]))\n output = []\n for line in f.readlines():\n output.append...
[ 0, 1, 2, 3, 4 ]
import models import json import reports.models import common.ot_utils def analyze_raw_reports(clean=True): if clean: delete_all_reports() COUNT = 100 offset = 0 while True: cont = analyze_raw_reports_subset(offset,COUNT) offset += COUNT if not cont: return ...
normal
{ "blob_id": "c3527363cfc29ab7d598fe232d784b05ec2ef069", "index": 388, "step-1": "import models\nimport json\nimport reports.models\nimport common.ot_utils\n\ndef analyze_raw_reports(clean=True):\n if clean:\n delete_all_reports()\n COUNT = 100\n offset = 0\n while True:\n cont = analyze...
[ 0 ]
<|reserved_special_token_0|> class Game: location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2] velocity: list[int, int] = [0, 0] current_player: Player = None other_players: Dict[str, Tuple[Player, Tuple[int, int]]] = {} connection: socket.socket font: pygame.font.Font <|reserved_special_...
flexible
{ "blob_id": "418798369578e80ecbf82da802b23dc6ca922569", "index": 7107, "step-1": "<mask token>\n\n\nclass Game:\n location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2]\n velocity: list[int, int] = [0, 0]\n current_player: Player = None\n other_players: Dict[str, Tuple[Player, Tuple[int, int]]] = {}\...
[ 10, 11, 12, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> m.sort() x -= sum(m) print(n + x // m[0]) <|reserved_special_token_1|> n, x = map(int, input().split()) m = [int(input()) for _ in range(n)] m.sort() x -= sum(m) print(n + x // m[0])
flexible
{ "blob_id": "0ff398775fd13fb5fbd23bf2359bb31dff6bd38c", "index": 9821, "step-1": "<mask token>\n", "step-2": "<mask token>\nm.sort()\nx -= sum(m)\nprint(n + x // m[0])\n", "step-3": "n, x = map(int, input().split())\nm = [int(input()) for _ in range(n)]\nm.sort()\nx -= sum(m)\nprint(n + x // m[0])\n", "ste...
[ 0, 1, 2 ]
'''Module main''' import argparse import api import quoridor import quoridorx def analyser_commande(): '''Analyseur de ligne de commande.''' parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3') parser.add_argument("idul", help="IDUL du joueur.") parser.add_argument("-l", '--lister'...
normal
{ "blob_id": "f69544a9123f1738cd7d21c1b4fc02dd73fb9d1b", "index": 6008, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef analyser_commande():\n \"\"\"Analyseur de ligne de commande.\"\"\"\n parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3')\n parser.add_argument('idul', ...
[ 0, 1, 2, 3, 4 ]
from selenium import webdriver driver = webdriver.Chrome(executable_path=r'D:\Naveen\Selenium\chromedriver_win32\chromedriver.exe') driver.maximize_window() driver.get('http://zero.webappsecurity.com/') parent_window_handle = driver.current_window_handle driver.find_element_by_xpath("(//a[contains(text(),'privacy')])...
normal
{ "blob_id": "223413918ba2a49cd13a34026d39b17fb5944572", "index": 5849, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.maximize_window()\ndriver.get('http://zero.webappsecurity.com/')\n<mask token>\ndriver.find_element_by_xpath(\"(//a[contains(text(),'privacy')])[1]\").click()\n<mask token>\nfor wi...
[ 0, 1, 2, 3, 4 ]
import pickle import numpy as np import math class AdaBoostClassifier: '''A simple AdaBoost Classifier.''' def __init__(self, weak_classifier, n_weakers_limit): '''Initialize AdaBoostClassifier Args: weak_classifier: The class of weak classifier, which is recommend to be sklearn.t...
normal
{ "blob_id": "905d8be76ef245a2b8fcfb3f806f8922d351ecf0", "index": 8877, "step-1": "<mask token>\n\n\nclass AdaBoostClassifier:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def predict(self, X, threshold=0):\n \"\"\"Predict the catagories...
[ 3, 7, 8, 9, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def divisible_by_2(my_list=[]): if my_list is None or len(my_list) == 0: return None new = [] for num in my_list: if num % 2 == 0: new.append(True) else: new.append(False) return new <|reserved...
flexible
{ "blob_id": "17f91b612fad14200d2911e2cb14e740b239f9ff", "index": 4894, "step-1": "<mask token>\n", "step-2": "def divisible_by_2(my_list=[]):\n if my_list is None or len(my_list) == 0:\n return None\n new = []\n for num in my_list:\n if num % 2 == 0:\n new.append(True)\n ...
[ 0, 1, 2 ]
from flask import Flask from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() # pylint: disable=dangerous-default-value,wrong-import-position,unused-import, import-outside-toplevel def create_app(settings_override={}): app = Flask(__name__) app.config.from_object('zezin.settings.Configuration') app.c...
normal
{ "blob_id": "6affc182f5d3353d46f6e9a21344bc85bf894165", "index": 948, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app(settings_override={}):\n app = Flask(__name__)\n app.config.from_object('zezin.settings.Configuration')\n app.config.update(settings_override)\n db.init_app(...
[ 0, 1, 2, 3, 4 ]
/usr/share/pyshared/Bio/Phylo/_io.py
normal
{ "blob_id": "7e50fc5eb794d7f2e4805924dcc7a99296e0d732", "index": 614, "step-1": "/usr/share/pyshared/Bio/Phylo/_io.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-08-03 02:31 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Creat...
normal
{ "blob_id": "cdd929ee041c485d2a6c1149ea1b1ced92d7b7ab", "index": 5972, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
__author__ = 'anderson' from pyramid.security import Everyone, Allow, ALL_PERMISSIONS class Root(object): #Access Control List __acl__ = [(Allow, Everyone, 'view'), (Allow, 'role_admin', ALL_PERMISSIONS), (Allow, 'role_usuario', 'comum')] def __init__(self, request): ...
normal
{ "blob_id": "5ee2a51ea981f0feab688d9c571620a95d89a422", "index": 6980, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Root(object):\n <mask token>\n\n def __init__(self, request):\n pass\n", "step-3": "__author__ = 'anderson'\n<mask token>\n\n\nclass Root(object):\n __acl__ = ...
[ 0, 2, 4, 5, 6 ]
"""Wrapper over the command line migrate tool to better work with config files.""" import subprocess import sys from alembic.migration import MigrationContext from ..lib.alembic import bootstrap_db from ..lib.sqla import create_engine from ..models import DBSession as db def main(): if len(sys.argv) < 3: ...
normal
{ "blob_id": "7b459cf321f351e1485a9aef0ca23067f411e430", "index": 7446, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n if len(sys.argv) < 3:\n sys.stderr.write(\n 'Usage: %s CONFIG_URI {bootstrap | ALEMBIC_OPTS}\\n' % sys.argv[0])\n sys.exit(1)\n config_uri...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python kube_description= \ """ Compute Server """ kube_instruction= \ """ Not instructions yet """ # # Standard geni-lib/portal libraries # import geni.portal as portal import geni.rspec.pg as PG import geni.rspec.emulab as elab import geni.rspec.igext as IG import geni.urn as URN # # PhantomNet ext...
normal
{ "blob_id": "ff7a865822a4f8b343ab4cb490c24d6d530b14e1", "index": 934, "step-1": "<mask token>\n", "step-2": "<mask token>\npc.verifyParameters()\n<mask token>\ntour.Description(IG.Tour.TEXT, kube_description)\ntour.Instructions(IG.Tour.MARKDOWN, kube_instruction)\nrspec.addTour(tour)\npc.printRequestRSpec(rspe...
[ 0, 1, 2, 3, 4 ]
"""inactivate fb posts Revision ID: f37637c1bcf8 Revises: 43c7ecf8ed02 Create Date: 2017-06-22 12:01:59.623040 """ from alembic import op from pd.facebook.models import MediaType # revision identifiers, used by Alembic. revision = 'f37637c1bcf8' down_revision = '43c7ecf8ed02' branch_labels = None depends_on = None ...
normal
{ "blob_id": "89ed30411c624e3d930db0bc0b5b716a10908727", "index": 8259, "step-1": "<mask token>\n\n\ndef upgrade():\n op.execute(' '.join([update.format('false'), where]))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef upgrade():\n op.execute(' '.join([update.format('false'), where]))\n\n\ndef dow...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def upgrade(): op.create_unique_constraint('_unique_name_unit', 'ingredient', ['name', 'unit']) op.create_unique_constraint(None, 'product', ['nappi_code']) op.add_column('product_ingredient', sa.Column('strength', sa.String(), nullable=True)) op.create_uni...
flexible
{ "blob_id": "d0a73385db0dd6f729d267095ef83b9fec72e40c", "index": 1464, "step-1": "<mask token>\n\n\ndef upgrade():\n op.create_unique_constraint('_unique_name_unit', 'ingredient', ['name',\n 'unit'])\n op.create_unique_constraint(None, 'product', ['nappi_code'])\n op.add_column('product_ingredien...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def j(): global i import pandas as pd st1.update({i: st}) data = pd.DataFrame(st1) print(data) data.to_csv('student.csv') fa1.update({i: fa}) data1 = pd.DataFrame(fa1) print(data1) data1.to_csv('faculty.csv') i = i + 1 <|reserved_special_token...
flexible
{ "blob_id": "3e7e6d7a0137d91dc7437ff91a39d7f8faad675e", "index": 7075, "step-1": "<mask token>\n\n\ndef j():\n global i\n import pandas as pd\n st1.update({i: st})\n data = pd.DataFrame(st1)\n print(data)\n data.to_csv('student.csv')\n fa1.update({i: fa})\n data1 = pd.DataFrame(fa1)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): lc1821 = LightCurve('PSR_B1821-24/PSR_B1821-24_combined.evt') lc0218 = LightCurve('PSR_J0218+4232/PSR_J0218+4232_combined.evt') fig, ax = plt.subplots(2, 1, figsize=(8, 8)) ax[0], _ = lc1821.fit_two('...
flexible
{ "blob_id": "48311ee17a3f2eca8db32d7672f540fa45a7a900", "index": 3524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n lc1821 = LightCurve('PSR_B1821-24/PSR_B1821-24_combined.evt')\n lc0218 = LightCurve('PSR_J0218+4232/PSR_J0218+4232_combined.evt')\n fig, ax = plt.subplots(2, 1,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while name != 'your name' and name != 'Your name': print('Please type your name.') name = input() print('Thanks!') <|reserved_special_token_1|> name = '' while name != 'your name' and name != 'Your name': print('Ple...
flexible
{ "blob_id": "f3644b42d1a6c87c6169f8d123dadf6cd209270c", "index": 2617, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile name != 'your name' and name != 'Your name':\n print('Please type your name.')\n name = input()\nprint('Thanks!')\n", "step-3": "name = ''\nwhile name != 'your name' and nam...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n): s = a[i] ans[s - 1] = i + 1 print(*ans) <|reserved_special_token_1|> n = int(input()) a = [int(e) for e in input().split()] ans = [0] * n for i in range(n): s = a[i] ans[s - 1] = i + 1 print(*...
flexible
{ "blob_id": "f74e2e6b59330bd63fee9192e74a72178abc1cab", "index": 8195, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n s = a[i]\n ans[s - 1] = i + 1\nprint(*ans)\n", "step-3": "n = int(input())\na = [int(e) for e in input().split()]\nans = [0] * n\nfor i in range(n):\n s = ...
[ 0, 1, 2 ]
import widget import column class Columns(widget.Widget): def __init__(self, parent): super(Columns, self).__init__(parent) # self.root.mouse.on_drag_release.append(self.on_drag_release) """ def on_drag_release(self, x0, y0, x, y): if not self.contains_point(x0, y0): re...
normal
{ "blob_id": "e0874554c326bb11b53552e362bc8073bb57bc93", "index": 9720, "step-1": "<mask token>\n\n\nclass Columns(widget.Widget):\n\n def __init__(self, parent):\n super(Columns, self).__init__(parent)\n <mask token>\n\n def add_column(self):\n col = column.Column(self)\n self.child...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', url('^create_new/$', 'hx_lti_assignment.views.create_new_assignment', name= 'create_new_assignment'), url('^(?P<id>[0-9]+)/edit/', 'hx_lti_assignment.views.edit_assignment', name='edit_assign...
flexible
{ "blob_id": "2194fb4f0b0618f1c8db39f659a4890457f45b1d", "index": 3963, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^create_new/$',\n 'hx_lti_assignment.views.create_new_assignment', name=\n 'create_new_assignment'), url('^(?P<id>[0-9]+)/edit/',\n 'hx_lti_assign...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with DAG('twitter_dag_v1', start_date=datetime(2018, 10, 1), schedule_interval='@daily', default_args=DAG_DEFAULT_ARGS, catchup=False ) as dag: None <|reserved_special_token_1|> <|reserved_special_token_0|> DAG_DEFA...
flexible
{ "blob_id": "436cc06778bf9ac9e04a897f4a4db90c595d943c", "index": 5969, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith DAG('twitter_dag_v1', start_date=datetime(2018, 10, 1),\n schedule_interval='@daily', default_args=DAG_DEFAULT_ARGS, catchup=False\n ) as dag:\n None\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @aluno.route('/hello') def hello(): return 'Hello, aluno' @aluno.route('/reseta', methods=['POST']) def reseta(): sqlaluno = 'DELETE FROM aluno' sqldisciplina = 'DELETE FROM disciplina' sqlprofessor = 'DELETE FROM professor' with closing(conectar()) as conn, closing(...
flexible
{ "blob_id": "5068336ca1a180e09a7efd41eea596cdcebb33ae", "index": 5586, "step-1": "<mask token>\n\n\n@aluno.route('/hello')\ndef hello():\n return 'Hello, aluno'\n\n\n@aluno.route('/reseta', methods=['POST'])\ndef reseta():\n sqlaluno = 'DELETE FROM aluno'\n sqldisciplina = 'DELETE FROM disciplina'\n ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Network: def placeholder_inputs(self, batch_size, num_point): source_pointclouds_pl = tf.placeholder(tf.float32, shape=( batch_size, num_point, 3)) return source_pointclouds_pl def get_model(self, source_pointclouds_pl, feature_size, is_training...
flexible
{ "blob_id": "e4a0f26afe8c78e4abbd85834c96ed5ba84e1f0b", "index": 3894, "step-1": "<mask token>\n\n\nclass Network:\n\n def placeholder_inputs(self, batch_size, num_point):\n source_pointclouds_pl = tf.placeholder(tf.float32, shape=(\n batch_size, num_point, 3))\n return source_pointcl...
[ 4, 6, 7, 8, 9 ]
""" CP1404 - Practical Code that produces a random number between 1 and 100 inclusive Rhys Simpson """ # 1. # smallest number 5; largest number 20 # 2. # smallest number 3; largest number 9 # no it can only produce 3, 5, 7, 9 # 3. # smallest number 2.5000000000000000; largest number 5.5000000000000000 import random...
normal
{ "blob_id": "46696ee9576d74c087ae435bfd304c8346530ab2", "index": 9804, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(random.randint(1, 100))\n", "step-3": "<mask token>\nimport random\nprint(random.randint(1, 100))\n", "step-4": "\"\"\"\nCP1404 - Practical\nCode that produces a random number b...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def plot_image(img, ax, title): ax.imshow(np.transpose(img, (1, 2, 0)), interpolation='nearest') ax.set_title(title, fontsize=20) <|reserved_special_token_0|> def plot_encoding(image, vsc, latent_sz, alpha=None, width=1 / 7): image = vsc.transform(image).to(vsc.device) ...
flexible
{ "blob_id": "ae27f97b5633309d85b9492e1a0f268847c24cd5", "index": 9366, "step-1": "<mask token>\n\n\ndef plot_image(img, ax, title):\n ax.imshow(np.transpose(img, (1, 2, 0)), interpolation='nearest')\n ax.set_title(title, fontsize=20)\n\n\n<mask token>\n\n\ndef plot_encoding(image, vsc, latent_sz, alpha=Non...
[ 3, 4, 5, 6, 7 ]
import sqlite3 as lite import sys con = lite.connect("test.db") with con: cur = con.cursor() cur.execute('''CREATE TABLE Cars(Id INT, Name TEXT, Price INT)''') cur.execute('''INSERT INTO Cars VALUES(1, 'car1', 10)''') cur.execute('''INSERT INTO Cars VALUES(2, 'car2', 20)''') cur.execute('''INSERT INTO C...
normal
{ "blob_id": "db22e568c86f008c9882181f5c1d88d5bca28570", "index": 5416, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith con:\n cur = con.cursor()\n cur.execute('CREATE TABLE Cars(Id INT, Name TEXT, Price INT)')\n cur.execute(\"INSERT INTO Cars VALUES(1, 'car1', 10)\")\n cur.execute(\"INSER...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def index(): return render_template('index.html') @app.route('/result', methods=['POST']) def result(): form_data = request.form sentence = form_data['sentence'] output = get_result(sentence) return render_template('result.html', result=output) <|re...
flexible
{ "blob_id": "264da5a2ab7d5c311d8a59b06c81ea2156cefd76", "index": 9627, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/result', methods=['POST'])\ndef result():\n form_data = request.form\n sentence = form_data['sentence']\n output =...
[ 2, 3, 4, 5, 6 ]
""" Definition of SegmentTreeNode: """ class SegmentTreeNode: def __init__(self, start, end): self.start, self.end = start, end self.left, self.right = None, None class Solution: """ @param: start: start value. @param: end: end value. @return: The root of Segment Tree. """ ...
normal
{ "blob_id": "5e20a517131f7a372d701548e4f370766a84ba52", "index": 6134, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n \"\"\"\n @param: start: start value.\n @param: end: end value.\n @return: The root of Segment Tr...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def IsPrime(x): for i in range(2, int(x ** 0.5) + 1): if not x % i: return False return True <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def IsPrime(x...
flexible
{ "blob_id": "fcfec521e071aa586febc74efb2deb0e9d0a331e", "index": 3358, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef IsPrime(x):\n for i in range(2, int(x ** 0.5) + 1):\n if not x % i:\n return False\n return True\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef I...
[ 0, 1, 2, 3, 4 ]
# vim:fileencoding=utf-8:noet from __future__ import absolute_import, unicode_literals, print_function import os BINDINGS_DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bindings') TMUX_CONFIG_DIRECTORY = os.path.join(BINDINGS_DIRECTORY, 'tmux') DEFAULT_SYSTEM_CONFIG_DIR = None
normal
{ "blob_id": "c435b0f162512bb2bc0c35e1817f64c5ef9ff7bc", "index": 1871, "step-1": "<mask token>\n", "step-2": "<mask token>\nBINDINGS_DIRECTORY = os.path.join(os.path.dirname(os.path.abspath(__file__)\n ), 'bindings')\nTMUX_CONFIG_DIRECTORY = os.path.join(BINDINGS_DIRECTORY, 'tmux')\nDEFAULT_SYSTEM_CONFIG_DI...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.close('all') <|reserved_special_token_0|> axs[0].plot(t, s_t) axs[0].grid('True') axs[0].set_title('Señal Original') axs[0].set_ylim(-0.2, 0.2) axs[0].set_ylabel('[V]') axs[1].plot(t, r_t) axs[1].grid('True') axs[1].set_title(...
flexible
{ "blob_id": "dd59f3b1d8b17defe4e7f30fec594d01475319d2", "index": 6211, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.close('all')\n<mask token>\naxs[0].plot(t, s_t)\naxs[0].grid('True')\naxs[0].set_title('Señal Original')\naxs[0].set_ylim(-0.2, 0.2)\naxs[0].set_ylabel('[V]')\naxs[1].plot(t, r_t)\nax...
[ 0, 1, 2, 3, 4 ]
''' This module demonstrates how to use some functionality of python built-in csv module ''' import csv def csv_usage(): ''' This function demonstrates how to use csv module to read and write csv files ''' with open('example.csv', 'r', newline='') as csvfile: reader_c = csv.reader(csvfile, deli...
normal
{ "blob_id": "bcc2977f36ecc775f44ae4251ce230af9abf63ba", "index": 7362, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef csv_usage():\n \"\"\"\n This function demonstrates how to use csv module to read and write csv files\n \"\"\"\n with open('example.csv', 'r', newline='') as csvfile:\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def sieve(limit): ans = [] a = [1] * limit a[0] = a[1] = 0 for i in range(2, limit): if a[i] == 0: continue ans.append(i) for j in range(i * i, limit, i): a[j] = 0 return ans <|reserved_special_token_0|> <|reserved_sp...
flexible
{ "blob_id": "ff6dc347637a81c9f6a541775646b4901d719790", "index": 9478, "step-1": "<mask token>\n\n\ndef sieve(limit):\n ans = []\n a = [1] * limit\n a[0] = a[1] = 0\n for i in range(2, limit):\n if a[i] == 0:\n continue\n ans.append(i)\n for j in range(i * i, limit, i)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class DuplicateEnvironmentTest(unittest.TestCase): <|reserved_special_token_0|> def test_num_envs(self): num_envs = 5 env = DuplicateEnvironment(make_vec_env(num_envs)) self.assertEqual(env.num_envs, num_envs) self.assertEqual((num_envs,), env.rese...
flexible
{ "blob_id": "e01eced7c43aae354047fbf29028c601d1daae50", "index": 9636, "step-1": "<mask token>\n\n\nclass DuplicateEnvironmentTest(unittest.TestCase):\n <mask token>\n\n def test_num_envs(self):\n num_envs = 5\n env = DuplicateEnvironment(make_vec_env(num_envs))\n self.assertEqual(env....
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GatesLineGeometry(FixtureTest): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GatesLineGeometry(FixtureTest): def test_linear_gate(self): self.load_fixtu...
flexible
{ "blob_id": "2192e328bdfa454ff1d1f66a05fb6a322c48b244", "index": 2847, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GatesLineGeometry(FixtureTest):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GatesLineGeometry(FixtureTest):\n\n def test_linear_gate(self):\n self.load_...
[ 0, 1, 2, 3, 4 ]
# pyOCD debugger # Copyright (c) 2006-2013,2018 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
normal
{ "blob_id": "58aa72588357b18ab42391dfffbf2a1b66589edd", "index": 552, "step-1": "<mask token>\n\n\nclass KV11Z7(Kinetis):\n <mask token>\n\n def __init__(self, session):\n super(KV11Z7, self).__init__(session, self.MEMORY_MAP)\n self._svd_location = SVDFile.from_builtin('MKV11Z7.svd')\n", "...
[ 2, 3, 4, 5, 6 ]
/home/mitchellwoodbine/Documents/github/getargs/GetArgs.py
normal
{ "blob_id": "0065a493767a2080a20f8b55f76ddeae92dc27f1", "index": 3359, "step-1": "/home/mitchellwoodbine/Documents/github/getargs/GetArgs.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> def klist(**kwargs): kwargs.update({'teachers': [x for x in User.objects.filter(status=1) if not x.is_demo()], 'admins': User.objects.filter(status=2)}) return kwargs <|reserved_special_token_0|> @must_be_admin def account(request, account_id): try: acc = U...
flexible
{ "blob_id": "a01ca49c3fa8ea76de2880c1b04bf15ccd341edd", "index": 924, "step-1": "<mask token>\n\n\ndef klist(**kwargs):\n kwargs.update({'teachers': [x for x in User.objects.filter(status=1) if\n not x.is_demo()], 'admins': User.objects.filter(status=2)})\n return kwargs\n\n\n<mask token>\n\n\n@must...
[ 3, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def coattention(num_embeddings): image_input = Input(shape=(196, 512)) question_input = Input(shape=(SEQ_LENGTH,)) output = CoattentionModel(num_embeddings)(question_input, image_input) model = Model(inputs=[question_input, image_input], outputs=output) return model ...
flexible
{ "blob_id": "a8d52d81ef6538e9cb8a0a9cab7cd0a778454c8e", "index": 6424, "step-1": "<mask token>\n\n\ndef coattention(num_embeddings):\n image_input = Input(shape=(196, 512))\n question_input = Input(shape=(SEQ_LENGTH,))\n output = CoattentionModel(num_embeddings)(question_input, image_input)\n model =...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ProductsListSteps: @given('Prepare classes products list') def prepare_class(context): context.login = LoginPage(context.driver) context.products = ProductsPage(context.driver) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_sp...
flexible
{ "blob_id": "a74a880039bad030d665e001da74075bd61fcc23", "index": 1593, "step-1": "<mask token>\n\n\nclass ProductsListSteps:\n\n @given('Prepare classes products list')\n def prepare_class(context):\n context.login = LoginPage(context.driver)\n context.products = ProductsPage(context.driver)\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def fit_linear_model(x, y): logger.info('Using Lasso') lr = Lasso(alpha=0.01) lr.fit(x, y) return SharedScalerModel(lr) class SharedScalerModel: def __init__(self, lm): self.lm = lm self.coef_ = torch.unsqueeze(torch.tensor(lm.coef_, dtype=torch. ...
flexible
{ "blob_id": "9f86ff37d3a72364b5bd83e425d8151136c07dd3", "index": 6294, "step-1": "<mask token>\n\n\ndef fit_linear_model(x, y):\n logger.info('Using Lasso')\n lr = Lasso(alpha=0.01)\n lr.fit(x, y)\n return SharedScalerModel(lr)\n\n\nclass SharedScalerModel:\n\n def __init__(self, lm):\n sel...
[ 7, 8, 10, 11, 12 ]
from string import Template import os #-----template objects----- #for putting a template inside an ifdef guard TIfGuard = Template("""if(${condition}) ${innerbody} endif()\n""") #For minimum cmake version and project name TProjectSettings = Template("""cmake_minimum_required (VERSION ${MinCmakeVer}) project(${Name}...
normal
{ "blob_id": "8cba57e3552e0072720fe42fa1949534f29d71b5", "index": 1562, "step-1": "<mask token>\n\n\ndef WriteToFile(f, output, condition=False, conditionID=''):\n f.write(output if not condition else WrapInGuard(conditionID, output))\n\n\n<mask token>\n\n\ndef WrapInGuard(condition, innerbody):\n return TI...
[ 8, 12, 15, 16, 18 ]
import os my_home = os.popen("echo $MYWORK_DIR").readlines()[0][:-1] import numpy from sys import path, argv path.append("D:/Github/astrophy-research/mylib") path.append("D:/Github/astrophy-research/multi_shear_detect") path.append('%s/work/mylib' % my_home) from Fourier_Quad import Fourier_Quad # import h5py # from pl...
normal
{ "blob_id": "1ffdc2845bc503c0a30407de444a152f8cc68d57", "index": 1370, "step-1": "<mask token>\n", "step-2": "<mask token>\npath.append('D:/Github/astrophy-research/mylib')\npath.append('D:/Github/astrophy-research/multi_shear_detect')\npath.append('%s/work/mylib' % my_home)\n<mask token>\nif rank == 0:\n n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @contextmanager def timer(name): t0 = time.time() yield print('{color}[{name}] done in {et:.0f} s{nocolor}'.format(name=name, et=time.time() - t0, color='\x1b[1;33m', nocolor='\x1b[0m')) <|reserved_special_token_0|> @main.command() @click.option('--path', type=clic...
flexible
{ "blob_id": "5cc325758d5bd99ebe49c40af4d2e339bbf64044", "index": 7508, "step-1": "<mask token>\n\n\n@contextmanager\ndef timer(name):\n t0 = time.time()\n yield\n print('{color}[{name}] done in {et:.0f} s{nocolor}'.format(name=name,\n et=time.time() - t0, color='\\x1b[1;33m', nocolor='\\x1b[0m'))...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def conv(dt1, dt2): return np.mean((dt1 - np.mean(dt1)) * (dt2 - np.mean(dt2))) <|reserved_special_token_0|> def rho(p1, p2): return conv(p1, p2) / np.std(p1) / np.std(p2) <|reserved_special_token_0|> <|reserved_special_token_1|> print(""" ----------------概率与统计-----------...
flexible
{ "blob_id": "1ab5c6a56ac229c5a9892a9848c62a9a19a0dda7", "index": 3360, "step-1": "<mask token>\n\n\ndef conv(dt1, dt2):\n return np.mean((dt1 - np.mean(dt1)) * (dt2 - np.mean(dt2)))\n\n\n<mask token>\n\n\ndef rho(p1, p2):\n return conv(p1, p2) / np.std(p1) / np.std(p2)\n\n\n<mask token>\n", "step-2": "pr...
[ 2, 4, 5, 6, 7 ]
import array from PIL import Image from generic.editable import XEditable as Editable class PLTT(Editable): """Palette information""" FORMAT_16BIT = 3 FORMAT_256BIT = 4 def define(self, clr): self.clr = clr self.string('magic', length=4, default='PLTT') # not reversed self...
normal
{ "blob_id": "2fadc5c90d1bae14c57fc3bf02582e12aa8abdf6", "index": 790, "step-1": "<mask token>\n\n\nclass PLTT(Editable):\n <mask token>\n <mask token>\n <mask token>\n\n def define(self, clr):\n self.clr = clr\n self.string('magic', length=4, default='PLTT')\n self.uint32('size_'...
[ 13, 14, 15, 16, 19 ]
from model import WSD from data_preprocessing import load_dataset, create_mapping_dictionary, reload_word_mapping,get_bn2wn,get_bn2wndomains, get_bn2lex from typing import List, Dict, Tuple from prova import convert_sentence_to_features_no_padding import numpy as np import os from nltk.corpus import wordnet mfs_count...
normal
{ "blob_id": "e3631a2a003f98fbf05c45a019250e76d3366949", "index": 2582, "step-1": "<mask token>\n\n\ndef predict_babelnet(input_path: str, output_path: str, resources_path: str\n ) ->None:\n global mfs_counter\n \"\"\"\n DO NOT MODIFY THE SIGNATURE!\n This is the skeleton of the prediction function...
[ 7, 9, 11, 12, 15 ]
<|reserved_special_token_0|> class Manager(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, port, options, printer): """Initializes test runner data structures. ...
flexible
{ "blob_id": "08b57c00beb8dfedfee1bc032b8c281d7a151931", "index": 8033, "step-1": "<mask token>\n\n\nclass Manager(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, port, options, printer):\n \"\"\"Initializes test runner data struc...
[ 14, 20, 25, 31, 33 ]
import sqlite3 def to_string(pessoa): for linha in pessoa: print('id: {}\nNome: {}'.format(linha[0], linha[1])) if __name__ == '__main__': con = sqlite3.connect('lab05-ex01.sqlite') cursor = con.cursor() cursor.execute("SELECT * FROM Pessoa") print(cursor.fetchall()) nome = input(...
normal
{ "blob_id": "4246773a8da61ff21d5faa8ab8ad2d7e75fafb60", "index": 3058, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef to_string(pessoa):\n for linha in pessoa:\n print('id: {}\\nNome: {}'.format(linha[0], linha[1]))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef to_string(pess...
[ 0, 1, 2, 3, 4 ]