code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
class Fine(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Meta:
db_table = 'fines'
verbose_name_plural = 'Fines'
verbose_name = 'Fine'
<|reserved_spe... | flexible | {
"blob_id": "22b697790516e1160ac501a58ad93ef5b579414a",
"index": 7109,
"step-1": "<mask token>\n\n\nclass Fine(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'fines'\n verbose_name_plural = 'Fines'\n verbose_name = 'Fi... | [
1,
2,
3,
4,
5
] |
import asyncio
def callback():
print('callback invoked')
def stopper(loop):
print('stopper invoked')
loop.stop()
event_loop = asyncio.get_event_loop()
try:
print('registering callbacks')
# the callbacks are invoked in the order they are scheduled
event_loop.call_soon(callback)
event_loop.... | normal | {
"blob_id": "3b96cc4ef538a06251958495e36fe5dbdf80c13d",
"index": 4952,
"step-1": "<mask token>\n\n\ndef callback():\n print('callback invoked')\n\n\ndef stopper(loop):\n print('stopper invoked')\n loop.stop()\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef callback():\n print('callback invok... | [
2,
3,
4,
5,
6
] |
#!/usr/bin/python3
print("content-type: text/html")
print()
import subprocess
import cgi
form=cgi.FieldStorage()
osname=form.getvalue("x")
command="sudo docker stop {}".format(osname)
output=subprocess.getstatusoutput(command)
status=output[0]
info=output[1]
if status==0:
print("{} OS is stopped succesfully....".form... | normal | {
"blob_id": "1d2dae7f1d937bdd9a6044b23f8f1897e61dac23",
"index": 6330,
"step-1": "<mask token>\n",
"step-2": "print('content-type: text/html')\nprint()\n<mask token>\nif status == 0:\n print('{} OS is stopped succesfully....'.format(osname))\nelse:\n print('some error: {}'.format(info))\n",
"step-3": "... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
try:
copyfile(serial_filename(), temp_filename)
serial_output_code.serial_output_code()
with open(serial_filename(), 'rb') as f:
qmc_out = pickle.load(f)
with open(temp_filename, 'rb') as f:
old_out... | flexible | {
"blob_id": "6acb253189798c22d47feb3d61ac68a1851d22ba",
"index": 1619,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n copyfile(serial_filename(), temp_filename)\n serial_output_code.serial_output_code()\n with open(serial_filename(), 'rb') as f:\n qmc_out = pickle.load(f)\n with... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@ddt
class QuickSearchTest(BaseTestCase):
<|reserved_special_token_0|>
@data(*testingdata)
@unpack
def test_QuickSearch(self, search_value, expected_result, notes):
homepage = HomePage(self.driver)
search_results = homepage.search.searchFor(search_value)
... | flexible | {
"blob_id": "4ba0f7e947830018695c8c9e68a96426f49b4b5b",
"index": 3326,
"step-1": "<mask token>\n\n\n@ddt\nclass QuickSearchTest(BaseTestCase):\n <mask token>\n\n @data(*testingdata)\n @unpack\n def test_QuickSearch(self, search_value, expected_result, notes):\n homepage = HomePage(self.driver)... | [
2,
3,
4,
5,
6
] |
import random
import time
import unittest
from math import radians
from maciErrType import CannotGetComponentEx
from DewarPositioner.positioner import Positioner, NotAllowedError
from DewarPositioner.cdbconf import CDBConf
from Acspy.Clients.SimpleClient import PySimpleClient
from DewarPositionerMockers.mock_components... | normal | {
"blob_id": "654adc9b77bbad6ba36dd42125e69e1a4ad1312d",
"index": 9296,
"step-1": "import random\nimport time\nimport unittest\nfrom math import radians\nfrom maciErrType import CannotGetComponentEx\nfrom DewarPositioner.positioner import Positioner, NotAllowedError\nfrom DewarPositioner.cdbconf import CDBConf\nf... | [
0
] |
#!/usr/bin/python
import json, sys, getopt, re
# Usage: ./get_code.py -i <inputfile>
def main(argv):
inputfile = argv[0]
with open(inputfile) as json_data:
d=json.load(json_data)
json_data.close()
code_array = d["hits"]["hits"]
output_json = []
for element in code_array:
gistid = ele... | normal | {
"blob_id": "9594cda360847d2878aa2bd9c9c85fe50562b6ab",
"index": 5685,
"step-1": "#!/usr/bin/python\n\nimport json, sys, getopt, re\n\n# Usage: ./get_code.py -i <inputfile>\n\ndef main(argv): \n inputfile = argv[0]\n \n with open(inputfile) as json_data: \n d=json.load(json_data)\n json_data.close()\n ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in list:
print(i)
sum = sum + i
print('sum =', sum)
<|reserved_special_token_1|>
list = [10, 20, 30, 40, 50]
sum = 0
for i in list:
print(i)
sum = sum + i
print('sum =', sum)
<|reserved_special_token_1|>... | flexible | {
"blob_id": "88e34ee5cd5af7d3b04321c4aa4fc815f926add1",
"index": 7110,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =', sum)\n",
"step-3": "list = [10, 20, 30, 40, 50]\nsum = 0\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =',... | [
0,
1,
2,
3
] |
# Generated by Django 2.1.1 on 2018-09-24 04:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Aro',
fie... | normal | {
"blob_id": "8dff22249abbae9e30ba1ad423457270e0cd9b20",
"index": 7027,
"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 = [('backend', '... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(6):
hexagon.forward(100)
hexagon.left(60)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
hexagon = turtle.Turtle()
for i in range(6):
hexagon.forward(100)
hexagon.left(60)
<|reserved_... | flexible | {
"blob_id": "f6401eca2dc0ea86a934e859c35fa2d6c85a61b3",
"index": 8695,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(6):\n hexagon.forward(100)\n hexagon.left(60)\n",
"step-3": "<mask token>\nhexagon = turtle.Turtle()\nfor i in range(6):\n hexagon.forward(100)\n hexagon.left... | [
0,
1,
2,
3
] |
#!/usr/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
evaluate-gbvi.py
Evaluate the GBVI model on hydration free energies of small molec... | normal | {
"blob_id": "0ac9e757fa827b311487169d0dc822951ce8c4bb",
"index": 7167,
"step-1": "#!/usr/bin/env python\n\n#=============================================================================================\n# MODULE DOCSTRING\n#=========================================================================================... | [
0
] |
# animation2.py
# multiple-shot cannonball animation
from math import sqrt, sin, cos, radians, degrees
from graphics import *
from projectile import Projectile
from button import Button
class Launcher:
def __init__(self, win):
"""Create inital launcher with angle 45 degrees and velocity 40
win i... | normal | {
"blob_id": "09aedd6cab0b8c6a05bbee5b336fcd38aea1f7b9",
"index": 3202,
"step-1": "<mask token>\n\n\nclass Launcher:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ShotTracker:\n \"\"\" Graphical depiction of a projectile flight using a Circle \"\"\"\n\n ... | [
12,
14,
15,
17,
20
] |
<|reserved_special_token_0|>
def callback(data):
global first_a
global first_d
global oldvar
global base_throttle
global peak_throttle
global base_brake
global peak_brake
global button
axis1 = -data.axes[1]
axis3 = -data.axes[3]
button1 = data.buttons[1]
button4 = data.... | flexible | {
"blob_id": "14a357f3dfb3d59f1d8cfd566edeaf8b0e5bb56d",
"index": 374,
"step-1": "<mask token>\n\n\ndef callback(data):\n global first_a\n global first_d\n global oldvar\n global base_throttle\n global peak_throttle\n global base_brake\n global peak_brake\n global button\n axis1 = -data... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-13 02:06
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('stores', '0001_initial'),
... | normal | {
"blob_id": "e95de58828c63dc8ae24efff314665a308f6ce0c",
"index": 983,
"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 = Tr... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
import os
import platform
import sys
import webbrowser
import config
from pushbullet import Pushbullet
class Zui:
def __init__(self):
self.pb = Pushbullet(self.api_key())
self.target = self.make_devices()
self.dayone = confi... | normal | {
"blob_id": "66cc9ca3d8cbe9690da841e43cef217f3518122c",
"index": 7939,
"step-1": "<mask token>\n\n\nclass Zui:\n\n def __init__(self):\n self.pb = Pushbullet(self.api_key())\n self.target = self.make_devices()\n self.dayone = config.URL_SCHEME\n self.clear, self.pause = self.check_... | [
8,
10,
11,
12,
13
] |
<|reserved_special_token_0|>
class TestVerified(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class TestTrusted(TestCase):
def setUp(self):
self.instance = Trusted()
def tearDown(self):
del self.instance
def test_apply_ru... | flexible | {
"blob_id": "f494dc99febfad99b371d72f542556a9024bc27d",
"index": 5333,
"step-1": "<mask token>\n\n\nclass TestVerified(TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestTrusted(TestCase):\n\n def setUp(self):\n self.instance = Trusted()\n\n def tearDown(self):\n ... | [
9,
13,
14,
17,
18
] |
<|reserved_special_token_0|>
class Position(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Employee(models.Model):
nom = models.CharField(max_length=100)
prenom = models.CharField(max_length=100)
age = models.CharField(max_length=15)
sexe = models.ForeignKey(P... | flexible | {
"blob_id": "5ab20c1cd2dc0d0ad881ee52008d00c2317084f9",
"index": 5308,
"step-1": "<mask token>\n\n\nclass Position(models.Model):\n <mask token>\n <mask token>\n\n\nclass Employee(models.Model):\n nom = models.CharField(max_length=100)\n prenom = models.CharField(max_length=100)\n age = models.Cha... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
db.define_table('t_form', Field('id', 'id', represent=lambda id: SPAN(id,
' ', A('view', _href=URL('form_read', args=id)))), Field('f_name', type
='string', label=T('Name')), Field('f_content', type='text', represent=
... | flexible | {
"blob_id": "e2e275c48f28843931412f8e620f1be90289b40c",
"index": 8184,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndb.define_table('t_form', Field('id', 'id', represent=lambda id: SPAN(id,\n ' ', A('view', _href=URL('form_read', args=id)))), Field('f_name', type\n ='string', label=T('Name')), Fi... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class XiciSpider(CrawlSpider):
<|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_author(self, response):
author_item =... | flexible | {
"blob_id": "f1eaba91e27dc063f3decd7b6a4fe4e40f7ed721",
"index": 7948,
"step-1": "<mask token>\n\n\nclass XiciSpider(CrawlSpider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse_author(self, response):\n author_item = get_author... | [
3,
4,
5,
6,
7
] |
from .parapred import main
main()
| normal | {
"blob_id": "96cb2754db2740767dfb145078ed17969e85123d",
"index": 843,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmain()\n",
"step-3": "from .parapred import main\nmain()\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
grid.fit(X, y)
<|reserved_special_token_0|>
print('Result for {} configurations'.format(len(parameters)))
for p in parameters:
print('{};{:.2f}%;{:.4f}%;±{:.4f}%'.format(', '.join(map(lambda k:
'{}={}'.format(k.split('... | flexible | {
"blob_id": "c99878dbd5610c8a58f00912e111b1eef9d3893e",
"index": 7782,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ngrid.fit(X, y)\n<mask token>\nprint('Result for {} configurations'.format(len(parameters)))\nfor p in parameters:\n print('{};{:.2f}%;{:.4f}%;±{:.4f}%'.format(', '.join(map(lambda k:\n... | [
0,
1,
2,
3,
4
] |
# https://kyu9341.github.io/algorithm/2020/03/11/algorithm14226/
# https://developingbear.tistory.com/138
# https://devbelly.tistory.com/108
# 이모티콘 s개 생성
# 3가지 연산 이용
# bfs 이용 => visited를 이모티콘 방문 여부 2차원 배열 => 이모티콘의 수 와 클립보드에 저장된 이모티콘의 갯수를 이용
from collections import deque
s = int(input())
q = deque()
# visited[이모티콘의 수][클... | normal | {
"blob_id": "0c14a6fa8b25e1791a6eb9c71290db8bb316819a",
"index": 5684,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nq.append((1, 0, 0))\nwhile q:\n e, clip, t = q.popleft()\n if e == s:\n print(t)\n exit(0)\n if 0 < e < 1001:\n if visited[e][e] is False:\n visit... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class OrderQuerySet(QuerySet):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class ProductQuerySet(QuerySet... | flexible | {
"blob_id": "3fdf67c3e0e4c3aa8a3fed09102aca0272b5ff4f",
"index": 6938,
"step-1": "<mask token>\n\n\nclass OrderQuerySet(QuerySet):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass ProductQuerySet(QuerySet):\n <mask token>\n <... | [
1,
7,
8,
9,
11
] |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
#import matplotlib.cbook as cbook
import Image
from matplotlib import _png
from matplotlib.offsetbox import OffsetImage
import scipy.io
import pylab
#for question 1 (my data)
def resample(ms,srate):
return int(round(ms/1000*srate))
de... | normal | {
"blob_id": "a81ee0a855c8a731bafe4967b776e3f93ef78c2a",
"index": 8908,
"step-1": "from __future__ import division\nimport numpy as np\nimport matplotlib.pyplot as plt\n#import matplotlib.cbook as cbook\nimport Image\nfrom matplotlib import _png\nfrom matplotlib.offsetbox import OffsetImage\nimport scipy.io\nimpo... | [
0
] |
import os
from multiprocessing import Pool
import glob
import click
import logging
import pandas as pd
from src.resampling.resampling import Resampler
# Default paths
path_in = 'data/hecktor_nii/'
path_out = 'data/resampled/'
path_bb = 'data/bbox.csv'
@click.command()
@click.argument('input_folder', type=click.Pat... | normal | {
"blob_id": "3479276d4769518aa60dcd4e1bb41a8a1a7d6517",
"index": 315,
"step-1": "<mask token>\n\n\n@click.command()\n@click.argument('input_folder', type=click.Path(exists=True), default=path_in)\n@click.argument('output_folder', type=click.Path(), default=path_out)\n@click.argument('bounding_boxes_file', type=c... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution(object):
def maxDistToClosest(self, seats):
"""
:type seats: List[int]
:rtype: int
"""
start = 0
end =... | flexible | {
"blob_id": "2b8b502381e35ef8e56bc150114a8a4831782c5a",
"index": 3819,
"step-1": "<mask token>\n",
"step-2": "class Solution(object):\n <mask token>\n",
"step-3": "class Solution(object):\n\n def maxDistToClosest(self, seats):\n \"\"\"\n :type seats: List[int]\n :rtype: int\n ... | [
0,
1,
2
] |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='VitaminSHE-home'),
path('signup/', views.signup, name='VitaminSHE-signup'),
path('login/', views.login, name='VitaminSHE-login'),
path('healthcheck/', views.healthcheck, name='VitaminSHE-healthcheck'),
path('... | normal | {
"blob_id": "33aa5c5ab75a26705875b55baf61f7f996cb69cd",
"index": 1280,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('', views.home, name='VitaminSHE-home'), path('signup/',\n views.signup, name='VitaminSHE-signup'), path('login/', views.login,\n name='VitaminSHE-login'), path(... | [
0,
1,
2,
3
] |
import sys
import time
def initialize(x: object) -> object:
# Create initialization data and take a lot of time
data = []
starttimeinmillis = int(round(time.time()))
c =0
file1 = sys.argv[x]
with open(file1) as datafile:
for line in datafile:
c+=1
if(c%100==0):
... | normal | {
"blob_id": "91f3aae4e74f371cadaf10385510bc1c80063f55",
"index": 7765,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef initialize(x: object) ->object:\n data = []\n starttimeinmillis = int(round(time.time()))\n c = 0\n file1 = sys.argv[x]\n with open(file1) as datafile:\n for... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def test_emojize_win32(mocker):
mocker.patch('sys.platform', 'win32')
assert reqwire.helpers.cli.emojize(':thumbs_up_sign: foo').encode('utf-8'
) == b'foo'
def test_emojize_linux(mocker):
mocker.patch('sys.platform', 'linux')
mocker.patch('io.open', mocker.mock_o... | flexible | {
"blob_id": "1a7a2c2cfb2aa94401defd7a7a500f7dd2e7e0aa",
"index": 9680,
"step-1": "<mask token>\n\n\ndef test_emojize_win32(mocker):\n mocker.patch('sys.platform', 'win32')\n assert reqwire.helpers.cli.emojize(':thumbs_up_sign: foo').encode('utf-8'\n ) == b'foo'\n\n\ndef test_emojize_linux(mocker):\n... | [
7,
8,
9,
10,
11
] |
import turtle
red = range(4);
for i in red:
turtle.forward(200)
turtle.left(90)
turtle.done() | normal | {
"blob_id": "38fceb57977cb792be1a63e8571cd222facdf656",
"index": 1142,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in red:\n turtle.forward(200)\n turtle.left(90)\nturtle.done()\n",
"step-3": "<mask token>\nred = range(4)\nfor i in red:\n turtle.forward(200)\n turtle.left(90)\nturt... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class RestAdminAppConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class RestAdminAppConfig(A... | flexible | {
"blob_id": "a41d00c86d0bdab1bced77c275e56c3569af4f4e",
"index": 921,
"step-1": "<mask token>\n\n\nclass RestAdminAppConfig(AppConfig):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass RestAdminAppConfig(AppConfig):\n name = 'li... | [
1,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def countdown(n):
def next():
nonlocal n
r = n
n -= 1
return r
return next
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def countdown(n):
def next():
nonlocal n
r = n
n -=... | flexible | {
"blob_id": "01eef391f6d37d1e74cb032c5b27e1d8fc4395da",
"index": 6122,
"step-1": "<mask token>\n",
"step-2": "def countdown(n):\n\n def next():\n nonlocal n\n r = n\n n -= 1\n return r\n return next\n\n\n<mask token>\n",
"step-3": "def countdown(n):\n\n def next():\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def enable_download(driver, directory):
"""
:param driver: Selenium web driver
:param directory: Directory to store the file
This function allows the Selenium web driver to store the file in the given directory... | flexible | {
"blob_id": "95422348c8db9753830cc0a7c8785c05b44886b1",
"index": 842,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef enable_download(driver, directory):\n \"\"\"\n\n :param driver: Selenium web driver\n :param directory: Directory to store the file\n\n This function allows the Seleniu... | [
0,
1,
2,
3,
4
] |
# B. A New Technique
# TLE (Time limit exceeded)
from sys import stdin, stdout
t = int(input())
for _ in range(t):
n, m = map(int, input().split())
rows = [0] * n
a_column = list()
for r in range(n):
tmp = list(input().split())
rows[r] = tmp
a_column.append(tmp[0])
sorte... | normal | {
"blob_id": "9004314951f77b14bab1aba9ae93eb49c8197a8d",
"index": 4409,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor _ in range(t):\n n, m = map(int, input().split())\n rows = [0] * n\n a_column = list()\n for r in range(n):\n tmp = list(input().split())\n rows[r] = tmp\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def merge(self, intervals):
intervals.sort()
arr = []
for i in intervals:
if len(arr) == 0 or arr[-1][1] < i[0]:
arr.append(i)
else:
arr[-1][1] = max(arr[-1][1], i[1])
return arr
| flexible | {
"blob_id": "a65dfca1773c1e4101ebfb953e0f617a2c345695",
"index": 334,
"step-1": "<mask token>\n",
"step-2": "def merge(self, intervals):\n intervals.sort()\n arr = []\n for i in intervals:\n if len(arr) == 0 or arr[-1][1] < i[0]:\n arr.append(i)\n else:\n arr[-1][1]... | [
0,
1
] |
<|reserved_special_token_0|>
class AuthService:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __get_connection(self) ->HTTPConnection:
""" Creates a new connection to the authentication server.
---
Returns:
The connection object.
"""
ret... | flexible | {
"blob_id": "1438a268780217e647999ba031aa4a50a6912d2f",
"index": 3069,
"step-1": "<mask token>\n\n\nclass AuthService:\n <mask token>\n <mask token>\n\n def __get_connection(self) ->HTTPConnection:\n \"\"\" Creates a new connection to the authentication server.\n ---\n Returns:\n ... | [
2,
3,
5,
6,
7
] |
import re
_camel_words = re.compile(r"([A-Z][a-z0-9_]+)")
def _camel_to_snake(s):
""" Convert CamelCase to snake_case.
"""
return "_".join(
[
i.lower() for i in _camel_words.split(s)[1::2]
]
)
| normal | {
"blob_id": "6c9f9363a95ea7dc97ccb45d0922f0531c5cfec9",
"index": 6572,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef _camel_to_snake(s):\n \"\"\" Convert CamelCase to snake_case.\n \"\"\"\n return '_'.join([i.lower() for i in _camel_words.split(s)[1::2]])\n",
"step-3": "<mask token>\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def test_unfinished_job(mocker, db_session, default_source):
auth.set_current_tenant(auth.Tenant(repository_ids=[default_source.
repository_id]))
build = factories.BuildFactory(source=default_source, queued=True)
db_session.add(build)
job = factories.JobFactory(bui... | flexible | {
"blob_id": "71b78b1347456420c3fc29605887d20ba5bff06e",
"index": 4313,
"step-1": "<mask token>\n\n\ndef test_unfinished_job(mocker, db_session, default_source):\n auth.set_current_tenant(auth.Tenant(repository_ids=[default_source.\n repository_id]))\n build = factories.BuildFactory(source=default_so... | [
1,
2,
3,
4
] |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from collections import OrderedDict
from functools import reduce
class ArcTan(nn.Module):
def __init__(self):
super(ArcTan,self).__init__()
def forward(self, x):
return torch.arctan(x) / 1.5708
class Pa... | normal | {
"blob_id": "1c1673b5e54bafef9f36a2583115f8135c112ab4",
"index": 1922,
"step-1": "<mask token>\n\n\nclass GraphNN(nn.Module):\n\n def __init__(self, dim_in=7, dim_act=6, dim_h=8, dropout=0.0):\n super(GraphNN, self).__init__()\n self.ligand_dim = dim_in\n self.dim_h = dim_h\n self.... | [
26,
31,
34,
35,
39
] |
from django.urls import path
from .views import *
from .utils import *
app_name = 'gymapp'
urlpatterns = [
# CLIENT PATHS ##
# CLIENT PATHS ##
# CLIENT PATHS ##
# CLIENT PATHS ##
# general pages
path('', ClientHomeView.as_view(), name='clienthome'),
path('about/', ClientAboutView.as_v... | normal | {
"blob_id": "48a4331e4b26ea81f1c52ae76db1e92a57cb378c",
"index": 2654,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'gymapp'\nurlpatterns = [path('', ClientHomeView.as_view(), name='clienthome'), path(\n 'about/', ClientAboutView.as_view(), name='clientabout'), path(\n 'contact/', Clie... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
import sys, io,re
import regex
from collections import defaultdict
import datetime
import json
def update_key(data_base, url,kkey):
keys_saved = regex.get_data('<key>\s(.+?)\s<',data_base[url]['key'])
if kkey not in keys_saved:
data_base[url]['key'] = data_base[url... | normal | {
"blob_id": "50a5d3431693b402c15b557357eaf9a85fc02b0b",
"index": 2921,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef update_key(data_base, url, kkey):\n keys_saved = regex.get_data('<key>\\\\s(.+?)\\\\s<', data_base[url]['key'])\n if kkey not in keys_saved:\n data_base[url]['key'] =... | [
0,
7,
8,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class warning_test(paw_test):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class warning_test(paw_test):
def test_warning_badchars(self):
self.paw.cset_lookup(self.... | flexible | {
"blob_id": "b4c6075aabe833f6fe23471f608d928edd25ef63",
"index": 372,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass warning_test(paw_test):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass warning_test(paw_test):\n\n def test_warning_badchars(self):\n self.paw.cset_lookup(s... | [
0,
1,
2,
3
] |
from .linked_list import LinkedList
class Queue:
def __init__(self):
self.list = LinkedList()
def enqueue(self, value):
self.list.insert_last(value)
def dequeue(self):
element = self.list.get_head()
self.list.remove_first()
return element
def front(self):
... | normal | {
"blob_id": "4830da6bee6b19a5e5a82a73d2f3b220ca59d28b",
"index": 9025,
"step-1": "<mask token>\n\n\nclass Queue:\n <mask token>\n <mask token>\n <mask token>\n\n def front(self):\n return self.list.get_tail()\n\n def rear(self):\n return self.list.get_head()\n",
"step-2": "<mask to... | [
3,
5,
6,
7
] |
from django.http import HttpResponse
from django.shortcuts import render
from .models import game
def index(request):
all_games = game.objects.all()
context = {
'all_games' : all_games
}
return render(request,'game/index.html',context)
def gameview(response):
return HttpResponse("<h1>Ludo ... | normal | {
"blob_id": "6623ac194e380c9554d72a1b20bf860b958dda97",
"index": 5961,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n all_games = game.objects.all()\n context = {'all_games': all_games}\n return render(request, 'game/index.html', context)\n\n\n<mask token>\n",
"step-3... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def calc():
height = v_height.get()
base = v_base.get()
print(f'height is {height}')
print(f'Basal length is {base}')
length = math.isqrt(height * height + base * base)
print('Lenght is {:.2f}'.format(length))
<|reserved_special_token_0|>
<|reserved_special_tok... | flexible | {
"blob_id": "77d7fb49ed4c3e78b148cd446e9a5c6a0e6fac8b",
"index": 835,
"step-1": "<mask token>\n\n\ndef calc():\n height = v_height.get()\n base = v_base.get()\n print(f'height is {height}')\n print(f'Basal length is {base}')\n length = math.isqrt(height * height + base * base)\n print('Lenght i... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def create_point(self):
point = [self.x, self.y]
return point
@staticmethod
def calculate_distance(point_1: [], point_2: []):
side_a = abs(point_1.x - point_2.... | flexible | {
"blob_id": "cda7595e46528739cad49a5d62a80bc7b2087157",
"index": 1911,
"step-1": "<mask token>\n\n\nclass Point:\n\n def __init__(self, x: int, y: int):\n self.x = x\n self.y = y\n\n def create_point(self):\n point = [self.x, self.y]\n return point\n\n @staticmethod\n def ... | [
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test():
tup = File.readInput('file.txt')
graph = tup[0]
edgeData = tup[1]
ctrl = Controller(graph, edgeData)
vertices = ctrl.nrVertices()
itv = verticesIterator(vertices)
assert itv.valid()
co... | flexible | {
"blob_id": "b01ff71792895bb8839e09ae8c4a449405349990",
"index": 7066,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test():\n tup = File.readInput('file.txt')\n graph = tup[0]\n edgeData = tup[1]\n ctrl = Controller(graph, edgeData)\n vertices = ctrl.nrVertices()\n itv = verti... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class UpYunStore(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, uri):
assert uri.startswith('upyun://')
self.session = requests.Session()
self.bucket, self.prefix = uri[8:].split('... | flexible | {
"blob_id": "d08e4c85890dab7cb421fa994ef1947d8919d58f",
"index": 8547,
"step-1": "<mask token>\n\n\nclass UpYunStore(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, uri):\n assert uri.startswith('upyun://')\n self.session = requests.Session()\n self.b... | [
7,
8,
11,
14,
20
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_readme_escaping() ->None:
"""Ensure the demo matches expected."""
assert main() == '<div><span>Escaping</span></div>'
<|reserved_special_token_1|>
<|reserved_special_token_0|>
from . import main
... | flexible | {
"blob_id": "7b459aad399a31f61b8686e1919b38d5538924b8",
"index": 2014,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_readme_escaping() ->None:\n \"\"\"Ensure the demo matches expected.\"\"\"\n assert main() == '<div><span>Escaping</span></div>'\n",
"step-3": "<mask token... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('ACI PostMan Variable Values.csv', encoding='utf-8-sig') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
print(row)
print("Let's configure the subnets on the Old BD")
print("First Let's lo... | flexible | {
"blob_id": "bdc9856bfc61127d6bca31658b1faf3da09f5b86",
"index": 161,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('ACI PostMan Variable Values.csv', encoding='utf-8-sig') as csvfile:\n reader = csv.DictReader(csvfile)\n for row in reader:\n print(row)\nprint(\"Let's configure th... | [
0,
1,
2,
3,
4
] |
from urllib import request
from urllib import error
from urllib.request import urlretrieve
import os, re
from bs4 import BeautifulSoup
import configparser
from apng2gif import apng2gif
config = configparser.ConfigParser()
config.read('crawler.config')
# 下載儲存位置
directoryLocation = os.getcwd() + '\\img'
# 設置要爬的頁面
urlLis... | normal | {
"blob_id": "7bcdd6c5c6e41b076e476e1db35b663e34d74a67",
"index": 1885,
"step-1": "<mask token>\n\n\ndef saveImg(imgurl, downLoadType):\n fileLocation = directoryLocation + '\\\\' + downLoadType + '\\\\' + title\n if not os.path.exists(fileLocation):\n os.makedirs(fileLocation)\n file = fileLocati... | [
3,
4,
5,
6,
7
] |
"""2520 is the smallest number that can be divided by each of the
numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all
of the numbers from 1 to 20?
"""
from fractions import gcd
def smallest_divisible(nmax=20):
smallest = 1
for i in range(1, nmax+1):... | normal | {
"blob_id": "1cc696410a5d2eaf294d032c04a96974d5ef5db0",
"index": 2831,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef smallest_divisible(nmax=20):\n smallest = 1\n for i in range(1, nmax + 1):\n if smallest % i:\n smallest *= i / gcd(i, smallest)\n return smallest\n",
... | [
0,
1,
2,
3
] |
from django.conf.urls import url
from django.contrib.auth.views import login,logout
from appPortas.views import *
urlpatterns = [
url(r'^porta/list$', porta_list, name='porta_list'),
url(r'^porta/detail/(?P<pk>\d+)$',porta_detail, name='porta_detail'),
url(r'^porta/new/$', porta_new, name='porta_new'),
... | normal | {
"blob_id": "5e355732f07029aa644617ac9b5e9ad50ee9397f",
"index": 1161,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('^porta/list$', porta_list, name='porta_list'), url(\n '^porta/detail/(?P<pk>\\\\d+)$', porta_detail, name='porta_detail'), url(\n '^porta/new/$', porta_new, name... | [
0,
1,
2,
3
] |
#!/usr/bin/python2
#
# Author: Victor Ananjevsky, 2007 - 2010
# based on xdg-menu.py, written by Piotr Zielinski (http://www.cl.cam.ac.uk/~pz215/)
# License: GPL
#
# This script takes names of menu files conforming to the XDG Desktop
# Menu Specification, and outputs their FVWM equivalents to the
# standard output.
#
#... | normal | {
"blob_id": "214aadb7b3fc125da12f098bde87fce295349fdf",
"index": 1917,
"step-1": "#!/usr/bin/python2\n#\n# Author: Victor Ananjevsky, 2007 - 2010\n# based on xdg-menu.py, written by Piotr Zielinski (http://www.cl.cam.ac.uk/~pz215/)\n# License: GPL\n#\n# This script takes names of menu files conforming to the XDG... | [
0
] |
# encoding=utf-8
from lib.calculate_time import tic,toc
import scipy as sp
import numpy as np
from lib.make_A import make_A
from lib.make_distance import make_distance
from lib.lambda_sum_smallest import lambda_sum_smallest
from lib.fiedler import fiedler
from lib.make_al import make_al
import math
from lib.newmatrix i... | normal | {
"blob_id": "77d545d1a4fc5f96ae19f654a32ab75707434d46",
"index": 7614,
"step-1": "# encoding=utf-8\nfrom lib.calculate_time import tic,toc\nimport scipy as sp\nimport numpy as np\nfrom lib.make_A import make_A\nfrom lib.make_distance import make_distance\nfrom lib.lambda_sum_smallest import lambda_sum_smallest\n... | [
0
] |
<|reserved_special_token_0|>
class ConfigurationContactForm(forms.ModelForm):
class Meta:
model = ConfigurationContact
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def clean_phone_number_external(self):
p... | flexible | {
"blob_id": "f6f1cd95e4aaa5e434c3cf3cff0d46b45fc7b830",
"index": 6190,
"step-1": "<mask token>\n\n\nclass ConfigurationContactForm(forms.ModelForm):\n\n\n class Meta:\n model = ConfigurationContact\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def clean_phone_number_ext... | [
11,
13,
15,
16,
18
] |
import contextlib
import datetime
import fnmatch
import os
import os.path
import re
import subprocess
import sys
import click
import dataset
def get_cmd_output(cmd):
"""Run a command in shell, and return the Unicode output."""
try:
data = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDO... | normal | {
"blob_id": "16446c2c5612a14d4364cbefb949da0b473f7454",
"index": 7934,
"step-1": "<mask token>\n\n\ndef analyze_commit(row):\n row['conventional'] = row['lax'] = False\n m = re.search(STRICT, row['subj'])\n if m:\n row['conventional'] = True\n else:\n m = re.search(LAX, row['subj'])\n ... | [
2,
6,
7,
8,
9
] |
"""This module defines simple utilities for making toy datasets to be used in testing/examples"""
##################################################
# Import Miscellaneous Assets
##################################################
import pandas as pd
###############################################
# Import Learning Ass... | normal | {
"blob_id": "285ca945696b32160175f15c4e89b3938f41ebf4",
"index": 2172,
"step-1": "<mask token>\n\n\ndef get_diabetes_data(target='progression'):\n \"\"\"Get the SKLearn Diabetes regression dataset, formatted as a DataFrame\n\n Parameters\n ----------\n target: String, default='progression'\n W... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import Common.Common.GeneralSet as GeneralSet
import TestExample.Test as Test
from Common.Common.ProcessDefine import *
def MainRun():
Cmd()
Test.TestGo()
def Cmd():
if (len(sys.argv) != 3):
print('error cmdargument count!')
return... | normal | {
"blob_id": "734561c2f127418bdc612f84b3b1ba125b6a2723",
"index": 3784,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef MainRun():\n Cmd()\n Test.TestGo()\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef MainRun():\n Cmd()\n Test.TestGo()\n\n\ndef Cmd():\n if len(sys.argv) !=... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
plt.plot(data.std(axis=0))
plt.show()
plt.plot(data.max(axis=0))
plt.plot(data.mean(axis=0))
plt.plot(data.min(axis=0))
<|reserved_special_token_1|>
<|reserved_special_token_0|>
data = np.loadtxt(fname='inflammation-01.csv', de... | flexible | {
"blob_id": "52064b518ad067c9906e7de8542d9a399076a0b5",
"index": 4214,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.plot(data.std(axis=0))\nplt.show()\nplt.plot(data.max(axis=0))\nplt.plot(data.mean(axis=0))\nplt.plot(data.min(axis=0))\n",
"step-3": "<mask token>\ndata = np.loadtxt(fname='inflamm... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('ABC' if input() == '1' else 'chokudai')
<|reserved_special_token_1|>
#ABC114 A - クイズ
print("ABC" if input()=="1" else "chokudai")
| flexible | {
"blob_id": "14d31a4b7491a7f7a64cd151e79c23546e4a3cd2",
"index": 7683,
"step-1": "<mask token>\n",
"step-2": "print('ABC' if input() == '1' else 'chokudai')\n",
"step-3": "#ABC114 A - クイズ\nprint(\"ABC\" if input()==\"1\" else \"chokudai\")\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('{:>5}\t{:>5}'.format('raw', 'v'))
while True:
print('{:>5}\t{:>5.3f}'.format(chan.value, chan.voltage))
time.sleep(0.5)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
i2c = busio.I2C(board.SCL, board.S... | flexible | {
"blob_id": "388904b6b826a1c718b85f2951a3189bb5abea2a",
"index": 9755,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('{:>5}\\t{:>5}'.format('raw', 'v'))\nwhile True:\n print('{:>5}\\t{:>5.3f}'.format(chan.value, chan.voltage))\n time.sleep(0.5)\n",
"step-3": "<mask token>\ni2c = busio.I2C(... | [
0,
1,
2,
3,
4
] |
#
# @lc app=leetcode.cn id=15 lang=python3
#
# [15] 三数之和
#
# https://leetcode-cn.com/problems/3sum/description/
#
# algorithms
# Medium (25.76%)
# Likes: 1904
# Dislikes: 0
# Total Accepted: 176.6K
# Total Submissions: 679K
# Testcase Example: '[-1,0,1,2,-1,-4]'
#
# 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,... | normal | {
"blob_id": "ccf3ada9a2bedf29820170f2e8184fc16f1b7aea",
"index": 9580,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def threeSum(self, nums: List[int]) ->List[List[int]]:\n res = []\n nums.sort()\n for k in range(len(nums)... | [
0,
1,
2,
3
] |
from application.identifier import Identifier
if __name__ == '__main__':
idf = Identifier()
while raw_input('Hello!, to start listening press enter, to exit press q\n'
) != 'q':
idf.guess()
| normal | {
"blob_id": "d8da01433b2e6adb403fdadc713d4ee30e92c787",
"index": 4829,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n idf = Identifier()\n while raw_input('Hello!, to start listening press enter, to exit press q\\n'\n ) != 'q':\n idf.guess()\n",
"step-3"... | [
0,
1,
2
] |
from colorama import init, Fore, Style
import tempConv
#============================================================================#
# TEMP CONVERSION PROGRAM: #
#============================================================================#
#------------------------... | normal | {
"blob_id": "235bb1b9d4c41c12d7667a6bac48737464c685c7",
"index": 568,
"step-1": "<mask token>\n\n\ndef menu(x):\n \"\"\" Takes a list as argument and displays as a menu \"\"\"\n for i in range(len(x)):\n print('{0:>4s} {1:<3s}{2:^5s}{3:<15}'.format(str(i + 1) + ')', x[i]\n [1], '-->', x[i... | [
3,
5,
7,
10,
11
] |
import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
# 1. sepal length in cm
# 2. sepal width in cm
# 3. petal length in cm
# 4. petal width in cm
TrainingData = np.loadtxt("Data2",delimiter = ',',skiprows = 1,dtype = str)
class Knn(object):
"""docstring for data"""
def ... | normal | {
"blob_id": "5e0affbd295d7237784cd8e72926afeda6456500",
"index": 7080,
"step-1": "<mask token>\n\n\nclass Knn(object):\n <mask token>\n\n def __init__(self, TrainingData):\n self.TrainingData = TrainingData\n self.nFeatures = self.TrainingData.shape[1] - 1\n self.data = TrainingData[:,... | [
4,
5,
7,
8,
9
] |
import math
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def value(energy, noise, x, gen):
logp_x = energy(x)
logq_x = noise.log_prob(x).unsqueeze(1)
logp_gen = energy(gen)
logq_ge... | normal | {
"blob_id": "010a132645883915eff605ae15696a1fac42d570",
"index": 8276,
"step-1": "<mask token>\n\n\ndef value(energy, noise, x, gen):\n logp_x = energy(x)\n logq_x = noise.log_prob(x).unsqueeze(1)\n logp_gen = energy(gen)\n logq_gen = noise.log_prob(gen).unsqueeze(1)\n ll_data = logp_x - torch.log... | [
7,
8,
9,
11,
12
] |
import os, subprocess
os.environ['FLASK_APP'] = "app/app.py"
os.environ['FLASK_DEBUG'] = "1"
# for LSTM instead: https://storage.googleapis.com/jacobdanovitch/twtc/lstm.tar.gz
# Will have to change app.py to accept only attention_weights
subprocess.call('./serve_model.sh')
subprocess.call(['flask', 'run'])
| normal | {
"blob_id": "cbad5d6f381e788a2f064aac0a5d468f40b39c93",
"index": 3696,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsubprocess.call('./serve_model.sh')\nsubprocess.call(['flask', 'run'])\n",
"step-3": "<mask token>\nos.environ['FLASK_APP'] = 'app/app.py'\nos.environ['FLASK_DEBUG'] = '1'\nsubprocess.c... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s.connect((host, port))
<|reserved_special_token_0|>
s.sendall(cmd.encode())
<|reserved_special_token_0|>
print(data.decode())
s.close()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
s = socket.socket()
host = socke... | flexible | {
"blob_id": "596814032218c3db746f67e54e4f1863753aea06",
"index": 6299,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ns.connect((host, port))\n<mask token>\ns.sendall(cmd.encode())\n<mask token>\nprint(data.decode())\ns.close()\n",
"step-3": "<mask token>\ns = socket.socket()\nhost = socket.gethostname... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(N):
a, b = map(int, readline().split())
if a == 0 and b == 0:
zeropair += 1
continue
if a == 0:
zeroa += 1
continue
if b == 0:
zerob += 1
continue
... | flexible | {
"blob_id": "098488fd10bcf81c4efa198a44d2ff87e4f8c130",
"index": 3225,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(N):\n a, b = map(int, readline().split())\n if a == 0 and b == 0:\n zeropair += 1\n continue\n if a == 0:\n zeroa += 1\n continue\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class BBCCrawler(AbstractWebCrawler):
<|reserved_special_token_0|>
name = 'web_bbc'
resource_link = (
'http://www.bbc.com/news/topics/cz4pr2gd85qt/cyber-security')
resource_label = 'bbc'
custom_settin... | flexible | {
"blob_id": "3c22fbfd7d83ff3ecacabc3c88af2169fa5906b9",
"index": 5190,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass BBCCrawler(AbstractWebCrawler):\n <mask token>\n name = 'web_bbc'\n resource_link = (\n 'http://www.bbc.com/news/topics/cz4pr2gd85qt/cyber-security')\n resour... | [
0,
2,
3,
4,
5
] |
class Error(Exception):
pass
class TunnelInstanceError(Error):
def __init__(self, expression, message):
self.expression = expression
self.message = message
class TunnelManagerError(Error):
def __init__(self, expression, message):
self.expression = expression
self.messag... | normal | {
"blob_id": "661b622708692bd9cd1b3399835f332c86e39bf6",
"index": 8835,
"step-1": "<mask token>\n\n\nclass TunnelManagerError(Error):\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass TunnelManagerError(Error):\n\n def __init__(self, expression, message):\n self.expression = expression\n ... | [
1,
2,
3,
4,
5
] |
card = int(input())
last4 = card % 10000
print(last4)
| normal | {
"blob_id": "7b920545a0241b30b66ff99f330dbb361f747f13",
"index": 8297,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(last4)\n",
"step-3": "card = int(input())\nlast4 = card % 10000\nprint(last4)\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
# TODO - let user input file name on command line
level_file = 'level.txt'
# read characters in level.txt into
# terrain map
# which is array of columns
f = open(level_file)
terrain_map = []
for row in f:
col_index = 0
row_index = 0
for tile in row.rstrip():
if col_index == len(terrain_map):
terrain_map.appen... | normal | {
"blob_id": "fe1cc7660396071172c1ec65ba685e677e497646",
"index": 6354,
"step-1": "# TODO - let user input file name on command line\n\nlevel_file = 'level.txt'\n\n# read characters in level.txt into\n# terrain map\n# which is array of columns\nf = open(level_file)\nterrain_map = []\nfor row in f:\n\tcol_index = ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main(db_client: DBClient):
sns.set_theme()
peer_ids = db_client.get_dangling_peer_ids()
arrivals = db_client.get_inter_arrival_time(peer_ids)
results_df = pd.DataFrame(arrivals, columns=['id', 'peer_id', 'dif... | flexible | {
"blob_id": "51b28650f8ae6cbda3d81695acd27744e9bfebd1",
"index": 2528,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main(db_client: DBClient):\n sns.set_theme()\n peer_ids = db_client.get_dangling_peer_ids()\n arrivals = db_client.get_inter_arrival_time(peer_ids)\n results_df = pd.D... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(n):
l = list(map(lambda x: x * x, map(int, input().split())))
l.sort()
if l[0] + l[1] == l[2]:
s += 'YES\n'
else:
s += 'NO\n'
print(s, end='')
<|reserved_special_token_1|>
n = int(... | flexible | {
"blob_id": "f8b473451a15e42319b60f44a527d715c0032614",
"index": 3411,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(n):\n l = list(map(lambda x: x * x, map(int, input().split())))\n l.sort()\n if l[0] + l[1] == l[2]:\n s += 'YES\\n'\n else:\n s += 'NO\\n'\nprint... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in tags:
casa = i.find('td', {'class': re.compile('team-home')}).find('a')
visitante = i.find('td', {'class': re.compile('team-away')}).find('a')
print('Partido-> ' + casa.get_text() + ' vs ' + visitante.get_text... | flexible | {
"blob_id": "d07a26a69ccbbccf61402632dd6011315e0d61ed",
"index": 2710,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in tags:\n casa = i.find('td', {'class': re.compile('team-home')}).find('a')\n visitante = i.find('td', {'class': re.compile('team-away')}).find('a')\n print('Partido-> ' +... | [
0,
1,
2,
3,
4
] |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.db import models
SERVICE_RANGE_CHOISE = {(1, '1年'), (2, '2年'), (3, '3年'), (4, '4年'), (5, '5年'), (6, '6年'), (7, '7年'), (8, '8年'), (0, '长期')}
USER_STATUS_CHOISE = {(1, '停用'), (2, '正常'), (3, '锁定')}
DBSERVER_POS_CHOISE = {(1, '8层机房'), (2, '11层机房')... | normal | {
"blob_id": "c2490c3aacfa3ce22c3f47a69dbc44b695c2a2e5",
"index": 9509,
"step-1": "<mask token>\n\n\nclass Odbserver(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>\n ... | [
13,
14,
16,
17,
19
] |
"""A tiny example binary for the native Python rules of Bazel."""
import unittest
from bazel_tutorial.examples.py.lib import GetNumber
from bazel_tutorial.examples.py.fibonacci.fib import Fib
class TestGetNumber(unittest.TestCase):
def test_ok(self):
self.assertEqual(GetNumber(), 42)
def test_fib(self):
... | normal | {
"blob_id": "d126efa91b964a3a374d546bb860b39ae26dfa22",
"index": 256,
"step-1": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):\n <mask token>\n\n def test_fib(self):\n self.assertEqual(Fib(5), 8)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Question(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __str__(self):
return self.text
class AnswerChoice(models.Model):
"""Re... | flexible | {
"blob_id": "2c4f27e7d1bfe6d68fd0836094b9e350946913f6",
"index": 5480,
"step-1": "<mask token>\n\n\nclass Question(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.text\n\n\nclass AnswerChoice(models.Model):\n ... | [
14,
17,
18,
20,
22
] |
<|reserved_special_token_0|>
@respond_to('^term\\s+([\\w-]+)$')
@respond_to('^term\\s+create\\s+([\\w-]+)$')
@respond_to('^term\\s+add\\s+([\\w-]+)$')
def term_create(message, command):
"""
指定されたコマンドを生成する
"""
if command in ('list', 'help'):
return
command = command.lower()
if command i... | flexible | {
"blob_id": "86e97e7eaf0d23ccf4154b5ffc853c5aee966326",
"index": 5769,
"step-1": "<mask token>\n\n\n@respond_to('^term\\\\s+([\\\\w-]+)$')\n@respond_to('^term\\\\s+create\\\\s+([\\\\w-]+)$')\n@respond_to('^term\\\\s+add\\\\s+([\\\\w-]+)$')\ndef term_create(message, command):\n \"\"\"\n 指定されたコマンドを生成する\n ... | [
7,
9,
12,
15,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
try:
a = 100
b = a / 0
print(b)
except ZeroDivisionError as z:
print('Error= ', z)
<|reserved_special_token_1|>
try:
a=100
b=a/0
print(b)
except ZeroDivisionError as z:
print("Error= ",z) | flexible | {
"blob_id": "9dead39e41fd0f3cff43501c659050885a50fec3",
"index": 4521,
"step-1": "<mask token>\n",
"step-2": "try:\n a = 100\n b = a / 0\n print(b)\nexcept ZeroDivisionError as z:\n print('Error= ', z)\n",
"step-3": "try:\r\n a=100\r\n b=a/0\r\n print(b)\r\nexcept ZeroDivisionError as z:... | [
0,
1,
2
] |
try:
from setuptools import setup, find_packages
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name = "pip-utils",
version = "0.0.1",
url = 'https://github.com/mattpaletta/pip-utils',
packages = find_packages(),
inc... | normal | {
"blob_id": "5fe81a6143642d671686c6623a9ecc93e04a82bf",
"index": 5711,
"step-1": "<mask token>\n",
"step-2": "try:\n from setuptools import setup, find_packages\nexcept ImportError:\n import ez_setup\n ez_setup.use_setuptools()\n from setuptools import setup, find_packages\nsetup(name='pip-utils', ... | [
0,
1,
2
] |
import json
from iamport import Iamport
from django.views import View
from django.http import JsonResponse
from share.decorators import check_auth_decorator
class PaymentView(View):
@check_auth_decorator
def post(self, request):
data = json.loads(request.body)
try:
user = request... | normal | {
"blob_id": "c1c6db4dbd1e6719d30905babd6ccf5b1e76e75d",
"index": 2824,
"step-1": "import json\nfrom iamport import Iamport\n\nfrom django.views import View\nfrom django.http import JsonResponse\n\nfrom share.decorators import check_auth_decorator\n\nclass PaymentView(View):\n @check_auth_decorator\n def p... | [
0
] |
#!/usr/bin/python
import os, sys
import csv
import glob
if len(sys.argv)==3:
res_dir = sys.argv[1]
info = sys.argv[2]
else:
print "Incorrect arguments: enter outout directory"
sys.exit(0)
seg = dict([('PB2','1'), ('PB1','2'), ('PA','3'), ('HA','4'), ('NP','5'), ('NA','6'), ('MP','7'), ('NS','8')])
# Read th... | normal | {
"blob_id": "4a2796645f1ab585084be47c8cd984c2945aa38b",
"index": 4270,
"step-1": "#!/usr/bin/python\n\nimport os, sys\nimport csv\nimport glob\n\nif len(sys.argv)==3:\n res_dir = sys.argv[1]\n info = sys.argv[2]\n\nelse:\n print \"Incorrect arguments: enter outout directory\"\n sys.exit(0)\n\nseg = dict([('P... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_resnet18(pre_imgnet=False, num_classes=64):
model = torchvision.models.resnet18(pretrained=pre_imgnet)
model.fc = nn.Linear(512, 64)
return model
<|reserved_special_token_1|>
import torch
import torchvisio... | flexible | {
"blob_id": "8e05b2723d8c50354e785b4bc7c5de8860aa706d",
"index": 5355,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_resnet18(pre_imgnet=False, num_classes=64):\n model = torchvision.models.resnet18(pretrained=pre_imgnet)\n model.fc = nn.Linear(512, 64)\n return model\n",
"step-3"... | [
0,
1,
2
] |
'''
A linear regression learning algorithm example using TensorFlow library.
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tensorflow as tf
import argparse
import numpy
rng = numpy.random
#"python tf_cnn_benchmarks.py --device... | normal | {
"blob_id": "2e8d39d6d72672de8e4eac8295b90d68b1dff938",
"index": 9007,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nparser.add_argument('--batch_size', help='batch_size', required=False,\n default=32)\nparser.add_argument('--data_size', help='data_size', required=False,\n default=1700)\nparser.ad... | [
0,
1,
2,
3,
4
] |
from flask_restful import Api, Resource, reqparse
class HelloApiHandler(Resource):
def get(self):
return {
'resultStatus': 'SUCCESS',
'message': "Hello Api Handler"
}
def post(self):
print(self)
parser = reqparse.RequestParser()
parser.add_argument('type', type=str)
parser.ad... | normal | {
"blob_id": "80c3d9165c1b592122fabf6382e265465604989c",
"index": 1450,
"step-1": "<mask token>\n\n\nclass HelloApiHandler(Resource):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass HelloApiHandler(Resource):\n\n def get(self):\n return {'resultStatus': 'SUCCESS', 'message':... | [
1,
2,
3,
4,
5
] |
# from django.contrib.auth import forms
# class UserRegister(froms.M):
# class Meta:
# fields = []
| normal | {
"blob_id": "c1f432ff70b21064f36cf9651f8cff9c69361d5c",
"index": 9073,
"step-1": "# from django.contrib.auth import forms\n\n\n\n# class UserRegister(froms.M):\n# class Meta:\n# fields = []\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
1
]
} | [
1
] |
"""
Find two distinct numbers in values whose sum is equal to 100.
Assign one of them to value1 and the other one to value2.
If there are several solutions, any one will be marked as correct.
Optional step to check your answer:
Print the value of value1 and value2.
"""
values = [72, 50, 48, 50, 7, 66, 62... | normal | {
"blob_id": "c0ebf10b8c0cb4af11608cafcdb85dbff4abdf90",
"index": 4755,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor x in values:\n for y in values:\n if x + y == 100 and x != y:\n value1 = x\n value2 = y\nprint(value1)\nprint(value2)\n",
"step-3": "<mask token>\nva... | [
0,
1,
2,
3
] |
import json
# No llego a solucionarlo entero.
#Aparcamientos que estan cubiertos en el centro de deportes .
from pprint import pprint
with open('Aparcamientos.json') as data_file:
data = json.load(data_file)
for x in data['docs']:
if x['TIPOLOGIA'] == 'Cubierto':
print(x['NOMBRE'])
elif x['TIPOLOGIA'] == '... | normal | {
"blob_id": "d111f93144a1d2790470365d0ca31bcea17713d7",
"index": 8766,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('Aparcamientos.json') as data_file:\n data = json.load(data_file)\nfor x in data['docs']:\n if x['TIPOLOGIA'] == 'Cubierto':\n print(x['NOMBRE'])\n elif x['TIPOL... | [
0,
1,
2,
3
] |
num=int(input("Enter the number: "))
table=[num*i for i in range(1,11)]
print(table)
with open("table.txt","a") as f:
f.write(f"{num} table is: {str(table)}")
f.write('\n') | normal | {
"blob_id": "657ac500c40ddbd29f5e3736a78ed43e7d105478",
"index": 9417,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(table)\nwith open('table.txt', 'a') as f:\n f.write(f'{num} table is: {str(table)}')\n f.write('\\n')\n",
"step-3": "num = int(input('Enter the number: '))\ntable = [(num * ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class BuyerSellerAppConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class BuyerSellerAppConfig(AppConfig):
name = 'buyer_seller_app'
<|reserved_special_tok... | flexible | {
"blob_id": "0b730314fef31e7304a8f5d8bb998581b021a610",
"index": 1798,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass BuyerSellerAppConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass BuyerSellerAppConfig(AppConfig):\n name = 'buyer_seller_app'\n",
"step-4": "from... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while 1:
successFlag, frame = cap.read()
if not successFlag:
cv2.waitKey(0)
break
lower_hsv_thresholdcr = np.array([0, 250, 250])
upper_hsv_thresholdcr = np.array([10, 255, 255])
gray = np.float... | flexible | {
"blob_id": "5ccfad17ede9f685ea9ef9c514c0108a61c2dfd6",
"index": 8699,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile 1:\n successFlag, frame = cap.read()\n if not successFlag:\n cv2.waitKey(0)\n break\n lower_hsv_thresholdcr = np.array([0, 250, 250])\n upper_hsv_threshold... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def distribution_plot():
confirmed_results = pd.read_csv(
'https://raw.githubusercontent.com/dsfsi/covid19za/master/data/covid19za_timeline_confirmed.csv'
)
trial = pd.notnull(confirmed_results['age'])
print('Enter the number of bins between 0 and 100')
n_o... | flexible | {
"blob_id": "38be4e75c2311a1e5a443d39a414058dc4d1879b",
"index": 2320,
"step-1": "<mask token>\n\n\ndef distribution_plot():\n confirmed_results = pd.read_csv(\n 'https://raw.githubusercontent.com/dsfsi/covid19za/master/data/covid19za_timeline_confirmed.csv'\n )\n trial = pd.notnull(confirmed... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('contacts', apiviews.ContactsView.as_view(), name=
'contacts'), path('contact/<int:pk>', apiviews.ContactView.as_view(),
name='contact'), path('signup', apiviews.create_user_with_token, name=
'signu... | flexible | {
"blob_id": "5f56838ad0717c4f7a2da6b53f586a88b0166113",
"index": 8629,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('contacts', apiviews.ContactsView.as_view(), name=\n 'contacts'), path('contact/<int:pk>', apiviews.ContactView.as_view(),\n name='contact'), path('signup', apiv... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
aq.add_argument('-i', '--input', required=True, help='input image path')
aq.add_argument('-o', '--output', help=
'path where you want to download the image')
<|reserved_special_token_0|>
if args['output']:
cv2.imwrite(args... | flexible | {
"blob_id": "10cefb1cf2392fdcd368f11d0d69774a9ffa73ec",
"index": 2816,
"step-1": "<mask token>\n",
"step-2": "<mask token>\naq.add_argument('-i', '--input', required=True, help='input image path')\naq.add_argument('-o', '--output', help=\n 'path where you want to download the image')\n<mask token>\nif args[... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
pairs = ['usdt', 'btc']
warn_msg = '** WARN ** '
info_msg = '** INFO **'
| flexible | {
"blob_id": "26289d88ac51ee359faa81ca70b01879d2b1f840",
"index": 9460,
"step-1": "<mask token>\n",
"step-2": "pairs = ['usdt', 'btc']\nwarn_msg = '** WARN ** '\ninfo_msg = '** INFO **'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
def nothing(x):
pass
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def nothing(x):
pass
cv.namedWindow('Binary')
cv.createTrackbar('threshold', 'Binary', 0, 255, nothing)
cv.setTrackbarPos('threshold', 'Binary', 127)
<|reserved_spe... | flexible | {
"blob_id": "034d4027ea98bca656178b66c5c6e6e8b13e4b9e",
"index": 4219,
"step-1": "<mask token>\n\n\ndef nothing(x):\n pass\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef nothing(x):\n pass\n\n\ncv.namedWindow('Binary')\ncv.createTrackbar('threshold', 'Binary', 0, 255, nothing)\ncv.setTrackbarPos(... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Solution:
def letterCombinations(self, digits: str) ->List[str]:
d = {(2): 'abc', (3): 'def', (4): 'ghi', (5): 'jkl', (6): 'mno... | flexible | {
"blob_id": "de925b8f6bd31bfdfd1f04628659847b0761899d",
"index": 340,
"step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass Solution:\n\n def letterCombinations(self, digits: str) ->List[str]:\n d = {(2): 'abc', (3): 'def', (4): 'ghi',... | [
1,
2,
3,
4,
5
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.