code stringlengths 13 1.2M | order_type stringclasses 1
value | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
# Generated by Django 2.1 on 2018-12-09 21:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='replays',
name='id',
),
mi... | normal | {
"blob_id": "2c1ea45d3c7ee822ec58c2fadaf7fc182acc4422",
"index": 9264,
"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 = [('api', '0001... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
import json
import re
import scrapy
from scrapy import Request
class PageInfoAjaxSpider(scrapy.Spider):
name = 'page_info_ajax'
allowed_domains = ['bilibili.com']
# start_urls = ['http://bilibili.com/']
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x6... | normal | {
"blob_id": "cdcb2710291e9897b874f63840193470ed58be49",
"index": 825,
"step-1": "<mask token>\n\n\nclass PageInfoAjaxSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://s.search.bilibili.com/cate/search?callback=jque... | [
2,
3,
4,
5,
6
] |
import math
import pandas as pd
from matplotlib import pyplot as plt
tests = [
{ "task": "listsort", "prompt": "examples", "length": 5, "shots": 0, "accuracy": 0.28, "trials": 50},
{ "task": "listsort", "prompt": "examples", "length": 5, "shots": 1, "accuracy": 0.40, "trials": 50},
{ "task": "listsort", "... | normal | {
"blob_id": "6b6397fd18848ffa2ae9c0ec1443d20f2cbeb8b0",
"index": 3637,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor d in tests:\n d['code'] = d['prompt'] == 'code'\n d['correct'] = d['accuracy'] * d['trials']\n p = d['accuracy']\n d['err'] = 0.842 * math.sqrt(p * (1 - p) / d['trials'])\... | [
0,
1,
2,
3,
4
] |
# Get Facebook's bAbi dataset
from utils import maybe_download
from shutil import rmtree
import os
import tarfile
def get_babi_en(get_10k=False):
data_dir = "datasets/tasks_1-20_v1-2/en/"
if get_10k == True:
data_dir = "datasets/tasks_1-20_v1-2/en-10k/"
maybe_download('https://s3.amazonaws... | normal | {
"blob_id": "7a4d04bd60b5f5555982af372145f9f4bcd83ca2",
"index": 8194,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_babi_en(get_10k=False):\n data_dir = 'datasets/tasks_1-20_v1-2/en/'\n if get_10k == True:\n data_dir = 'datasets/tasks_1-20_v1-2/en-10k/'\n maybe_download(\n ... | [
0,
1,
2,
3
] |
# mathematical operators
'''
* multiply
/ divide (normal)
// divide (integer)
% modulus (remainder)
+ add
- subtract
** exponent (raise to)
'''
print(2 * 3)
# comparison operators
'''
== equal to
!= not equal to
> greater than
< less than
>= greater or equal to
<= less or equal t... | normal | {
"blob_id": "911257bad3baab89e29db3facb08ec41269b41e3",
"index": 9953,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(2 * 3)\n<mask token>\nif a >= b:\n print('You can drive the car, you are ', a)\nelse:\n print('Sorry, you are too small')\n",
"step-3": "<mask token>\nprint(2 * 3)\n<mask to... | [
0,
1,
2,
3
] |
import re
def molecule_to_list(molecule: str) -> list:
"""Splits up a molucule into elements and amount in order of appearance
Args:
molecule (str): The molecule to split up
Raises:
ValueError: If molecule starts with a lower case letter
ValueError: If molecule contains a non-alp... | normal | {
"blob_id": "a14a1803a0bae755803c471b12035398de262dbc",
"index": 9138,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef molecule_to_list(molecule: str) ->list:\n \"\"\"Splits up a molucule into elements and amount in order of appearance\n\n Args:\n molecule (str): The molecule to split... | [
0,
1,
2,
3
] |
my_func = lambda x, y: x ** y
| normal | {
"blob_id": "93baa6ba14d06661731dce3e34ea93d49c06001b",
"index": 9043,
"step-1": "<mask token>\n",
"step-2": "my_func = lambda x, y: x ** y\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
"""
First run in samples:
mogrify -format png -density 150 input.pdf -quality 90 -- *.pdf
"""
import cv2
import os
import numpy as np
from matplotlib import pylab
def peakdetect(v, delta, x=None):
"""
Converted from MATLAB script at http://billauer.co.il/peakdet.html
Returns two arrays
fun... | normal | {
"blob_id": "9887e001f13ed491331c79c08450299afcc0d7cd",
"index": 4279,
"step-1": "\"\"\"\nFirst run in samples: \nmogrify -format png -density 150 input.pdf -quality 90 -- *.pdf\n\"\"\"\n\nimport cv2\nimport os\nimport numpy as np\nfrom matplotlib import pylab\n\ndef peakdetect(v, delta, x=None):\n \"\"\"\n ... | [
0
] |
from django.conf.urls import url, include
from . import views
explore_patterns = [
url(r'^$', views.explore),
url(r'^(?P<model_type>\w+)/$', views.get_by_model_type),
url(r'^(?P<model_type>\w+)/(?P<id>\w+)/$', views.get_by_model_id),
url(r'^(?P<model_type>\w+)/(?P<id>\w+)/download$', views.download_me... | normal | {
"blob_id": "89078ddd7dad3a2727b66566457b9ac173abe607",
"index": 8506,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nexplore_patterns = [url('^$', views.explore), url('^(?P<model_type>\\\\w+)/$',\n views.get_by_model_type), url('^(?P<model_type>\\\\w+)/(?P<id>\\\\w+)/$',\n views.get_by_model_id), ... | [
0,
1,
2,
3
] |
# Generated by Django 3.2.4 on 2021-08-09 03:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('employee', '0013_auto_20... | normal | {
"blob_id": "f7a335db0ddf8a871e98eac54b59c41a40622153",
"index": 4566,
"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 = [migrations.sw... | [
0,
1,
2,
3,
4
] |
"""Module to convert a lanelet UTM representation to OSM."""
__author__ = "Benjamin Orthen"
__copyright__ = "TUM Cyber-Physical Systems Group"
__credits__ = ["Priority Program SPP 1835 Cooperative Interacting Automobiles"]
__version__ = "1.1.2"
__maintainer__ = "Benjamin Orthen"
__email__ = "commonroad-i06@in.tum.de"
... | normal | {
"blob_id": "472c8b0649e29c31b144607080938793e5f1293e",
"index": 6834,
"step-1": "<mask token>\n\n\nclass L2OSMConverter:\n <mask token>\n\n def __init__(self, proj_string):\n if proj_string:\n self.proj = Proj(proj_string)\n else:\n self.proj = Proj(DEFAULT_PROJ_STRING)... | [
7,
8,
10,
16,
17
] |
import matplotlib.pyplot as plt
import numpy as np
from sklearn.utils import shuffle
import math
import vis_utils
class FLAGS(object):
image_height = 100
image_width = 100
image_channel = 1
CORRECT_ORIENTATION = True
class PrepareData():
def __init__(self):
... | normal | {
"blob_id": "315fe68f4adf39ded46fa9ad059fd2e962e46437",
"index": 8533,
"step-1": "<mask token>\n\n\nclass PrepareData:\n\n def __init__(self):\n return\n\n def sparse_tuple_from_label(self, sequences, dtype=np.int32):\n \"\"\"Create a sparse representention of x.\n Args:\n s... | [
7,
8,
9,
12,
13
] |
from django.apps import AppConfig
class Iapp1Config(AppConfig):
name = 'iapp1'
| normal | {
"blob_id": "c27ca6a8c38f2b96011e3a09da073ccc0e5a1467",
"index": 3386,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n name = 'iapp1'\n",
"step-4": "from django.apps import AppConfig... | [
0,
1,
2,
3
] |
import numpy as np
import cv2
import datetime
import random
# from random import randint
import time
import logging
def GetDateTimeString():
dt = str(datetime.datetime.now()).split(".")[0]
clean = dt.replace(" ","_").replace(":","_")
return clean
def GetBackground(bgNumber):
# bgImage = './backgrounds... | normal | {
"blob_id": "a14c23398bbf42832a285d29c1b80aefc5fdaf6c",
"index": 9031,
"step-1": "<mask token>\n\n\ndef GetDateTimeString():\n dt = str(datetime.datetime.now()).split('.')[0]\n clean = dt.replace(' ', '_').replace(':', '_')\n return clean\n\n\ndef GetBackground(bgNumber):\n bgImage = '/home/pi/piboot... | [
3,
4,
5,
6,
7
] |
include ("RecExRecoTest/RecExRecoTest_RTT_common.py")
from BTagging.BTaggingFlags import BTaggingFlags
BTaggingFlags.Active=False
# main jobOption
include ("RecExCommon/rdotoesdnotrigger.py")
include ("RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py")
| normal | {
"blob_id": "34c91d273648ae72731fba7f5519a4920d77c0c3",
"index": 7192,
"step-1": "<mask token>\n",
"step-2": "include('RecExRecoTest/RecExRecoTest_RTT_common.py')\n<mask token>\ninclude('RecExCommon/rdotoesdnotrigger.py')\ninclude('RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py')\n",
"step-3": "includ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
from lemonpie import lemonpie
from flask_debugtoolbar import DebugToolbarExtension
def main():
lemonpie.debug = True
lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
toolbar = DebugToolbarExtension(lemonpie)
lemonpie.run('0.0.0.0')
if __name__ == '__main__':
main()
| normal | {
"blob_id": "328c483bf59c6b84090e6bef8814e829398c5a56",
"index": 6954,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n lemonpie.debug = True\n lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False\n toolbar = DebugToolbarExtension(lemonpie)\n lemonpie.run('0.0.0.0')\n\n\n<m... | [
0,
1,
2,
3,
4
] |
# nomer7
import no2_modul2 # Atau apapun file-nya yang kamu buat tadi
class MhsTIF(no2_modul2.Mahasiswa): # perhatikan class induknya : Mahasiswa
"""Class MhsTIF yang dibangun dari class Mahasiswa"""
def kataKanPy(self):
print('Python is cool.')
"Apakah metode / state itu berasal ... | normal | {
"blob_id": "b54f47de85fe95d47a1b1be921997ad86d7b450d",
"index": 8777,
"step-1": "# nomer7\r\n\r\nimport no2_modul2 # Atau apapun file-nya yang kamu buat tadi\r\n\r\nclass MhsTIF(no2_modul2.Mahasiswa): # perhatikan class induknya : Mahasiswa\r\n \"\"\"Class MhsTIF yang dibangun dari class Mahasiswa... | [
0
] |
import enter
import loginout
import roleinfo
import zhanyi
import package
#import matrix | normal | {
"blob_id": "de665735f02c7569ab382fdc3e910d5d3ac05bb5",
"index": 9088,
"step-1": "<mask token>\n",
"step-2": "import enter\nimport loginout\nimport roleinfo\nimport zhanyi\nimport package\n",
"step-3": "import enter\nimport loginout\nimport roleinfo\nimport zhanyi\nimport package\n#import matrix",
"step-4"... | [
0,
1,
2
] |
import urllib.request
import praw
from praw import reddit
from praw.models.listing.mixins import submission
def download_subreddit(sub):
reddit = praw.Reddit(client_id='oFOYuOd31vUb4UstBWDhnQ',
client_secret='0W_86zufGFCJlSE4lK3CwF_0UEQEQw',
username='MarshallBranin',
... | normal | {
"blob_id": "d19310a45a684a7bbb456555a954439df8ae92b6",
"index": 1392,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef download_subreddit(sub):\n reddit = praw.Reddit(client_id='oFOYuOd31vUb4UstBWDhnQ', client_secret=\n '0W_86zufGFCJlSE4lK3CwF_0UEQEQw', username='MarshallBranin',\n ... | [
0,
1,
2,
3
] |
def main():
# defaults to 0
print a
a = 7
a *= 6
print a
| normal | {
"blob_id": "0527dc2b6fa0fe703b604c6e28fba44fe6def83b",
"index": 1862,
"step-1": "def main():\n # defaults to 0\n print a\n\n a = 7\n a *= 6\n print a\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
from dataloaders.datasets import caltech, embedding
from torch.utils.data import DataLoader
def make_data_loader(args, **kwargs):
if args.dataset == 'caltech101':
train_set = caltech.caltech101Classification(args, split='train')
val_set = caltech.caltech101Classification(args, split='val')
test_set = caltech.c... | normal | {
"blob_id": "1ea71f7b17809189eeacf19a6b7c4c7d88a5022c",
"index": 1070,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef make_id2class(args):\n if args.dataset == 'caltech101':\n return caltech.id2class\n",
"step-3": "<mask token>\n\n\ndef make_data_loader(args, **kwargs):\n if args.d... | [
0,
1,
2,
3,
4
] |
import boto3
ec2 = boto3.resource('ec2')
response = client.allocate_address(Domain='standard')
print(response)
| normal | {
"blob_id": "6424fccb7990b0a1722d5d787e7eb5acb4ff1a74",
"index": 1863,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(response)\n",
"step-3": "<mask token>\nec2 = boto3.resource('ec2')\nresponse = client.allocate_address(Domain='standard')\nprint(response)\n",
"step-4": "import boto3\nec2 = bot... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
#
# Copyright (C) 2011-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that... | normal | {
"blob_id": "955cf040aaf882328e31e6a943bce04cf721cb11",
"index": 538,
"step-1": "<mask token>\n\n\ndef get_repo_url(repo):\n url = repo.replace('upstream:', 'git://git.baserock.org/delta/')\n url = url.replace('baserock:baserock/',\n 'git://git.baserock.org/baserock/baserock/')\n url = url.replac... | [
5,
7,
8,
10,
11
] |
from django.contrib import admin
from Evaluacion.models import Evaluacion
admin.site.register(Evaluacion)
| normal | {
"blob_id": "4ef4e302304ccf2dc92cdebe134e104af47aae20",
"index": 3795,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Evaluacion)\n",
"step-3": "from django.contrib import admin\nfrom Evaluacion.models import Evaluacion\nadmin.site.register(Evaluacion)\n",
"step-4": null,
"step-... | [
0,
1,
2
] |
import spacy
from vaderSentiment import vaderSentiment
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def hello():
return render_template('index.html')
@app.route('/',methods=['POST'])
def func():
st=request.form["review"]
if(st==''):
return render_temp... | normal | {
"blob_id": "2d7f7cb66480ecb8335949687854554679026959",
"index": 9988,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return render_template('index.html')\n\n\n@app.route('/', methods=['POST'])\ndef func():\n st = request.form['review']\n if st == '':\n return render_template('index... | [
4,
5,
6,
7,
8
] |
___ findmissingnumberusingxor(myarray
print "Given Array:", myarray
#print "Len of the Array:", len(myarray)
arraylen _ l..(myarray)
xorval _ 0
#print "In the First loop"
___ i __ r..(1, arraylen + 2
#print xorval,"^",i,"is",xorval^i
xorval _ xorval ^ i
#print "In t... | normal | {
"blob_id": "892dd4259950c66669b21c5dbc7b738ddb5aa586",
"index": 5734,
"step-1": "\n___ findmissingnumberusingxor(myarray\n print \"Given Array:\", myarray\n #print \"Len of the Array:\", len(myarray)\n\tarraylen _ l..(myarray)\n\txorval _ 0\n #print \"In the First loop\"\n\t___ i __ r..(1, ... | [
0
] |
import pymongo
from FlaskScripts.database.user_database import user
from FlaskScripts.database.blog_database import blog
myclient = {}
try:
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
myclient.server_info()
print('Database Connected')
except:
print('Database Error')
mydb = myclient["jm... | normal | {
"blob_id": "aafdd228cf2859d7f013b088263eab544e19c481",
"index": 9995,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n myclient.server_info()\n print('Database Connected')\nexcept:\n print('Database Error')\n<mask token>\n",... | [
0,
1,
2,
3,
4
] |
""""Pirata barba Negra ( màs de 2 pasos a las izquierda o a la derecha y se cae):
rampa para subir a su barco (5 pasos de ancho y 15 de largo")leer por teclado un valor entero.
a) si el entero es par 1 paso hacia adelante
b)si el entero es impar , pero el entero - 1 es divisible por 4, el pirata da un paso a la derec... | normal | {
"blob_id": "1829bd8e87c470a71fea97dd3a47c30477b6e6f1",
"index": 3109,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile numero_usuario < 0:\n print(\n 'Parece que el pirata se ha quedado dormido en la rampa intenta despertarlo ingresando otro nùmero '\n )\n numero_usuario = int(i... | [
0,
1,
2,
3,
4
] |
import pygame
from clobber.constants import GREY, ROWS, WHITE, SQUARE_SIZE, COLS, YELLOW, BLACK
from clobber.piece import Piece
class Board:
def __init__(self):
self.board = []
self.selected_piece = None
self.create_board()
def draw_squares(self, win):
win.fill(GREY)
... | normal | {
"blob_id": "b80b997f802c7ed4f0a838030703a314f2383c9d",
"index": 5226,
"step-1": "<mask token>\n\n\nclass Board:\n <mask token>\n\n def draw_squares(self, win):\n win.fill(GREY)\n for row in range(ROWS):\n for col in range(row % 2, COLS, 2):\n pygame.draw.rect(win, W... | [
8,
9,
11,
13,
14
] |
def get_partial_matched(n):
pi = [0] * len(n)
begin = 1
matched = 0
while begin + matched < len(n):
if n[begin + matched] == n[matched]:
matched += 1
pi[begin + matched - 1] = matched
else:
if matched == 0:
begin += 1
else:
... | normal | {
"blob_id": "16a77c45a58e31c575511146dfceeaef0a2bc3a7",
"index": 3640,
"step-1": "<mask token>\n\n\ndef get_common(h, n):\n pi = get_partial_matched(n)\n begin = 0\n matched = 0\n while begin + matched < len(h):\n if matched < len(n) and h[begin + matched] == n[matched]:\n matched +... | [
2,
3,
4,
5,
6
] |
import pymongo
import pandas as pd
from scrape_mars import scrape
import json
# Create connection variable
conn = 'mongodb://localhost:27017'
# Pass connection to the pymongo instance.
client = pymongo.MongoClient(conn)
# Connect to a database. Will create one if not already available.
db = client.mars_db
#News
... | normal | {
"blob_id": "e3ac8039ffb6787b0e3e80b234c2689c66a184bf",
"index": 1704,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndb.news.drop()\ndb.news.insert_many(scrape(info, url))\n<mask token>\ndb.images.drop()\ndb.images.insert_many(scrape(info, url))\n<mask token>\ndb.weather.drop()\ndb.weather.insert_many(s... | [
0,
1,
2,
3,
4
] |
import cv2 #imports cv2 package
import numpy as np #imports numpy package
import matplotlib.pyplot as plt #imports matplotlib.pyplot package
img_noblur = cv2.imread('road8.jpg') #reads the image
imgnew = img_noblur.copy() #creates a copy of the image
img_noblur_grey = cv2.cvtColor(img_noblu... | normal | {
"blob_id": "7b4f46f6c286a7d0ef45079b2fd238b81d5f89eb",
"index": 3493,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor x in range(0, len(lines)):\n for x1, y1, x2, y2 in lines[x]:\n cv2.line(imgnew, (x1, y1), (x2, y2), (0, 255, 0), 5)\n<mask token>\nplt.subplot(131), plt.imshow(img_noblur, c... | [
0,
1,
2,
3,
4
] |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from subprocess import call
app = Flask(__name__)
app.config['SECRET_KEY'] = "SuperSecretKey"
#app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql://fmnibhaashbxuy:73b8e2e2485adfd45f57da653d63950b88fdcae12202a84f80c7f4c297e9e30a@ec2-23-23-222-184.compute-... | normal | {
"blob_id": "7b45c9e31bfb868b1abde6af0d8579b52f86d9c3",
"index": 5689,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp = Flask(__name__)\napp.config['SECRET_KEY'] = 'SuperSecretKey'\napp.config['SQLALCHEMY_DATABASE_URI'\n ] = 'postgresql://info2180-project1:password123@localhost/profilebook'\napp.c... | [
0,
1,
2,
3
] |
import sys, os
import cv2
# set the video reader
video_path = 0 # camera number index
# video_path = "/home/pacific/Documents/Work/Projects/Workflows/server/PycharmProjects/Pacific_AvatarGame_Host/humanpose_2d/LiveCamera/test.mp4" # real video file
if type(video_path).__name__ == "str":
videoReader = cv2.VideoCap... | normal | {
"blob_id": "08408cf096bbe23f9a832cc0cf2e017abdbd359f",
"index": 4591,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif type(video_path).__name__ == 'str':\n videoReader = cv2.VideoCapture(video_path)\n print('Load live video from file...')\nelif type(video_path).__name__ == 'int':\n videoReade... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python3.7
import Adafruit_GPIO
import Adafruit_GPIO.I2C as I2C
import time
import sys
import argparse
import os
argparser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="Select I2C channel multiplexed by TCA9548A")
argparser.add_argument... | normal | {
"blob_id": "46aa795bb72db0fcd588b1747e3559b8828be17c",
"index": 6927,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nargparser.add_argument('ch', nargs='?', help='channel', type=int)\n<mask token>\nif args.ch is None:\n for channel in range(0, 8):\n print(f'== CHANNEL {channel} ==')\n T... | [
0,
1,
2,
3,
4
] |
import datetime as dt
import numpy as np
import pandas as pd
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify, render_template, abort
#creating engine to connect with hawaii sqlite database... | normal | {
"blob_id": "c295d769b85943a6ca89f9d213e79b78129a6ce9",
"index": 2031,
"step-1": "<mask token>\n\n\n@app.route('/api/v1.0/stations')\ndef stations():\n \"\"\"return a json list of stations from the dataset.\"\"\"\n stationquery = session.query(Station.station).all()\n stationlist = list(np.ravel(station... | [
3,
8,
9,
10,
12
] |
from datetime import datetime, timedelta
import os
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators import (StageToRedshiftOperator, LoadFactOperator,
LoadDimensionOperator, DataQualityOperator)
from helpers import SqlQueries
# AW... | normal | {
"blob_id": "7994d9605c8654053c9a85f8d37983da04f8003a",
"index": 2674,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nstart_operator >> stage_events_to_redshift >> load_songplays_table\nstart_operator >> stage_songs_to_redshift >> load_songplays_table\nload_songplays_table >> load_song_dimension_table >>... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
from svg_ros.srv import *
import rospy
from std_msgs.msg import String
from geometry_msgs.msg import Twist
from math import *
import roslib
from nav_msgs.msg import Odometry
#Global variables
base_distance_x0=0
base_distance_y0=0
base_angle_0=0
base_distance_x1=0
base_distance_y1=0
base_angle_1=... | normal | {
"blob_id": "402acaa263ee620fbd9bf7d271dce2e5de4eeae0",
"index": 2005,
"step-1": "#!/usr/bin/env python\nfrom svg_ros.srv import *\nimport rospy\nfrom std_msgs.msg import String\nfrom geometry_msgs.msg import Twist\nfrom math import *\nimport roslib\nfrom nav_msgs.msg import Odometry\n\n\n#Global variables\nbase... | [
0
] |
from fastapi import FastAPI
from pydantic import BaseModel
from typing import List, Optional
from joblib import load
app = FastAPI()
clf = load("model.joblib")
class PredictionRequest(BaseModel):
feature_vector: List[float]
score: Optional[bool] = False
@app.post("/prediction")
def predict(req: PredictionReq... | normal | {
"blob_id": "d6fa3039c0987bf556c5bd78b66eb43543fd00fe",
"index": 6343,
"step-1": "<mask token>\n\n\nclass PredictionRequest(BaseModel):\n feature_vector: List[float]\n score: Optional[bool] = False\n\n\n@app.post('/prediction')\ndef predict(req: PredictionRequest):\n prediction = clf.predict([req.featur... | [
3,
4,
5,
6,
7
] |
from golem import actions
from projects.golem_integration.pages import golem_steps
description = 'close_window_by_partial_title action'
def test(data):
actions.navigate(data.env.url + 'tabs/')
actions.send_keys('#title', 'lorem ipsum')
actions.click('#goButtonCustom')
actions.assert_amount_of_windows(... | normal | {
"blob_id": "8fe45332ce09195beabb24c8cbb56868c564ded4",
"index": 2132,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test(data):\n actions.navigate(data.env.url + 'tabs/')\n actions.send_keys('#title', 'lorem ipsum')\n actions.click('#goButtonCustom')\n actions.assert_amount_of_windo... | [
0,
1,
2,
3
] |
import numpy as np
import pandas as pd
import matplotlib as plt
import scipy.linalg
from distance_metrics import *
import time
import random
RANDOM_SEED = 42
np.random.seed(RANDOM_SEED)
random.seed(RANDOM_SEED)
################################################################
# PCA #
##############################... | normal | {
"blob_id": "c00db6d6fd903236de37ccc029ed30fd46dccdef",
"index": 7711,
"step-1": "<mask token>\n\n\ndef project(X, U, p=None):\n if p == None:\n p = X.shape[1]\n Z = np.matmul(X, U)\n Z[:, p:] = np.mean(Z[:, p:], axis=0)\n X2 = np.matmul(Z, U.transpose())\n return Z, X2\n\n\n<mask token>\n\... | [
2,
4,
5,
6,
7
] |
from collections import Counter, defaultdict
from random import randrange
from copy import deepcopy
import sys
def election(votes, message=True, force_forward=False):
votes = deepcopy(votes)
N = len(votes)
for i in range(N):
obtained = Counter([v[-1] for v in votes if len(v)]).most_common()
... | normal | {
"blob_id": "05764d1cfd9573616fcd6b125280fddf2e5ce7ad",
"index": 3712,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef election(votes, message=True, force_forward=False):\n votes = deepcopy(votes)\n N = len(votes)\n for i in range(N):\n obtained = Counter([v[-1] for v in votes if l... | [
0,
1,
2,
3,
4
] |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from . import views
app_name = 'produce'
urlpatterns = [
# Inbound SMS view:
url(r'^sms/$', views.sms, name='sms'),
# List and Detail Views:
url(r'^list/', views.SeasonalView.as_view(), name='list'),
url(r'^(?P<pk... | normal | {
"blob_id": "f7d0d7dda955acd07b6da010d21dc5f02254e1ed",
"index": 5821,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp_name = 'produce'\nurlpatterns = [url('^sms/$', views.sms, name='sms'), url('^list/', views.\n SeasonalView.as_view(), name='list'), url('^(?P<pk>[0-9]+)/$', views.\n ProduceDeta... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xde\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x28\x... | normal | {
"blob_id": "dbf831540d11a994d5483dc97c7eab474f91f0d3",
"index": 8118,
"step-1": "<mask token>\n\n\ndef qInitResources():\n QtCore.qRegisterResourceData(rcc_version, qt_resource_struct,\n qt_resource_name, qt_resource_data)\n\n\ndef qCleanupResources():\n QtCore.qUnregisterResourceData(rcc_version, ... | [
2,
3,
4,
5,
6
] |
import pandas
import evaluation
import sys
sys.path.append('D:\\libs\\xgboost\\wrapper')
import xgboost as xgb
# Read training data
folder = '../data/'
train = pandas.read_csv(folder + 'training.csv', index_col='id')
# Define features to drop from train data
# variables_to_drop = ['mass', 'production', 'min_ANNmuon'... | normal | {
"blob_id": "a6365104125725f11010c35eb0781c941de803f8",
"index": 7172,
"step-1": "import pandas\nimport evaluation\nimport sys\n\nsys.path.append('D:\\\\libs\\\\xgboost\\\\wrapper')\nimport xgboost as xgb\n\n# Read training data\nfolder = '../data/'\ntrain = pandas.read_csv(folder + 'training.csv', index_col='id... | [
0
] |
#!/usr/bin/env pypy
from __future__ import print_function
from __future__ import division
import subprocess
import random
import math
import sys
import string
randmin = int(sys.argv[1])
randmax = int(sys.argv[2])
random.seed(int(sys.argv[3]))
n = random.randint(randmin, randmax)
print('%d' % n)
| normal | {
"blob_id": "83e1c86095de88692d0116f7e32bd485ab381b29",
"index": 7040,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrandom.seed(int(sys.argv[3]))\n<mask token>\nprint('%d' % n)\n",
"step-3": "<mask token>\nrandmin = int(sys.argv[1])\nrandmax = int(sys.argv[2])\nrandom.seed(int(sys.argv[3]))\nn = rand... | [
0,
1,
2,
3,
4
] |
from typing import List
import uvicorn
from fastapi import Depends, FastAPI, HTTPException
from sqlalchemy.orm import Session
from . import crud, models, schemas
from .database import SessionLocal, engine
models.Base.metadata.create_all(bind=engine)
app = FastAPI()
def get_db():
db = SessionLocal()
try:
... | normal | {
"blob_id": "5961c593b46a8d3a0f7c62d862cce9a2814e42f4",
"index": 9019,
"step-1": "<mask token>\n\n\ndef get_db():\n db = SessionLocal()\n try:\n yield db\n finally:\n db.close()\n\n\n@app.post('/users/', response_model=schemas.UserCreate)\ndef create_user(user: schemas.UserCreate, db: Sess... | [
4,
5,
6,
7,
9
] |
import vk_loader.vk_api as vk
from config import config
import uuid
import requests
from models import session, Meme
import os
PHOTO_URL_FIELDS = [
'photo_75',
'photo_130',
'photo_604',
'photo_807',
'photo_1280',
'photo_2560'
]
conf = config('loader', default={
'access_token': 'Enter VK a... | normal | {
"blob_id": "cb742701094a8060e524ba22a0af2f969bdbf3d9",
"index": 2365,
"step-1": "<mask token>\n\n\ndef get_random_id():\n return uuid.uuid4().hex\n\n\n<mask token>\n\n\ndef get_last_loaded_ids(source_id):\n try:\n with open('vk_loader/loaded_ids/' + str(source_id), 'r') as file:\n return... | [
5,
7,
10,
11,
12
] |
def sqrt(number):
low = 1
high = number - 1
while low <= high:
mid = (low + high) /2
if mid * mid == number:
return mid
elif mid * mid > number:
high = mid - 1
else:
low = mid + 1
return low - 1
print sqrt(15)
| normal | {
"blob_id": "67b060349e986b06a0ee6d8a1afee82d49989c29",
"index": 6818,
"step-1": "\n\n\ndef sqrt(number):\n\n low = 1\n high = number - 1\n\n while low <= high:\n\n mid = (low + high) /2\n\n if mid * mid == number:\n return mid\n\n elif mid * mid > number:\n ... | [
0
] |
# fonction pour voir quel est le plus grand entre l'energie limite et l'enerve potentiel
def ep (m,h,el,g=9.8):
E=m*h*g
if E<el:
print ("le plus grand est : el")
else:
print ("le plus grand est : E")
ep(3,4,5)
#fontion fibonaci 0 1 1 2 3 5 8 13
def fibonaci(n):
for i in range(0,n,):
... | normal | {
"blob_id": "869284fa531a93c1b9812ed90a560d0bb2f87e97",
"index": 255,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fibonaci(n):\n for i in range(0, n):\n j = 1\n i = i + j\n j = i\n return fibonaci\n",
"step-3": "def ep(m, h, el, g=9.8):\n E = m * h * g\n if E... | [
0,
1,
2,
3,
4
] |
from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from product.models import Item,Product,Category
# Register your models here.
admin.site.register(Category,MPTTModelAdmin)
admin.site.register(Item)
admin.site.register(Product) | normal | {
"blob_id": "fcd3e4c0d42649833e6c5ff6414c993654691d16",
"index": 188,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(Category, MPTTModelAdmin)\nadmin.site.register(Item)\nadmin.site.register(Product)\n",
"step-3": "from django.contrib import admin\nfrom mptt.admin import MPTTModelAd... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
import sys
import collections as cl
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
MOD = 998244353
def main():
N, K = MI()
kukan = []
for _ in range(K):
... | normal | {
"blob_id": "60b70171dededd758e00d6446842355a47b54cc0",
"index": 9700,
"step-1": "<mask token>\n\n\ndef II():\n return int(sys.stdin.readline())\n\n\ndef MI():\n return map(int, sys.stdin.readline().split())\n\n\ndef LI():\n return list(map(int, sys.stdin.readline().split()))\n\n\n<mask token>\n",
"st... | [
3,
5,
6,
7,
8
] |
from django.shortcuts import get_object_or_404
from rest_framework import generics
from .models import Duck
from .serializers import Duck_Serializer
class DuckList(generics.ListCreateAPIView):
queryset = Duck.objects.all()
serializer_class = Duck_Serializer
def get_object(self):
queryset = self.get_queryset()
... | normal | {
"blob_id": "8334478c8b7fc7688477cdb837467e00e857c07c",
"index": 1196,
"step-1": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DuckList(generics.ListCreateAPIView):\n <mask token>\n <mask token>\... | [
1,
2,
3,
4,
5
] |
class RankedHand(object):
def __init__(self, remaining_cards):
self._remaining_cards = remaining_cards
self.rank = None
def remaining_cards(self):
return self._remaining_cards
# Returns 1 if self is higher, 0 if equal, -1 if self is lower
def compare_high_cards(self, other):
s_cards = reversed... | normal | {
"blob_id": "a0d1ef11d00e2ddd65b648a87f493b7adcda5115",
"index": 9412,
"step-1": "<mask token>\n\n\nclass TwoPair(RankedHand):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass ThreeKind(RankedHand):\n\n def __init__(self, three_kind_rank):\n self.rank... | [
25,
28,
42,
43,
45
] |
from applitools.selenium import Target, eyes
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
def test_verify_home_page(eyes, driver):
eyes.open(driver, "FlyDubai IBE", "Verify Home Page")
eye... | normal | {
"blob_id": "021efe01c21db4d3bd936ba4eb75dc03dde91cc6",
"index": 1475,
"step-1": "<mask token>\n\n\ndef test_verify_home_page(eyes, driver):\n eyes.open(driver, 'FlyDubai IBE', 'Verify Home Page')\n eyes.check('FZ IBE Home page', Target.window())\n eyes.close(False)\n\n\n<mask token>\n\n\ndef test_verif... | [
4,
5,
6,
7,
8
] |
import cv2
import os
import numpy as np
import sys
from os.path import expanduser
np.random.seed(0)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Generate artificial videos with one subject in Casia-B')
parser.add_argument('--dataset', type=str, required=False... | normal | {
"blob_id": "6b32f829648b92da4b638ffd79692ffb86be80fe",
"index": 8761,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnp.random.seed(0)\nif __name__ == '__main__':\n import argparse\n parser = argparse.ArgumentParser(description=\n 'Generate artificial videos with one subject in Casia-B')\n ... | [
0,
1,
2,
3
] |
"""
Write a program that prompts for the user’s favorite number.
Use json.dump() to store this number in a file. Write a separate program that reads in this value and
prints the message, “I know your favorite number! It’s _____.”
"""
import json
file_name = 'supporting_files/favourite_number.json'
favourite_number = ... | normal | {
"blob_id": "7a359d4b31bd1fd35cd1a9a1de4cbf4635e23def",
"index": 7932,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(file_name, 'a') as file_object:\n json.dump(favourite_number, file_object)\nprint(f'{favourite_number} is saved in {file_name}')\n",
"step-3": "<mask token>\nfile_name = 's... | [
0,
1,
2,
3,
4
] |
n, k = map(int, input().split())
k_list = []
for i in range(k):
l, r = map(int, input().split())
k_list.append([l, r])
dp = [0] * (n + 1)
dp[1] = 1
dpsum = [0] * (n + 1)
dpsum[1] = 1
for i in range(1, n):
dpsum[i] = dp[i] + dpsum[i - 1]
for j in range(k):
l, r = k_list[j]
li = i + l
... | normal | {
"blob_id": "97720baab961d50ceae832d52350b9871c552c84",
"index": 9071,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(k):\n l, r = map(int, input().split())\n k_list.append([l, r])\n<mask token>\nfor i in range(1, n):\n dpsum[i] = dp[i] + dpsum[i - 1]\n for j in range(k):\n ... | [
0,
1,
2
] |
# -*- coding: utf-8 -*-
import argparse
import redis
from Tkinter import *
import ttk
import json
import time
import thread
R = None
NAME = {}
PROBLEM_NAME = {}
CONTEST_ID = None
QUEUE_NAME = None
BACKUP_QUEUE_NAME = None
RUNID_FIELD = "runid"
SUBMIT_TIME_FIELD = "submit_time"
STATUS_FIELD = "status"
STATUS_FINISHED... | normal | {
"blob_id": "76e1f811d06af0e6e83ae989a236a5cd22c55e01",
"index": 2985,
"step-1": "<mask token>\n\n\nclass PrinterTkinter:\n\n def __init__(self):\n self.root = Tk()\n self.root.title('气球发放')\n self.runid_to_node = dict()\n self.runid_to_uid = dict()\n self.runid_to_pid = dic... | [
5,
8,
10,
12,
13
] |
# -*- coding: utf-8 -*-
scheme = 'http'
hostname = 'localhost'
port = 9000
routes = [
'/available/2',
'/available/4'
]
| normal | {
"blob_id": "d1402469232b5e3c3b09339849f6899e009fd74b",
"index": 3323,
"step-1": "<mask token>\n",
"step-2": "scheme = 'http'\nhostname = 'localhost'\nport = 9000\nroutes = ['/available/2', '/available/4']\n",
"step-3": "# -*- coding: utf-8 -*-\n\n\nscheme = 'http'\n\nhostname = 'localhost'\n\nport = 9000\n\... | [
0,
1,
2
] |
#coding=utf-8
from django import template
from classytags.helpers import InclusionTag
from classytags.core import Tag, Options
from classytags.arguments import Argument
from ratings.models import RatedItem
from blogs.permissions import Permissions
class RatingBlock(InclusionTag):
name = 'rating'
template = '... | normal | {
"blob_id": "1a05817c4c16f2d9234e504b0c98f9c9ae2dc3f7",
"index": 1525,
"step-1": "<mask token>\n\n\nclass RatingBlock(InclusionTag):\n name = 'rating'\n template = 'ratings/rating.html'\n options = Options(Argument('obj', required=True))\n\n def get_context(self, context, obj):\n if not hasatt... | [
3,
4,
5,
6,
7
] |
from tilBackend.celery import app
import smtplib
import email
import ssl
#librerias pruebas
from celery.task.schedules import crontab
from celery.decorators import periodic_task
from celery.utils.log import get_task_logger
from celery import Celery
@app.task
def correo():
try:
port = 587
smtp_serve... | normal | {
"blob_id": "d0a6bfb729a150863303621a136ae80e96ae32d0",
"index": 3250,
"step-1": "<mask token>\n\n\ndef task_correo():\n \"\"\"\n envia correo\n \"\"\"\n correo()\n logger.info('se envio el correo')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\n@app.task\ndef correo():\n try:\n po... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
import shutil
class LibpopplerConan(ConanFile):
name = "poppler"
version = "0.73.0"
description = "Poppler is a PDF rendering library based on the xpdf-3.... | normal | {
"blob_id": "848394e1e23d568f64df8a98527a8e177b937767",
"index": 3380,
"step-1": "<mask token>\n\n\nclass LibpopplerConan(ConanFile):\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>... | [
6,
7,
8,
9,
11
] |
#!/usr/bin/python
import sys
import cgi
import urllib2
url = sys.argv[1]
try:
response = urllib2.urlopen(url)
redir = response.geturl()
except Exception:
import traceback
redir = 'generic exception: ' + traceback.format_exc()
print redir
| normal | {
"blob_id": "3ff3b8a1d8e74c09da9d6f39e4abf0963002a812",
"index": 5682,
"step-1": "#!/usr/bin/python\nimport sys\nimport cgi\nimport urllib2\n\n\nurl = sys.argv[1]\n\ntry:\n\tresponse = urllib2.urlopen(url)\n\tredir = response.geturl()\nexcept Exception:\n\timport traceback\n\tredir = 'generic exception: ' + trac... | [
0
] |
import itertools
import math
def score(stack):
syrup = math.pi * max(x[0] for x in stack)**2
for item in stack:
syrup += 2*math.pi*item[0]*item[1]
return syrup
def ring_score(item):
return 2*math.pi*item[0]*item[1]
def solve(pancakes, k):
return max(itertools.combin... | normal | {
"blob_id": "31304c3b0f41b848a36115f1ef098a2104c170ac",
"index": 5779,
"step-1": "<mask token>\n\n\ndef ring_score(item):\n return 2 * math.pi * item[0] * item[1]\n\n\ndef solve(pancakes, k):\n return max(itertools.combinations(pancakes, k), key=score)\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nd... | [
2,
3,
4,
5,
6
] |
from collections import Counter
from enum import auto, Enum
class Category(Enum):
ONES = 1
TWOS = 2
THREES = 3
FOURS = 4
FIVES = 5
SIXES = 6
YACHT = auto()
FULL_HOUSE = auto()
FOUR_OF_A_KIND = auto()
LITTLE_STRAIGHT = auto()
BIG_STRAIGHT = auto()
CHOICE = auto()
def s... | normal | {
"blob_id": "40bc8122d98d407341a56251f9abfab019e0acd8",
"index": 625,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Category(Enum):\n ONES = 1\n TWOS = 2\n THREES = 3\n FOURS = 4\n FIVES = 5\n SIXES = 6\n YACHT = auto()\n FULL_HOUSE = auto()\n FOUR_OF_A_KIND = auto()... | [
0,
2,
3,
4
] |
#!/usr/bin/env python
# coding: utf-8
import time
class Timer(object):
def __init__(self):
self.time_ = 0.
self.start_ = 0.
def reset(self):
self.time_ = 0.
self.start_ = 0.
def start(self):
self.start_ = time.clock()
def end(self):
self.time_ += time... | normal | {
"blob_id": "0cf5b009f384d2ca7162b5a88699afb3702ae1f6",
"index": 1147,
"step-1": "<mask token>\n\n\nclass Timer(object):\n <mask token>\n\n def reset(self):\n self.time_ = 0.0\n self.start_ = 0.0\n\n def start(self):\n self.start_ = time.clock()\n\n def end(self):\n self.t... | [
4,
5,
6,
7,
8
] |
### To run the test use:
### python3 -m unittest test_script.py
import unittest
import re
class TestCustomerDetails(unittest.TestCase):
def test_cu_name(self):
### Our script has a class ConfigurationParser, which will have method ParseCuNames
cp = ConfigurationParser()
### expected nam... | normal | {
"blob_id": "582cbacd26f4a3ed0b4f5c85af67758de7c05836",
"index": 7396,
"step-1": "<mask token>\n\n\nclass ConfigurationParser:\n <mask token>\n <mask token>\n\n def ParseVlan(self, cuName):\n intPattern = (\n 'interface GigabitEthernet0\\\\/0.([0-9]+)\\\\n\\\\s+encapsulation\\\\s+dot1Q... | [
2,
6,
7,
8,
9
] |
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'ALR1.html')
def search(request):
return render(request, 'ALR2.html')
def home(request):
return render(request, 'ALR3.html')
def pdf(request):
pdfId = request.GET['id']
# pdf_data=open... | normal | {
"blob_id": "d9f586bbb72021ee0b37ff8660e26b50d7e6a2d3",
"index": 569,
"step-1": "<mask token>\n\n\ndef index(request):\n return render(request, 'ALR1.html')\n\n\ndef search(request):\n return render(request, 'ALR2.html')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n return r... | [
2,
3,
4,
5,
6
] |
from tkinter import *
global math
root = Tk()
root.title("Calculator")
e = Entry(root,width=60,borderwidth=5)
e.grid(columnspan=3)
def button_click(number):
#e.delete(0, END)
current = e.get()
e.delete(0, END)
e.insert(0, str(current) + str(number))
def button_clear():
e.delete(0, END)
... | normal | {
"blob_id": "e6320bc1c344c87818a4063616db0c63b7b8be49",
"index": 1294,
"step-1": "<mask token>\n\n\ndef button_click(number):\n current = e.get()\n e.delete(0, END)\n e.insert(0, str(current) + str(number))\n\n\ndef button_clear():\n e.delete(0, END)\n\n\ndef button_add():\n first_number = e.get()... | [
7,
8,
9,
10,
11
] |
import threading
import time
g_num = 0
def work1(num):
global g_num
for i in range(num):
g_num += 1
print("__in work1: g_num is {}".format(g_num))
def work2(num):
global g_num
for i in range(num):
g_num += 1
print("__in work2: g_num is {}".format(g_num))
def main():
... | normal | {
"blob_id": "60079005c2091d2dc0b76fb71739671873f0e0f1",
"index": 9534,
"step-1": "<mask token>\n\n\ndef work1(num):\n global g_num\n for i in range(num):\n g_num += 1\n print('__in work1: g_num is {}'.format(g_num))\n\n\ndef work2(num):\n global g_num\n for i in range(num):\n g_num +... | [
3,
4,
5,
6,
7
] |
import os
import torch
from data_loader import FER
from torch.utils.data import DataLoader
from tqdm import tqdm
# from tensorboardX import SummaryWriter
import model as md
# train_writer = SummaryWriter(log_dir="log_last_last_last/train")
# valid_writer = SummaryWriter(log_dir="log_last_last_last/valid")... | normal | {
"blob_id": "c3aee5d822d48c9dc826f8f2f8d4a56e11513b9c",
"index": 2882,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmodel.to(device)\n<mask token>\n...\nfor epoch in range(epochs):\n running_loss = 0\n running_acc = 0\n train_loss = 0\n model.train()\n for image, label in tqdm(train_data... | [
0,
1,
2,
3,
4
] |
from django.db import models
from django.contrib.auth.models import User as sUser
TYPES = (
('public', 'public'),
('private', 'private'),
)
#class GroupManager(models.Manager):
# def get_all_users(self):
# return self.extra(where=['users'])
class Group(models.Model):
name = models.CharField(max... | normal | {
"blob_id": "8baf61a20a64f296304b6a7017a24f1216e3d771",
"index": 2908,
"step-1": "<mask token>\n\n\nclass Group(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Group(models.Model)... | [
1,
3,
4,
5,
6
] |
/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
] |
import random
#liste de choix possibles
liste = ["rock", "paper", "scissors"]
#si le joueur veut jouer il répond y
answer = "y"
while answer == "y":
#choix du joueur
user_choice = input("rock,paper,scissors ?")
#verifie si le joueur a mis la réponse correcte
if user_choice in liste :
#choix d... | normal | {
"blob_id": "61232ec951cf378798220c00280ef2d351088d06",
"index": 8633,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile answer == 'y':\n user_choice = input('rock,paper,scissors ?')\n if user_choice in liste:\n prog = random.choice(liste)\n print(\"computer's choice :\", prog)\n ... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
import json
import requests
from requests.auth import HTTPBasicAuth
if __name__ == "__main__":
auth = HTTPBasicAuth('cisco', 'cisco')
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
url = "https://asav/api/interfaces/physical/Gigab... | normal | {
"blob_id": "6801d68ebcc6ff52d9be92efeeb8727997a14bbd",
"index": 523,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n auth = HTTPBasicAuth('cisco', 'cisco')\n headers = {'Accept': 'application/json', 'Content-Type': 'application/json'\n }\n url = 'https://asav/... | [
0,
1,
2,
3
] |
from flask_restful import Resource
from flask import jsonify, make_response, request
from ..models.Users import UsersModel
from ..models.Incidents import IncidentsModel
from app.api.validations.validations import Validations
class UsersView(Resource):
def __init__(self):
self.db = UsersModel()
def... | normal | {
"blob_id": "0188355f84054143bd4ff9da63f1128e9eb5b23b",
"index": 2244,
"step-1": "<mask token>\n\n\nclass LoginView(Resource):\n\n def __init__(self):\n self.db = UsersModel()\n self.user_db = IncidentsModel()\n\n def post(self):\n data = request.get_json()\n username = data['us... | [
8,
10,
11,
12,
14
] |
"""
pokespeare.http.py
~~~~~~~~~~~~~~~~~~
Contains definitions of custom HTTP clients, allowing for more flexibility on
the library choice
"""
import abc
import requests
from typing import Dict, Tuple, Any
from .exceptions import HTTPError, UnexpectedError
import requests_cache
class HTTPClient(abc.ABC):
"""Bas... | normal | {
"blob_id": "1a126ba7e73eb2e7811ab32146fe5aee6c6b30f9",
"index": 4290,
"step-1": "<mask token>\n\n\nclass HTTPClient(abc.ABC):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @abc.abstractmethod\n def post(self, url: str, **kwargs: Dict[str, Any]) ->Any:\n ... | [
8,
10,
11,
14,
15
] |
import argparse # for handling command line arguments
import collections # for container types like OrderedDict
import configparser
import hashlib # for SHA-1
import os
import re
import sys
import zlib # git compresses everything using zlib
argparser = argparse.ArgumentParser(description="The stupid content tracker")
... | normal | {
"blob_id": "1c8145007edb09d77a3b15de5c34d0bc86c0ba97",
"index": 8343,
"step-1": "import argparse # for handling command line arguments\nimport collections # for container types like OrderedDict\nimport configparser\nimport hashlib # for SHA-1\nimport os\nimport re\nimport sys\nimport zlib # git compresses every... | [
0
] |
# -*- coding: utf-8 -*-
import hashlib
import time
from datetime import datetime, timedelta
# 像访问对象一样, 访问字典
class ObjectLikeDict(dict):
def __getattr__(self, name):
try:
return self[name]
except:
return ''
# 合并字典
def merge_dict(dict1, dict2):
return (lambda a, b: (lam... | normal | {
"blob_id": "f1c32fe7a29cddf4f881b46f4feab06390a76a44",
"index": 7516,
"step-1": "# -*- coding: utf-8 -*-\nimport hashlib\nimport time\nfrom datetime import datetime, timedelta\n\n# 像访问对象一样, 访问字典\nclass ObjectLikeDict(dict):\n def __getattr__(self, name):\n try:\n return self[name]\n ... | [
0
] |
from selenium import webdriver
import time
def test_check_error_page_1():
try:
link = "http://suninjuly.github.io/registration1.html"
browser = webdriver.Chrome()
browser.get(link)
# Проверяем Fisrt name*
field_text = browser.find_element_by_xpath(
'//body/div/f... | normal | {
"blob_id": "83ebebbb6191295adcb58b003bf1c3bcc6fb189f",
"index": 7405,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_check_error_page_1():\n try:\n link = 'http://suninjuly.github.io/registration1.html'\n browser = webdriver.Chrome()\n browser.get(link)\n fiel... | [
0,
1,
2,
3,
4
] |
from flask import Flask, request, redirect, url_for, render_template
from flask_modus import Modus
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config[
'SQLALCHEMY_DATABASE_URI'] = "postgres://localhost/flask_one_to_many"
app.config['SQLALCHEMY_TRACK_MODIFICAT... | normal | {
"blob_id": "026e06e777d64f8724ec5e89a7829b3a42a25d6b",
"index": 800,
"step-1": "<mask token>\n\n\nclass Student(db.Model):\n __tablename__ = 'students'\n id = db.Column(db.Integer, primary_key=True)\n first_name = db.Column(db.Text)\n last_name = db.Column(db.Text)\n excuses = db.relationship('Ex... | [
13,
14,
15,
16,
17
] |
'''
ESTMD
Tool to isolate targets from video. You can generate appropriate videos
using module Target_animation.
__author__: Dragonfly Project 2016 - Imperial College London
({anc15, cps15, dk2015, gk513, lm1015,zl4215}@imperial.ac.uk)
CITE
'''
import os
from copy import deepcopy
import cv2
import nump... | normal | {
"blob_id": "b0a354d82880c5169293d1229206470c1f69f24f",
"index": 8902,
"step-1": "'''\nESTMD\n\nTool to isolate targets from video. You can generate appropriate videos\nusing module Target_animation.\n\n__author__: Dragonfly Project 2016 - Imperial College London\n ({anc15, cps15, dk2015, gk513, lm101... | [
0
] |
from django import forms
from .models import Diagnosis, TODOItem
class DiagnosisForm(forms.ModelForm):
class Meta:
model = Diagnosis
fields = ['name', 'Rostered_physician', 'condition', 'details',
'date_of_diagnosis', 'content']
class TODOItemForm(forms.ModelForm):
class Meta... | normal | {
"blob_id": "aa6464c53176be9d89c6c06997001da2b3ee1e5c",
"index": 6583,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass TODOItemForm(forms.ModelForm):\n\n\n class Meta:\n model = TODOItem\n fields = ['job', 'due_date', 'medication_details', 'completed']\n",
"step-3": "<mask tok... | [
0,
1,
2,
3
] |
#def pizzaTopping():
message1 = "What Pizza do you want?"
message = "What type of Pizza topping do you want?"
message += "\n Enter 'quit' to stop entering toppings"
pizzas = {}
while True:
pizza = input(message1)
topping = input(message)
if topping == "quit":
break
else:
pizzas[pi... | normal | {
"blob_id": "bb3cba9847f2318a5043975e4b659265a7442177",
"index": 6309,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmessage += \"\"\"\n Enter 'quit' to stop entering toppings\"\"\"\n<mask token>\nwhile True:\n pizza = input(message1)\n topping = input(message)\n if topping == 'quit':\n ... | [
0,
1,
2,
3
] |
from output.models.nist_data.list_pkg.nmtokens.schema_instance.nistschema_sv_iv_list_nmtokens_min_length_5_xsd.nistschema_sv_iv_list_nmtokens_min_length_5 import NistschemaSvIvListNmtokensMinLength5
obj = NistschemaSvIvListNmtokensMinLength5(
value=[
"f",
"D",
"T",
"a",
"b"... | normal | {
"blob_id": "3941f283893c259033d7fb3be83c8071433064ba",
"index": 7170,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nobj = NistschemaSvIvListNmtokensMinLength5(value=['f', 'D', 'T', 'a', 'b',\n 'C', 'o', 't', 't', 'w'])\n",
"step-3": "from output.models.nist_data.list_pkg.nmtokens.schema_instance.n... | [
0,
1,
2,
3
] |
def pin():
print('wqeqwwqe')
from tkinter import *
from tkinter import messagebox
from PIL import Image
from PIL import ImageTk
window = Tk() #创建一个窗口
window.title('爱你吆') #定义窗口标题
window.geometry('400x400+800+200') #定义窗口大小 窗口显示位置
# window.protocol('WM_DELETE_WINDOW', pin) #摧毁窗口,引到另一个函数命令
window.protocol(... | normal | {
"blob_id": "55c9fe8caf1983f22d5a752574f590fa129e8017",
"index": 1443,
"step-1": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\n",
"step-2": "def pin():\n print('wqeqwwqe')\n\n\n<mask token>\nwindow.title('爱你吆')\nwindow.geometry('400x400+800+200')\nwindow.protocol('WM_DELETE_WINDOW')\n<mask token>\nl... | [
1,
2,
3,
4,
5
] |
# vim: expandtab
# -*- coding: utf-8 -*-
from poleno.utils.template import Library
from chcemvediet.apps.obligees.models import Obligee
register = Library()
@register.simple_tag
def gender(gender, masculine, feminine, neuter, plurale):
if gender == Obligee.GENDERS.MASCULINE:
return masculine
elif gen... | normal | {
"blob_id": "c9d12f14fa0e46e4590746d45862fe255b415a1d",
"index": 396,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@register.simple_tag\ndef gender(gender, masculine, feminine, neuter, plurale):\n if gender == Obligee.GENDERS.MASCULINE:\n return masculine\n elif gender == Obligee.GENDE... | [
0,
1,
2,
3,
4
] |
"""
Tests for `sqlalchemy-cql` module.
"""
import pytest
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
metadata = MetaData()
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String),
Column('fullname... | normal | {
"blob_id": "f5b18673dd5a3ba3070c07e88ae83a531669311a",
"index": 2139,
"step-1": "<mask token>\n\n\ndef test_create_all():\n eng = create_engine('cql://user:password@localhost:49154/system')\n metadata.create_all(eng)\n",
"step-2": "<mask token>\n\n\ndef test_create_engine():\n eng = create_engine('cq... | [
1,
3,
4,
5,
6
] |
inp = int(input())
print(bytes(inp))
| normal | {
"blob_id": "63a2c8b0c2eba2d5f9f82352196ef2b67d4d63b5",
"index": 3838,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(bytes(inp))\n",
"step-3": "inp = int(input())\nprint(bytes(inp))\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
import cv2
import sys
import online as API
def demo(myAPI):
myAPI.setAttr()
video_capture = cv2.VideoCapture(0)
print("Press q to quit: ")
while True:
# Capture frame-by-frame
ret, frame = video_capture.read() #np.array
frame = cv2.resize(frame, (320, 240))
key = cv2.w... | normal | {
"blob_id": "778ef68b5270657f75185b27dc8219b35847afa1",
"index": 5829,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef demo(myAPI):\n myAPI.setAttr()\n video_capture = cv2.VideoCapture(0)\n print('Press q to quit: ')\n while True:\n ret, frame = video_capture.read()\n fra... | [
0,
1,
2,
3,
4
] |
#coding=utf8
uu=u'中国'
s = uu.encode('utf-8')
if s == '中国' :
print 11111
print u"一次性还本息".encode('utf-8')
| normal | {
"blob_id": "9bf4725c054578aa8da2a563f67fd5c72c2fe831",
"index": 8918,
"step-1": "#coding=utf8\n\nuu=u'中国'\ns = uu.encode('utf-8')\nif s == '中国' :\n print 11111\nprint u\"一次性还本息\".encode('utf-8')\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
from elasticsearch import Elasticsearch, helpers
from bso.server.main.config import ES_LOGIN_BSO_BACK, ES_PASSWORD_BSO_BACK, ES_URL
from bso.server.main.decorator import exception_handler
from bso.server.main.logger import get_logger
client = None
logger = get_logger(__name__)
@exception_handler
def get_client():
... | normal | {
"blob_id": "9f760c0cf2afc746a1fc19ac68d1b2f406c7efe1",
"index": 5767,
"step-1": "<mask token>\n\n\n@exception_handler\ndef get_doi_not_in_index(index, dois):\n es = get_client()\n results = es.search(index=index, body={'query': {'bool': {'filter': [{\n 'terms': {'doi.keyword': dois}}]}}, 'fields': ... | [
7,
8,
9,
11,
13
] |
from matplotlib import pyplot as plt
from read_and_calculate_speed import get_info_from_mongodb
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['font.family'] = 'sans-serif'
def mat_line(speed_time_info, interface, direction, last_time):
# 调节图形大小,宽,高
fig = plt.figure(figsize=(6, 6))
# 一共一行,每行一图... | normal | {
"blob_id": "0aa419b0045914b066fbec457c918d83276f2583",
"index": 3556,
"step-1": "<mask token>\n\n\ndef mat_line(speed_time_info, interface, direction, last_time):\n fig = plt.figure(figsize=(6, 6))\n ax = fig.add_subplot(111)\n import matplotlib.dates as mdate\n ax.xaxis.set_major_formatter(mdate.Da... | [
1,
2,
3,
4,
5
] |
class Solution:
def projectionArea(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
res = 0
for i in grid:
res += max(i)
for j in i:
if j:
res += 1
for k in zip(*grid):
res +=... | normal | {
"blob_id": "62fc71e26ba3788513e5e52efc5f20453080837d",
"index": 8514,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def projectionArea(self, grid):\n \"\"\"\n :type grid: List[List[int]]\n :rtype: int\n \"\"\"\n ... | [
0,
1,
2
] |
from ROOT import *
import os
import sys
from optparse import Option, OptionValueError, OptionParser
Box = ["RawKLMnodeID","rawKLMlaneFlag","rawKLMtExtraRPC","rawKLMqExtraRPC","rawKLMtExtraScint","rawKLMqExtraScint","rawKLMsizeMultihit","rawKLM00channelMultiplicity","rawKLM00channelMultiplicityFine","rawKLM10channelMul... | normal | {
"blob_id": "19cf34e7c38045a183c75703ec56c17f96ee2ac4",
"index": 9629,
"step-1": "from ROOT import *\nimport os\nimport sys\nfrom optparse import Option, OptionValueError, OptionParser\n\nBox = [\"RawKLMnodeID\",\"rawKLMlaneFlag\",\"rawKLMtExtraRPC\",\"rawKLMqExtraRPC\",\"rawKLMtExtraScint\",\"rawKLMqExtraScint\... | [
0
] |
# Name: Calvin Liew
# Date: 2021-01-29
# Purpose: Video game final project, Tic-Tac-Toe 15 by Calvin Liew.
import random
# Function that reminds the users of the game rules and other instructions.
def intro():
print("""\n####### ####### ####### # ... | normal | {
"blob_id": "11259c92b005a66e5f3c9592875f478df199c813",
"index": 6993,
"step-1": "<mask token>\n\n\ndef intro():\n print(\n \"\"\"\n####### ####### ####### # ####### \n # # #### # ## #### # #### ###### ##... | [
6,
7,
8,
9,
10
] |
# -*- coding: utf-8 -*-
import urllib2, json, traceback
from django.conf import settings
from django.db import models
from TkManager.order.models import User
from TkManager.juxinli.models import *
from TkManager.juxinli.error_no import *
from TkManager.common.tk_log import TkLog
from datetime import datetime
from djan... | normal | {
"blob_id": "fa825846c54ed32c2ede94128ac08f9d5e172c0f",
"index": 5581,
"step-1": "# -*- coding: utf-8 -*-\nimport urllib2, json, traceback\n\nfrom django.conf import settings\nfrom django.db import models\nfrom TkManager.order.models import User\nfrom TkManager.juxinli.models import *\nfrom TkManager.juxinli.err... | [
0
] |
class User:
def __init__(self, username, password):
self.username = username
self.password = password
def __str__(self):
return 'Credentials: ' + self.username + ' - ' + self.password
def login(self):
print('Login done by "%s".' % self.username)
felipe = User(username='f... | normal | {
"blob_id": "fb26337be29ce06674ca2cb2a82eaff7624aa17f",
"index": 9259,
"step-1": "class User:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass Admin(User):\n\n def __init__(self, username, password, phone, email):\n super().__init__(username, password)\n self.ph... | [
5,
8,
9,
10
] |
import requests
import json
base_url = f"https://api.telegram.org/bot"
def get_url(url):
response = requests.get(url)
content = response.content.decode("utf8")
return content
def get_json_from_url(url):
content = get_url(url)
js = json.loads(content)
return js
def get_updates(TOKEN):
... | normal | {
"blob_id": "501614f9c7df3c862c9951ea343964b6ed47e74a",
"index": 3204,
"step-1": "<mask token>\n\n\ndef get_url(url):\n response = requests.get(url)\n content = response.content.decode('utf8')\n return content\n\n\ndef get_json_from_url(url):\n content = get_url(url)\n js = json.loads(content)\n ... | [
4,
6,
7,
8,
9
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.