code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from django.contrib import admin
from .models import JobListing
from .models import Employer
admin.site.register(JobListing)
admin.site.register(Employer)
| normal | {
"blob_id": "a96575d507a91472176c99d4d55e2a3bbf8111d1",
"index": 2707,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nadmin.site.register(JobListing)\nadmin.site.register(Employer)\n",
"step-3": "from django.contrib import admin\nfrom .models import JobListing\nfrom .models import Employer\nadmin.site.... | [
0,
1,
2
] |
# Generated by Django 3.2.4 on 2021-09-13 17:41
import dataUpload.models
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Task',
fields=[
... | normal | {
"blob_id": "9cab749b915dbb808ac105caa5287b50729f5fd9",
"index": 111,
"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
] |
from splinter import Browser
from time import sleep
from datetime import datetime, timedelta
import os, sys
import urllib
import cv2
import numpy as np
from PIL import Image
import imutils
import csv
class Scraper():
start_date = datetime(2018, 1, 8)
url = 'http://spaceweather.com/'
def scrape(self):
... | normal | {
"blob_id": "c55991e738c89ee09dabd79d514e710e0fcbac85",
"index": 422,
"step-1": "<mask token>\n\n\nclass Scraper:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Entry:\n folder = None\n date = None\n sunspots = -1\n image_path = None\n counted_... | [
10,
11,
12,
17,
18
] |
# Exercício Python 20: O mesmo professor do desafio 19 quer sortear a ordem de apresentação de trabalhos dos alunos. Faça um programa que leia o nome dos quatro alunos e mostre a ordem sorteada.
import random
aluno1 = input('Primeiro aluno: ')
aluno2 = input('Segundo aluno: ')
aluno3 = input('Terceiro aluno: ')
... | normal | {
"blob_id": "445bb8ad8dadd207a3546f4623de583fc47a2910",
"index": 2180,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nrandom.shuffle(listaAlunos)\nprint('A ordem de apresentação será ', listaAlunos)\n",
"step-3": "<mask token>\naluno1 = input('Primeiro aluno: ')\naluno2 = input('Segundo aluno: ')\nalun... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(bytes(inp))
<|reserved_special_token_1|>
inp = int(input())
print(bytes(inp))
| flexible | {
"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 time,pickle
from CNN_GPU.CNN_C_Wrapper import *
from pathlib import Path
FSIGMOIG = 0
FTANH = 2
FRELU = 4
REQUEST_INPUT = 0
REQUEST_GRAD_INPUT = 1
REQUEST_OUTPUT = 2
REQUEST_WEIGTH = 3
class CNN:
def __init__(self, inputSize, hitLearn=.1, momentum=.9, weigthDecay=.5, multip=1.0):
file = '%s/%s' %... | normal | {
"blob_id": "32db21ed7f57f29260d70513d8c34de53adf12d7",
"index": 5740,
"step-1": "<mask token>\n\n\nclass CNN:\n\n def __init__(self, inputSize, hitLearn=0.1, momentum=0.9, weigthDecay=\n 0.5, multip=1.0):\n file = '%s/%s' % (DIR_LIBRARY, 'gpu_function.cl')\n file = file.encode('utf-8')\n... | [
7,
12,
20,
21,
27
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if no == rev:
print(f'{no}--->{rev} Input is a palindrome')
else:
print(f'{no}--->{rev} Input is not a palindrome')
<|reserved_special_token_1|>
no = int(input('Enter a number: '))
no = str(no)
rev = no[::-1]
if no == r... | flexible | {
"blob_id": "020a41e7d3cc3f5adf3a38a6852dac6037595372",
"index": 2043,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif no == rev:\n print(f'{no}--->{rev} Input is a palindrome')\nelse:\n print(f'{no}--->{rev} Input is not a palindrome')\n",
"step-3": "no = int(input('Enter a number: '))\nno = s... | [
0,
1,
2,
3
] |
import re
import random
import requests
from bs4 import BeautifulSoup
import js2py
from fake_useragent import UserAgent
def _get_request_key(session):
res = session.post("https://spys.one/en/socks-proxy-list/")
soup = BeautifulSoup(res.text, 'html.parser')
return soup.find("input", {"name": "xx0"}).get("v... | normal | {
"blob_id": "647dde6e3288ded29336062b78baacc3a92908a7",
"index": 478,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass ProxyScrapper:\n\n def __init__(self):\n self._proxies = []\n\n def refresh(self):\n session = requests.Session()\n session.headers['User-Agent'] = Use... | [
0,
4,
5,
7,
8
] |
<|reserved_special_token_0|>
def get_evaluate_batches(data_dir='/home/yunhan/batchified'):
"""
return a list or generator of (large) ndarrays,
in order to efficiently utilize GPU
"""
n = 18
idx = np.random.permutation(n)
idx = idx + 54
for i in range(n):
X = np.load('%s... | flexible | {
"blob_id": "c04c38d78144b6f5d3e5af4ebe9ce430e882a367",
"index": 8014,
"step-1": "<mask token>\n\n\ndef get_evaluate_batches(data_dir='/home/yunhan/batchified'):\n \"\"\"\n return a list or generator of (large) ndarrays,\n in order to efficiently utilize GPU\n \"\"\"\n n = 18\n idx = np... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Positive:', ', '.join(list(filter(lambda x: int(x) > -1, line_numbers)))
)
print('Negative:', ', '.join(list(filter(lambda x: int(x) < 0, line_numbers))))
print('Even:', ', '.join(list(filter(lambda x: int(x) % 2 == 0, ... | flexible | {
"blob_id": "e4845e5aa949ec523515efc4d7996d647fddabdb",
"index": 7060,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Positive:', ', '.join(list(filter(lambda x: int(x) > -1, line_numbers)))\n )\nprint('Negative:', ', '.join(list(filter(lambda x: int(x) < 0, line_numbers))))\nprint('Even:', ', ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('read imafe from file')
<|reserved_special_token_0|>
print('create a window holder for the image')
cv2.namedWindow('Image', cv2.WINDOW_NORMAL)
print('display the image ')
cv2.imshow('Image', img)
print('press a key inside th... | flexible | {
"blob_id": "7cf6a4b8057280b38572dd92693013724751c47f",
"index": 9502,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('read imafe from file')\n<mask token>\nprint('create a window holder for the image')\ncv2.namedWindow('Image', cv2.WINDOW_NORMAL)\nprint('display the image ')\ncv2.imshow('Image', i... | [
0,
1,
2,
3,
4
] |
import requests
def login(username, password):
data = {'login':username,'pwd':password,'lang':''}
r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php', data=data, allow_redirects=False)
if r.headers['Location'] == '../out/out.Login.php?msg=Error+signing+in.+User+ID+or+password+incorrec... | normal | {
"blob_id": "ae84b449c8919f14954633b14993e6291501bc24",
"index": 1019,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef login(username, password):\n data = {'login': username, 'pwd': password, 'lang': ''}\n r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php',\n da... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class TestConfig(unittest.TestCase):
def test_load_theme(self):
struct = config.Struct()
struct.color_scheme = dict()
config.load_theme(struct, TEST_THEME_PATH, struct.color_scheme, dict())
expected = {'keyword': 'y'}
self.assertEquals(struct.c... | flexible | {
"blob_id": "d5efbbb6e818e797652f304f3d022e04be245778",
"index": 4931,
"step-1": "<mask token>\n\n\nclass TestConfig(unittest.TestCase):\n\n def test_load_theme(self):\n struct = config.Struct()\n struct.color_scheme = dict()\n config.load_theme(struct, TEST_THEME_PATH, struct.color_schem... | [
2,
3,
4,
5,
6
] |
#! /bin/env python3
"""
Lane Emden Python interface.
Main routine:
lane_emden_int(dz, n)
"""
import numpy as np
from . import _solver
def test():
"""
A simple test.
"""
n = 3.
dz = 2.**(-14)
_solver.lane(dz,n)
out = _solver.laneout
n = out.ndata
t = out.theta
return t,n
d... | normal | {
"blob_id": "10723f703f40b5db2b7c9532cda520b2ae078546",
"index": 2175,
"step-1": "<mask token>\n\n\ndef lane_emden_int(dz=2.0 ** -14, n=3.0, w=0.0):\n \"\"\"\n Interface to FORTRAN90 Lane-Emden Integrator.\n\n Call:\n ndata, data = laneemden.lane_emden_int(dz, n, w)\n\n INPUT:\n dz:\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def post_build():
git_add_files('PKGBUILD')
git_commit()
update_aur_repo()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def pre_build():
newver = _G.newver.removeprefix('amd-drm-fixes-')
for... | flexible | {
"blob_id": "32eff306444966fab47815fcbae4aefb6769d29b",
"index": 9684,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef post_build():\n git_add_files('PKGBUILD')\n git_commit()\n update_aur_repo()\n",
"step-3": "<mask token>\n\n\ndef pre_build():\n newver = _G.newver.removeprefix('amd... | [
0,
1,
2,
3,
4
] |
from base_page import Base_Page
import locators
class Product_Object:
"Page Object for the table"
#locators
def get_all_text(self):
"Get the text within the table"
table_text = []
row_doms = self.get_elements(self.rows_xpath)
for index,row_dom in enumerate(row_doms):
... | normal | {
"blob_id": "aebc8665a97ab0a71b1d8a920b5cbf2643254883",
"index": 479,
"step-1": "<mask token>\n\n\nclass Product_Object:\n <mask token>\n\n def get_all_text(self):\n \"\"\"Get the text within the table\"\"\"\n table_text = []\n row_doms = self.get_elements(self.rows_xpath)\n for... | [
4,
6,
8,
11,
12
] |
# *** Обработка исключений (исключительные события, искл. ситуации)***
# генерация исключения
a=100
b=0
# "деление на ноль" - пример ошибки (не рабочий)
# c=a/b
# решение - обработка исключений (отлов исключения)
# конструкция "try-except"
# try:
# c = a / b
# print("Все отлично")
# except:
# # тут долж... | normal | {
"blob_id": "bb02ba68eb6629dad364b5f015680e4126e655f3",
"index": 6173,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n var = int(input('Введите число: '))\n c = 100 / var\n print('Полет нормальный!')\nexcept ZeroDivisionError:\n c = 0\n print('Попытка деления на ноль')\nelse:\n pr... | [
0,
1,
2,
3
] |
#coding: utf-8
#/usr/bin/python
__author__='julia sayapina'
### Use db_reset.py to drop the db and recreate it, then use 'migrate' --> 'createsuperuser' --> 'makemigrations' --> 'migrate' as usual.
### This will create the DB structure as it has to be from django
### Then use test_db_fullfill.py to fullfill the db wit... | normal | {
"blob_id": "3240310653930662dcc4d79646b1a75c2994cda7",
"index": 9063,
"step-1": "<mask token>\n\n\ndef db_create():\n cur.execute(\n \"\"\"\n create table if not exists Offshores_asset (\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\n asset_name VARCHA... | [
2,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
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()))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def II():
retu... | flexible | {
"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
] |
#!/usr/bin/env python
# encoding: UTF-8
'''
Script to select current version for a given soft (python, ruby or java).
'''
import os
import re
import sys
import glob
import getopt
# fix input in Python 2 and 3
try:
input = raw_input # pylint: disable=redefined-builtin,invalid-name
except NameError:
pass
cl... | normal | {
"blob_id": "93e8e9fc4f0503dfc3243bef5ab8261a4cdfc296",
"index": 1009,
"step-1": "<mask token>\n\n\nclass Version(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, soft):\n \"\"\"\n Constructor that takes software name\n \"\"\"\n self.soft = soft... | [
5,
6,
7,
8,
10
] |
<|reserved_special_token_0|>
class FactTypeAdmin(RootsMagicModelAdmin):
list_display = ['id', 'owner_type', 'name', 'abbreviation',
'gedcom_tag', 'use_value', 'use_date', 'use_place', 'sentence', 'flags'
]
class FamilyAdmin(RootsMagicModelAdmin):
list_display = ['id', 'father', 'mother', 'ch... | flexible | {
"blob_id": "b4d48427dddc7c0240cf05c003cbf7b0163279ee",
"index": 9729,
"step-1": "<mask token>\n\n\nclass FactTypeAdmin(RootsMagicModelAdmin):\n list_display = ['id', 'owner_type', 'name', 'abbreviation',\n 'gedcom_tag', 'use_value', 'use_date', 'use_place', 'sentence', 'flags'\n ]\n\n\nclass Fa... | [
31,
35,
38,
39,
48
] |
#!/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
] |
<|reserved_special_token_0|>
def matchuj_wydzial(nazwa):
try:
return Wydzial.objects.get(nazwa__iexact=nazwa.strip())
except Wydzial.DoesNotExist:
pass
def matchuj_tytul(tytul: str, create_if_not_exist=False) ->Tytul:
"""
Dostaje tytuł: pełną nazwę albo skrót
"""
try:
... | flexible | {
"blob_id": "47025a30d79341ff0819fe87638e35960a5fc87d",
"index": 6446,
"step-1": "<mask token>\n\n\ndef matchuj_wydzial(nazwa):\n try:\n return Wydzial.objects.get(nazwa__iexact=nazwa.strip())\n except Wydzial.DoesNotExist:\n pass\n\n\ndef matchuj_tytul(tytul: str, create_if_not_exist=False) ... | [
11,
12,
13,
15,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
b.drop(b.columns[b.columns.str.contains('unnamed', case=False)], axis=1,
inplace=True)
b.to_csv('Cleaned_dataset.csv', index=False)
<|reserved_special_token_0|>
report.show_html()
<|reserved_special_token_1|>
<|reserved_spe... | flexible | {
"blob_id": "f93b7f2939bbee9b0cb5402d3e5f5d6c482d37c4",
"index": 6983,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nb.drop(b.columns[b.columns.str.contains('unnamed', case=False)], axis=1,\n inplace=True)\nb.to_csv('Cleaned_dataset.csv', index=False)\n<mask token>\nreport.show_html()\n",
"step-3":... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for index, elements in enumerate(a):
if elements == 5:
b.append(index)
print(b)
<|reserved_special_token_1|>
a = 5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7
b = []
for index, elements in enumerate(a):
if elements =... | flexible | {
"blob_id": "d7876a078af8572e44b4eb16f3ec0898db73724d",
"index": 2118,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor index, elements in enumerate(a):\n if elements == 5:\n b.append(index)\nprint(b)\n",
"step-3": "a = 5, 1, 3, 5, 3, 1, 0, 9, 5, 3, 8, 6, 5, 7\nb = []\nfor index, elements i... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
c.execute(q)
<|reserved_special_token_0|>
c.execute(q)
<|reserved_special_token_0|>
c.execute(q)
conn.commit()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
conn = sqlite3.connect('blog.db')
c = conn.cursor()
q = 'C... | flexible | {
"blob_id": "8afaa69d3a20c5e39e6321869f25dbd9020a5b3a",
"index": 2460,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nc.execute(q)\n<mask token>\nc.execute(q)\n<mask token>\nc.execute(q)\nconn.commit()\n",
"step-3": "<mask token>\nconn = sqlite3.connect('blog.db')\nc = conn.cursor()\nq = 'CREATE TABLE ... | [
0,
1,
2,
3,
4
] |
#Calculadora mediante el terminal
numero1 = 0
numero2 = 0
#Preguntamos los valores
operacion = input("¿Qué operación quiere realizar (Suma / Resta / Division / Multiplicacion)?: ").upper()
numero1 = int(input("Introduzca el valor 1: "))
numero2 = int(input("Introduzca el valor 2: "))
#Realizamos las operaciones
... | normal | {
"blob_id": "5d618acc0962447554807cbb9d3546cd4e0b3572",
"index": 3005,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif operacion == 'SUMA':\n resultado = numero1 + numero2\nelif operacion == 'RESTA':\n resultado = numero1 - numero2\nelif operacion == 'DIVISION':\n resultado = numero1 / numero2... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .menu import menu
from .create_portfolio import create_portfolio
from .search import search
from .list_assets import list_assets
from .add_transaction import add_transaction
from .stats import stats
from .info import info
| flexible | {
"blob_id": "f2abb7ea3426e37a10e139d83c33011542e0b3d1",
"index": 3863,
"step-1": "<mask token>\n",
"step-2": "from .menu import menu\nfrom .create_portfolio import create_portfolio\nfrom .search import search\nfrom .list_assets import list_assets\nfrom .add_transaction import add_transaction\nfrom .stats impor... | [
0,
1
] |
import tkinter
import webbrowser
ventana = tkinter.Tk()
ventana.geometry("1920x1080")
def test():
webbrowser.open_new_tab('Test.html')
boton1 = tkinter.Button(ventana,text ="WEB", width = 10, height=5, command = test );
boton2 = tkinter.Button(ventana,text ="boton2", width = 10, height=5);
boton3 = tkint... | normal | {
"blob_id": "8bf330dc7bee65ac9478722233477ebe5d0286c2",
"index": 1102,
"step-1": "<mask token>\n\n\ndef test():\n webbrowser.open_new_tab('Test.html')\n\n\n<mask token>\n",
"step-2": "<mask token>\nventana.geometry('1920x1080')\n\n\ndef test():\n webbrowser.open_new_tab('Test.html')\n\n\n<mask token>\nbo... | [
1,
2,
3,
4,
5
] |
from jaqsmds.server.repliers.basic import RegularReplier
from jaqsmds.server.repliers.handlers import JsetHandler, JsdHandler, JsiHandler
from queue import Queue, Empty
from threading import Thread
import logging
class FreeReplier(RegularReplier):
def __init__(self):
super(FreeReplier, self).__init__()
... | normal | {
"blob_id": "42ebd42801b7d1563c9f204f296afba5fa3c6d3c",
"index": 1592,
"step-1": "<mask token>\n\n\nclass FreeReplier(RegularReplier):\n <mask token>\n\n def run(self):\n while self._running or self.input.qsize():\n try:\n client, message = self.input.get(timeout=2)\n ... | [
5,
6,
7,
8,
10
] |
class product(object):
def __init__(self, item_name, price, weight, brand, status = "for sale"):
self.item_name = item_name
self.price = price
self.weight = weight
self.brand = brand
self.cost = price
self.status = status
self.displayInfo()
def displayInfo... | normal | {
"blob_id": "303d56c18cce922ace45de1b8e195ebfdd874e23",
"index": 7394,
"step-1": "class product(object):\n def __init__(self, item_name, price, weight, brand, status = \"for sale\"):\n self.item_name = item_name\n self.price = price\n self.weight = weight\n self.brand = brand\n ... | [
0
] |
"""Integration to integrate Keymitt BLE devices with Home Assistant."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Any
from microbot import MicroBotApiClient, parse_advertisement_data
from homeassistant.components import bluetooth
from homeassistant.components.bluetooth.passi... | normal | {
"blob_id": "5509880c30c2e03ca6eb42ad32018c39fb5939ed",
"index": 9955,
"step-1": "<mask token>\n\n\nclass MicroBotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):\n <mask token>\n\n def __init__(self, hass: HomeAssistant, client: MicroBotApiClient,\n ble_device: BLEDevice) ->None:\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class DagsterMessageProps(NamedTuple('_DagsterMessageProps', [(
'orig_message', Optional[str]), ('log_message_id', Optional[str]), (
'log_timestamp', Optional[str]), ('dagster_event', Optional[Any])])):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserv... | flexible | {
"blob_id": "f900e08c06ae736f5e32ac748e282700f9d0a969",
"index": 7922,
"step-1": "<mask token>\n\n\nclass DagsterMessageProps(NamedTuple('_DagsterMessageProps', [(\n 'orig_message', Optional[str]), ('log_message_id', Optional[str]), (\n 'log_timestamp', Optional[str]), ('dagster_event', Optional[Any])])):\... | [
16,
18,
21,
22,
25
] |
## Filename: name.py
# Author: Marcelo Feitoza Parisi
#
# Description: Report the objects
# on the bucket sorted by name.
#
# ###########################
# # DISCLAIMER - IMPORTANT! #
# ###########################
#
# Stuff found here was built as a
# Proof-Of-Concept or Study material
# and should not b... | normal | {
"blob_id": "562b2c3567e42699cfd0804a5780af7ede142e13",
"index": 1056,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef exec(bucket_id, project_id, reverse_opt):\n client = storage.Client()\n bucket = client.bucket(bucket_id, user_project=project_id)\n blobs = bucket.list_blobs()\n blob... | [
0,
1,
2,
3
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 13:37:10 2018
@author: ninja1mmm
"""
import os
import numpy as np
import pandas as pd
from sklearn import preprocessing
def file_name(file_dir):
root_tmp=[]
dirs_tmp=[]
files_tmp=[]
for root, dirs, files in os.walk(file_dir): ... | normal | {
"blob_id": "96d5cf948a9b0f622889977e8b26993299bceead",
"index": 770,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef file_name(file_dir):\n root_tmp = []\n dirs_tmp = []\n files_tmp = []\n for root, dirs, files in os.walk(file_dir):\n root_tmp.append(root)\n dirs_tmp.app... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
learningRateBase = 0.001
learningRateDecreaseStep = 80
epochNum = 100
generateNum = 3
batchSize = 16
trainPoems = './data/poems.txt'
checkpointsPath = './model/'
<|reserved_special_token_1|>
learningRateBase = 0.001
learningRateDecreaseStep = 80
epochNum =... | flexible | {
"blob_id": "2fb299f5454c251dc1c77c2597ee23bf414c716e",
"index": 4845,
"step-1": "<mask token>\n",
"step-2": "learningRateBase = 0.001\nlearningRateDecreaseStep = 80\nepochNum = 100\ngenerateNum = 3\nbatchSize = 16\ntrainPoems = './data/poems.txt'\ncheckpointsPath = './model/'\n",
"step-3": "learningRateBase... | [
0,
1,
2
] |
# coding=utf-8
import re
import traceback
from pesto_common.config.configer import Configer
from pesto_common.log.logger_factory import LoggerFactory
from pesto_orm.core.base import db_config
from pesto_orm.core.executor import ExecutorFactory
from pesto_orm.core.model import BaseModel
from pesto_orm.core.repository i... | normal | {
"blob_id": "a68de7555fdab06014fd562e7db29ca2da03f443",
"index": 8240,
"step-1": "<mask token>\n\n\nclass MysqlBaseModel(BaseModel):\n\n def __init__(self, db_name=None, table_name=None, table_alias=None,\n primary_key='id'):\n super(MysqlBaseModel, self).__init__(db_name, table_name,\n ... | [
7,
12,
13,
15,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
# -*- coding: utf-8 -*-
'''
=======================================================================
AutoTest Team Source File.
Copyright(C), Changyou.com
-----------------------------------------------------------------------
Created: 2017/3/2 by Cheng... | flexible | {
"blob_id": "38f7c529cd0a8d85de266c6a932e6c8342aee273",
"index": 4969,
"step-1": "<mask token>\n",
"step-2": "# -*- coding: utf-8 -*-\n'''\n=======================================================================\nAutoTest Team Source File.\nCopyright(C), Changyou.com\n------------------------------------------... | [
0,
1
] |
from can.interfaces.ics_neovi.neovi_bus import NeoViBus
| normal | {
"blob_id": "6025b8d4015572ea1a760c1b4bc7200a1019c802",
"index": 5031,
"step-1": "<mask token>\n",
"step-2": "from can.interfaces.ics_neovi.neovi_bus import NeoViBus\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import datetime
import time
import requests
from config import url
from data import DistrictList
import random
import pymysql
def base_url():
default_request = {
'base_url': url,
'headers': {
"Content-Type": "application/json;charset=UTF-8"}
}
return default_request['base_url'... | normal | {
"blob_id": "c55b6fed92a5f4f2961c6f8d5b150b22a5f622e8",
"index": 4520,
"step-1": "<mask token>\n\n\ndef base_url():\n default_request = {'base_url': url, 'headers': {'Content-Type':\n 'application/json;charset=UTF-8'}}\n return default_request['base_url']\n\n\ndef random_Num(length, string=[]):\n ... | [
10,
13,
15,
17,
18
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [m... | flexible | {
"blob_id": "2e448176a755828e5c7c90e4224102a285098460",
"index": 4852,
"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
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for condition in conditions:
print(condition)
command = ['./nk_oee -MODES_RESOLUTION 10 -SEED', seed]
dir_name = []
for var in defaults:
if var not in condition:
condition[var] = defaults[var]
... | flexible | {
"blob_id": "a826f33361ec59824f3c4a83d01e94c6b307b0a9",
"index": 9144,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor condition in conditions:\n print(condition)\n command = ['./nk_oee -MODES_RESOLUTION 10 -SEED', seed]\n dir_name = []\n for var in defaults:\n if var not in conditi... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/python3
import sys
import csv
infile = sys.stdin
for line in infile:
line = line.strip()
my_list = line.split(',')
if my_list[0] != "ball":
continue
batsman = my_list[4]
bowler = my_list[6]
if my_list[9] == 'run out' or my_list[9] == '""' or my_list[9] == "retired hurt":
... | normal | {
"blob_id": "cfa7dc295c635bbdf707f1e899c4fbf8ea91df9a",
"index": 1209,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor line in infile:\n line = line.strip()\n my_list = line.split(',')\n if my_list[0] != 'ball':\n continue\n batsman = my_list[4]\n bowler = my_list[6]\n if my_l... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def predict_batch(test_data, model, batch_size=None):
result = model.predict(test_data, batch_size=batch_size)
return result
<|reserved_special_token_0|>
def post_predict(test_path, score_path, entity_path, alpha=0.75):
candidate_dict = load_candidates2(score_path)
tes... | flexible | {
"blob_id": "a19616d448da057d5be0af841467a25baaacf5b3",
"index": 9299,
"step-1": "<mask token>\n\n\ndef predict_batch(test_data, model, batch_size=None):\n result = model.predict(test_data, batch_size=batch_size)\n return result\n\n\n<mask token>\n\n\ndef post_predict(test_path, score_path, entity_path, al... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class Countries(TemplateView):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Countries(TemplateView):
<|reserved_special_token_0|>
def get_context_data(self, **kwargs):
return Countri... | flexible | {
"blob_id": "fd7fe2e4ffaa4de913931e83fd1de40f79b08d98",
"index": 6222,
"step-1": "<mask token>\n\n\nclass Countries(TemplateView):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Countries(TemplateView):\n <mask token>\n\n def get_context_data(self, **kwargs):\n return C... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [url('buy', views.BuyPage, name='BuyPage'), url('sell', views
.SellPage, name='SellPage'), url('', views.TradePage, name='TradePage')]
<|reserved_special_token_1|>
from django.conf.urls import include, url
fro... | flexible | {
"blob_id": "5bbaffb35a89558b5cf0b4364f78d68ff2d69a01",
"index": 5726,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [url('buy', views.BuyPage, name='BuyPage'), url('sell', views\n .SellPage, name='SellPage'), url('', views.TradePage, name='TradePage')]\n",
"step-3": "from django.conf... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
include: '../ngs.settings.smk'
<|reserved_special_token_0|>
update_config(config_default, config)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
include: '../ngs.settings.smk'
config_default = {'bio.ngs.motif.centipede': {'options': ''}}
update_... | flexible | {
"blob_id": "4620b52a43f2469ff0350d8ef6548de3a7fe1b55",
"index": 5019,
"step-1": "<mask token>\n",
"step-2": "include: '../ngs.settings.smk'\n<mask token>\nupdate_config(config_default, config)\n<mask token>\n",
"step-3": "include: '../ngs.settings.smk'\nconfig_default = {'bio.ngs.motif.centipede': {'options... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def update_delete_product(rowid, id_, name, quantity, cost, qry):
if id_ == '' and name == '' and quantity == '' and cost == '':
return False, ' You Cannot Leave It Empty '
try:
conn = sqlite3.connect('SuperMarket.db')
cur = conn.cursor()
try:
... | flexible | {
"blob_id": "88d0ced41a8f176a8a12bba6406b4162ea6dfc52",
"index": 9308,
"step-1": "<mask token>\n\n\ndef update_delete_product(rowid, id_, name, quantity, cost, qry):\n if id_ == '' and name == '' and quantity == '' and cost == '':\n return False, ' You Cannot Leave It Empty '\n try:\n conn =... | [
3,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def notification(message: str):
"""
Display notification to the desktop
Task:
1. show() -> it will generate a complete new pop
2. update() -> it will update the payload part of same notification pop-u... | flexible | {
"blob_id": "8a7904881d936a3cb421ed5550856b600894fcee",
"index": 5397,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef notification(message: str):\n \"\"\"\n Display notification to the desktop\n Task:\n 1. show() -> it will generate a complete new pop\n 2. update() -> it wi... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def download(url):
print('Downloading ', url)
userAgent = (
'Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1'
)
... | flexible | {
"blob_id": "9d302ff2de8280bd8786794cdd533107d2a458bc",
"index": 5611,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef download(url):\n print('Downloading ', url)\n userAgent = (\n 'Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/533.1 (KHTML, like Ge... | [
0,
1,
2,
3,
4
] |
# Generated by Django 3.2.4 on 2021-06-18 01:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('eCom', '0014_auto_20210617_1503'),
]
operations = [
migrations.RemoveField(
model_name='order',... | normal | {
"blob_id": "ef57f0dfea261f022ced36ef9e27a07d63c21026",
"index": 2156,
"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 = [('eCom', '001... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class ListItem:
"""A custom object that stores four pieces of data representing each
entry in the todo list. Contains the text of the todo list entry,
the priority of the entry, the group code (NYI), and the visibility of
the entry"""
def __init__(self, text, priority... | flexible | {
"blob_id": "168a12e6653a0526f29c163913def50147481154",
"index": 632,
"step-1": "<mask token>\n\n\nclass ListItem:\n \"\"\"A custom object that stores four pieces of data representing each\n entry in the todo list. Contains the text of the todo list entry,\n the priority of the entry, the group code (NY... | [
8,
11,
12,
18,
24
] |
<|reserved_special_token_0|>
class PlSqlLexer(Lexer):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "b6dbed95b321ac93c712c4735d601a00650b8dc4",
"index": 1552,
"step-1": "<mask token>\n\n\nclass PlSqlLexer(Lexer):\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 <ma... | [
1,
3,
4,
5,
6
] |
# a little more thing to be done.
def eval_loop():
while True:
s = input('Please input: ')
if s != 'done':
print(eval(s))
else:
break
eval_loop() | normal | {
"blob_id": "80969de6924ae5fe6bb8e7f1211e7aca28c63989",
"index": 2615,
"step-1": "<mask token>\n",
"step-2": "def eval_loop():\n while True:\n s = input('Please input: ')\n if s != 'done':\n print(eval(s))\n else:\n break\n\n\n<mask token>\n",
"step-3": "def eval... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def FivePrimeArea(df):
df = df.sort_values(by=['chr', 'end'], ascending=True)
df['FA_start'] = df['gene_start']
df_exon = df[df['type'] == 'exon'].copy()
df_exon = df_exon.drop_duplicates(subset=['name'], keep='first')
df_exon['FA_end'] = df_exon['end']
df_exon = d... | flexible | {
"blob_id": "5c5922fd3a7a5eec121d94e69bc972089e435175",
"index": 9406,
"step-1": "<mask token>\n\n\ndef FivePrimeArea(df):\n df = df.sort_values(by=['chr', 'end'], ascending=True)\n df['FA_start'] = df['gene_start']\n df_exon = df[df['type'] == 'exon'].copy()\n df_exon = df_exon.drop_duplicates(subse... | [
4,
6,
8,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def _adjacent(word1, word2):
"""
Returns True if the input words differ by only a single character;
returns False otherwise.
>>> _adjacent('phone','phony')
True
>>> _adjacent('stone','money')
False
... | flexible | {
"blob_id": "631323e79f4fb32611d7094af92cff8f923fa996",
"index": 303,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef _adjacent(word1, word2):\n \"\"\"\n Returns True if the input words differ by only a single character;\n returns False otherwise.\n\n >>> _adjacent('phone','phony')\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Sale(Product):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Sale(Product):
def __init__(self, product_name, quantity, unit_price, attendant, date):
supe... | flexible | {
"blob_id": "8ed14bb9af23055f4689e06df872a1d36185cd09",
"index": 6865,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Sale(Product):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Sale(Product):\n\n def __init__(self, product_name, quantity, unit_price, attendant, date):\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def csv_usage():
"""
This function demonstrates how to use csv module to read and write csv files
"""
with open('example.csv', 'r', newline='') as csvfile:
reader_c = csv.reader(csvfile, delimiter=';')
... | flexible | {
"blob_id": "bcc2977f36ecc775f44ae4251ce230af9abf63ba",
"index": 7362,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef csv_usage():\n \"\"\"\n This function demonstrates how to use csv module to read and write csv files\n \"\"\"\n with open('example.csv', 'r', newline='') as csvfile:\n... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import uuid
import cgi
import squareconnect
from squareconnect.rest import ApiException
from squareconnect.apis.transactions_api import TransactionsApi
from squareconnect.apis.locations_api import LocationsApi
from squareconnect.apis.customers... | normal | {
"blob_id": "bb7910af5334641fd2db7146112afaff7a2e42b9",
"index": 565,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif boxChecked == 'true':\n heading = 'Recurring Donation'\n customerRequest = {'given_name': firstName, 'family_name': lastName,\n 'email_address': email}\n try:\n c... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while i == 0:
num = int(input('What length do you want? '))
password = ''.join(random.sample(s, num))
print(password)
j = 0
while j == 0:
want = input('Do you this password? (yes or no) ')
want.... | flexible | {
"blob_id": "3089dba0956151bd43e443b679ec0b24da644d08",
"index": 3701,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i == 0:\n num = int(input('What length do you want? '))\n password = ''.join(random.sample(s, num))\n print(password)\n j = 0\n while j == 0:\n want = input('D... | [
0,
1,
2,
3,
4
] |
from django.shortcuts import render, Http404, HttpResponse, redirect
from django.contrib.auth import authenticate, login
from website.form import UserForm
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from website.models import UserProfile
from website.form import UserForm
import pandas as ... | normal | {
"blob_id": "d261efa72e1ab77507a1fd84aa2e462c6969af56",
"index": 6579,
"step-1": "<mask token>\n\n\ndef df_to_sql_T_1(filefullpath, sheet, row_name):\n excel_df = pd.read_excel(filefullpath, sheetname=sheet)\n excel_df = excel_df.dropna(how='all')\n excel_df = excel_df.dropna(axis=1, how='all')\n exc... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
class BreakoutDeterministic_v4(Environment):
def __init__(self):
self.env = gym.make(EnvironmentName.BREAKOUT_DETERMINISTIC_V4.value)
super(BreakoutDeterministic_v4, self).__init__()
self.action_shape = self.get_action_shape()
self.state_shape = self.g... | flexible | {
"blob_id": "05e57ed95427f0de74ea5b0589c5cd56e4a96f73",
"index": 8776,
"step-1": "<mask token>\n\n\nclass BreakoutDeterministic_v4(Environment):\n\n def __init__(self):\n self.env = gym.make(EnvironmentName.BREAKOUT_DETERMINISTIC_V4.value)\n super(BreakoutDeterministic_v4, self).__init__()\n ... | [
9,
11,
16,
17,
18
] |
"""added Trail.Geometry without srid
Revision ID: 56afb969b589
Revises: 2cf6c7c1f0d7
Create Date: 2014-12-05 18:13:55.512637
"""
# revision identifiers, used by Alembic.
revision = '56afb969b589'
down_revision = '2cf6c7c1f0d7'
from alembic import op
import sqlalchemy as sa
import flask_admin
import geoalchemy2
de... | normal | {
"blob_id": "d724b4f57cf7683d6b6385bf991ed23a5dd8208f",
"index": 3881,
"step-1": "<mask token>\n\n\ndef upgrade():\n with op.batch_alter_table('trail', schema=None) as batch_op:\n batch_op.add_column(sa.Column('geom', geoalchemy2.types.Geometry(\n geometry_type='MULTILINESTRING'), nullable=T... | [
1,
2,
3,
4,
5
] |
import collections
s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
d = collections.defaultdict(list)
d2 = {'test':121}
for k, v in s:
d[k].append(v)
d['test'].append('value')
print list(d.items())
print d
print d['blue']
print type(d)
print type(d2) | normal | {
"blob_id": "15a894e6f94fc62b97d1614a4213f21331ef12a0",
"index": 7843,
"step-1": "import collections\ns = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]\n\nd = collections.defaultdict(list)\nd2 = {'test':121}\nfor k, v in s:\n d[k].append(v)\n\nd['test'].append('value')\n\nprint list(d.i... | [
0
] |
#encoding:utf-8
from flask import Flask
import config
from flask_rabbitmq import Queue, RabbitMQ
app = Flask(__name__)
app.config.from_object(config)
queue = Queue()
mq = RabbitMQ(app, queue)
from app import demo
| normal | {
"blob_id": "ccf9c389a65d1420e87deec2100e37bccdcb5539",
"index": 6323,
"step-1": "<mask token>\n",
"step-2": "<mask token>\napp.config.from_object(config)\n<mask token>\n",
"step-3": "<mask token>\napp = Flask(__name__)\napp.config.from_object(config)\nqueue = Queue()\nmq = RabbitMQ(app, queue)\n<mask token>... | [
0,
1,
2,
3,
4
] |
from hierarchical_envs.pb_envs.gym_locomotion_envs import InsectBulletEnv
import argparse
import joblib
import tensorflow as tf
from rllab.misc.console import query_yes_no
# from rllab.sampler.utils import rollout
#from pybullet_my_envs.gym_locomotion_envs import Ant6BulletEnv, AntBulletEnv, SwimmerBulletEnv
from hie... | normal | {
"blob_id": "e85f203e71c8fdad86bd82b19104263cca72caf1",
"index": 4817,
"step-1": "from hierarchical_envs.pb_envs.gym_locomotion_envs import InsectBulletEnv\nimport argparse\n\nimport joblib\nimport tensorflow as tf\n\nfrom rllab.misc.console import query_yes_no\n# from rllab.sampler.utils import rollout\n#from p... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def find_max_three(a, b, c):
return find_max(a, find_max(b, c))
<|reserved_special_token_1|>
def find_max(a, b):
if a > b:
return a
return b
def find_max_three(a, b, c):
return find_max(a, find_max(b... | flexible | {
"blob_id": "71dc429033b159f6ed806358f2286b4315e842d9",
"index": 9617,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef find_max_three(a, b, c):\n return find_max(a, find_max(b, c))\n",
"step-3": "def find_max(a, b):\n if a > b:\n return a\n return b\n\n\ndef find_max_three(a, b, ... | [
0,
1,
2
] |
#!d:\python_projects\env2\scripts\python.exe
# EASY-INSTALL-DEV-SCRIPT: 'Django==2.1.dev20180209010235','django-admin.py'
__requires__ = 'Django==2.1.dev20180209010235'
__import__('pkg_resources').require('Django==2.1.dev20180209010235')
__file__ = 'D:\\python_projects\\ENV2\\django\\django\\bin\\django-admin.py'
exec(... | normal | {
"blob_id": "4bbf0a0fadc506ad3674912f1885525a94b5b1e9",
"index": 2807,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n__import__('pkg_resources').require('Django==2.1.dev20180209010235')\n<mask token>\nexec(compile(open(__file__).read(), __file__, 'exec'))\n",
"step-3": "__requires__ = 'Django==2.1.dev... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class store:
<|reserved_special_token_0|>
def add(self, iname, itq, iup):
i = item(iname, itq, iup)
self.dic[iname] = [itq, iup]
def callbill(self, rname, rq):
for i in range(0, len(self.dic)):
if rname in self.dic.keys():
... | flexible | {
"blob_id": "b11210e73b403bc7a9ee24a53201ab2366ec1808",
"index": 7106,
"step-1": "<mask token>\n\n\nclass store:\n <mask token>\n\n def add(self, iname, itq, iup):\n i = item(iname, itq, iup)\n self.dic[iname] = [itq, iup]\n\n def callbill(self, rname, rq):\n for i in range(0, len(s... | [
4,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
class Renderer(base.Renderer):
render = ViewPageTemplateFile('twitterportlet.pt')
def __init__(self, context, request, view, manager, data):
self.context = context
self.request = request
self.view = view
self.manager = manager
self.data = d... | flexible | {
"blob_id": "214585956e44ce006db0702fd23692b11459f9e1",
"index": 7664,
"step-1": "<mask token>\n\n\nclass Renderer(base.Renderer):\n render = ViewPageTemplateFile('twitterportlet.pt')\n\n def __init__(self, context, request, view, manager, data):\n self.context = context\n self.request = requ... | [
9,
10,
13,
15,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def f(p_arg, *s_args, **kw_args):
return s_args[0] + kw_args['py'] + p_arg
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def f(p_arg, *s_args, **kw_args):
return s_args[0] + kw_args['py'] + p_arg
r = f(3, 2, py=1)
<|reserved_speci... | flexible | {
"blob_id": "4a913cfdbddb2f6b5098395814f5fc1203192b9a",
"index": 4847,
"step-1": "<mask token>\n",
"step-2": "def f(p_arg, *s_args, **kw_args):\n return s_args[0] + kw_args['py'] + p_arg\n\n\n<mask token>\n",
"step-3": "def f(p_arg, *s_args, **kw_args):\n return s_args[0] + kw_args['py'] + p_arg\n\n\nr... | [
0,
1,
2,
3
] |
import numpy as np
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(n)]
a = np.array(a)
b = np.array(b)
print(np.dot(a, b))
| normal | {
"blob_id": "17b8fec5583f2544bd02a2409528082fa1dc2a1e",
"index": 4107,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(np.dot(a, b))\n",
"step-3": "<mask token>\nn = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\nb = [list(map(int, input().split())) for _ in range(n)]\na = ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if wht == 0:
print('wht is', wht)
else:
print('whtsdsb')
<|reserved_special_token_0|>
print('BMI=', bmi)
if bmi < 18.5:
print('too light')
elif bmi < 25:
print('normal')
elif bmi < 30:
print('over')
else:
p... | flexible | {
"blob_id": "48d0bfdc607a4605ef82f5c7dc7fd6fc85c4255f",
"index": 377,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif wht == 0:\n print('wht is', wht)\nelse:\n print('whtsdsb')\n<mask token>\nprint('BMI=', bmi)\nif bmi < 18.5:\n print('too light')\nelif bmi < 25:\n print('normal')\nelif bmi... | [
0,
1,
2,
3
] |
from rest_framework import permissions
class AdminUrlUserPermission(permissions.BasePermission):
def has_permission(self, request, view):
return (request.user.is_authenticated
and (request.user.role == 'admin'
or request.user.is_superuser))
def has_object_permissi... | normal | {
"blob_id": "4549f26cf8051535f9d3486d111fc7afe7514dea",
"index": 5674,
"step-1": "<mask token>\n\n\nclass AdminUrlUserPermission(permissions.BasePermission):\n <mask token>\n <mask token>\n\n\nclass ReadOnly(permissions.BasePermission):\n\n def has_permission(self, request, view):\n return reques... | [
6,
7,
8,
9,
10
] |
#
# @lc app=leetcode id=14 lang=python3
#
# [14] Longest Common Prefix
#
# @lc code=start
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
pass
# At the moment I just wanna test my workspace so it's working tomorrow it's time for the problems
# @lc code=end
| normal | {
"blob_id": "401c6b09edf593e00aecf5bbb1b2201effc9e78c",
"index": 7384,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def longestCommonPrefix(self, strs: List[str]) ->str:\n pass\n",
"step-4": "#\n# @lc app=leetcode id=14 lang=python3\n... | [
0,
1,
2,
3
] |
import hashlib
import os
def fileMD(self):
salt_ = os.urandom(32).hex()
hash_object = hashlib.md5()
hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))
print("MD5 Hash: "+hash_object.hexdigest()) | normal | {
"blob_id": "bc9718fa57046888961d1b5245abefa8f752e983",
"index": 8103,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fileMD(self):\n salt_ = os.urandom(32).hex()\n hash_object = hashlib.md5()\n hash_object.update(('%s%s' % (salt_, self.theFile)).encode('utf-8'))\n print('MD5 Hash: ' ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def get_cat_fact():
myFacts = [
'Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required for good feline health. Make sure you have the proper Pet supplies to keep your cat happy and healthy.'
,
'The strongest climber among... | flexible | {
"blob_id": "77971b088a7e076e3bf6d7aa320981a50e7756ce",
"index": 429,
"step-1": "<mask token>\n\n\ndef get_cat_fact():\n myFacts = [\n 'Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required for good feline health. Make sure you have the proper Pet supplies to kee... | [
3,
4,
5,
7,
8
] |
<|reserved_special_token_0|>
def eval_genome(genome, config):
net = neat.nn.FeedForwardNetwork.create(genome, config)
env.reset()
ob, _, _, _ = env.step(env.action_space.sample())
inx = int(ob.shape[0] / 8)
iny = int(ob.shape[1] / 8)
fitnesses = []
score1 = 0
score2 = 0
fitness = 0... | flexible | {
"blob_id": "36e350e0d578e169efaafb9e311566d71d6bc59e",
"index": 1438,
"step-1": "<mask token>\n\n\ndef eval_genome(genome, config):\n net = neat.nn.FeedForwardNetwork.create(genome, config)\n env.reset()\n ob, _, _, _ = env.step(env.action_space.sample())\n inx = int(ob.shape[0] / 8)\n iny = int(... | [
3,
4,
5,
6,
7
] |
name = input("Введите ваше имя ")
print("Добрый день,", name)
| normal | {
"blob_id": "e44c4b2c3b60d34d4540ec2d3a782c777c52fbc0",
"index": 8662,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Добрый день,', name)\n",
"step-3": "name = input('Введите ваше имя ')\nprint('Добрый день,', name)\n",
"step-4": "name = input(\"Введите ваше имя \")\nprint(\"Добрый день,\", n... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Volume(bt.Strategy):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Volume(bt.Strategy):
<|reserved_special_token_0|>
def __init__(self):
self.my... | flexible | {
"blob_id": "acbe9a9501c6a8532249496f327c2470c1d2f8e0",
"index": 898,
"step-1": "<mask token>\n\n\nclass Volume(bt.Strategy):\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Volume(bt.Strategy):\n <mask token>\n\n def __init__(self):\n self.mysignal = s... | [
1,
2,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
db.users.create_index([('names', pymongo.ASCENDING)])
<|reserved_special_token_1|>
<|reserved_special_token_0|>
MyClient = MongoClient()
db = MyClient.mydatabase
users = db.users
db.users.create_index([('names', pymongo.ASCENDI... | flexible | {
"blob_id": "31f302775ef19a07137622ef9d33495cc2a8eed2",
"index": 5775,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndb.users.create_index([('names', pymongo.ASCENDING)])\n",
"step-3": "<mask token>\nMyClient = MongoClient()\ndb = MyClient.mydatabase\nusers = db.users\ndb.users.create_index([('names',... | [
0,
1,
2,
3,
4
] |
from __future__ import division
rates = { "GBP-EUR":1.10, "EUR-USD":1.11, "GBP-USD":1.22, "GBP-YEN": 129.36 }
def find(rates, fx):
try:
return rates[fx]
except:
return -1
def getInputs():
amount = raw_input("Enter amount: ")
firstCurrency = raw_input("Enter Currency To Convert From: ")
secCurrency = raw_in... | normal | {
"blob_id": "c664257d64b269002964ce95c05f132e563a65d4",
"index": 8736,
"step-1": "from __future__ import division\n\nrates = { \"GBP-EUR\":1.10, \"EUR-USD\":1.11, \"GBP-USD\":1.22, \"GBP-YEN\": 129.36 }\n\ndef find(rates, fx):\n\ttry:\n\t\treturn rates[fx]\n\texcept:\n\t\treturn -1\n\n\ndef getInputs():\n\tamoun... | [
0
] |
import times_series_learning as tsl
import numpy as np
import time
import datetime as dt
import sortedcontainers
import pandas as pd
from collections import defaultdict
class ServerProfileLearning(object):
def __init__(self, data, parameters, distribution, distribution_period, level_threshold,
p... | normal | {
"blob_id": "53dd753356d8a8d60975c8f4cdaf20de66c2db46",
"index": 3486,
"step-1": "<mask token>\n\n\nclass ServerProfileLearning(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def process_distance(self, streaming_data):\n t0 = time.time()\n cluster_name = sel... | [
2,
3,
4,
5,
8
] |
<|reserved_special_token_0|>
@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST' and 'photo' in request.files:
filename = photos.save(request.files['photo'])
file_url = photos.url(filename)
path, label, element = model(file_url)
result = []
... | flexible | {
"blob_id": "93d0d73d56b04bba505265958fccff229f5eaf49",
"index": 872,
"step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef upload_file():\n if request.method == 'POST' and 'photo' in request.files:\n filename = photos.save(request.files['photo'])\n file_url = photos.url(fil... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def application(environ, start_response):
"""AJAX scripts for email templates."""
request = DRequest(environ)
resp = None
try:
Db.start_transaction()
form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ)
args = form['args'].value
... | flexible | {
"blob_id": "be58862b66708c9de8cf7642c9de52ec744b079e",
"index": 805,
"step-1": "<mask token>\n\n\ndef application(environ, start_response):\n \"\"\"AJAX scripts for email templates.\"\"\"\n request = DRequest(environ)\n resp = None\n try:\n Db.start_transaction()\n form = cgi.FieldStor... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class HtmlDownload(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class HtmlDownload(object):
<|reserved_special_token_0|>
def html_download(city, keyWords, pages):
paras = {'jl': ci... | flexible | {
"blob_id": "e33aca56e4c9f82779278e836308c2e22d3356e2",
"index": 3770,
"step-1": "<mask token>\n",
"step-2": "class HtmlDownload(object):\n <mask token>\n <mask token>\n",
"step-3": "class HtmlDownload(object):\n <mask token>\n\n def html_download(city, keyWords, pages):\n paras = {'jl': c... | [
0,
1,
2,
3,
4
] |
class SlackEvent:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@property
def time_stamp(self):
pass
@property
def channel(self):
pass
<|reserved_special_token_0|>
@property
def event_tim... | flexible | {
"blob_id": "4a4745f202275e45fd78c12431e355fd59ac964a",
"index": 6722,
"step-1": "class SlackEvent:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def time_stamp(self):\n pass\n\n @property\n def channel(self):\n pass\n <mask token>\n\n @pr... | [
8,
10,
15,
17,
20
] |
# dealing with the packet fragments and their reconsttruction
import logging
# shut up scapy
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
conf.verb=0
from collections import OrderedDict
pkt_frag_loads = OrderedDict()
def get_load(pkt):
ack = str(pkt[TCP].ack)
seq = str... | normal | {
"blob_id": "3e0bc91b81d0f503b78c9ac685b05b7ecb754e28",
"index": 3460,
"step-1": "<mask token>\n\n\ndef get_load(pkt):\n ack = str(pkt[TCP].ack)\n seq = str(pkt[TCP].seq)\n src_ip_port = str(pkt[IP].src) + ':' + str(pkt[TCP].sport)\n dst_ip_port = str(pkt[IP].dst) + ':' + str(pkt[TCP].dport)\n loa... | [
3,
4,
5,
6,
7
] |
from flask import render_template, request, redirect, url_for, send_file
from flask_app import app
import re
import os
from werkzeug.utils import secure_filename
import numpy as np
import cv2 as cv
from flask_mail import Message, Mail
file_path_file = open('flask_app/file_path.txt', 'r')
vars = file_path_file.readline... | normal | {
"blob_id": "e30aaf1616a107662924da3671b179a1887974f7",
"index": 2404,
"step-1": "<mask token>\n\n\ndef get_req_var(var):\n result = 0\n for s in vars:\n s = re.search('((?<=' + var + '>).+)', s)\n if s:\n result = s[0]\n break\n return result\n\n\n<mask token>\n\n\n@... | [
7,
8,
10,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def get_value(li, row, column):
if row < 0 or column < 0:
return 0
try:
return li[row][column]
except IndexError:
return 0
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def get_value(li, row, column):
i... | flexible | {
"blob_id": "badbfdbdeb8b4fd40b1c44bf7dcff6457a0c8795",
"index": 7162,
"step-1": "<mask token>\n",
"step-2": "def get_value(li, row, column):\n if row < 0 or column < 0:\n return 0\n try:\n return li[row][column]\n except IndexError:\n return 0\n\n\n<mask token>\n",
"step-3": "d... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class BaseStrategy(BaseConsumer):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
@abstractmethod
def calculate_signals(self):
"""Provide the mechanism to calculate a list of signals"""
raise NotImplementedError('Should implement calculate_signal... | flexible | {
"blob_id": "76d166bc227986863db77aa784be3de8110437ff",
"index": 530,
"step-1": "<mask token>\n\n\nclass BaseStrategy(BaseConsumer):\n <mask token>\n <mask token>\n\n @abstractmethod\n def calculate_signals(self):\n \"\"\"Provide the mechanism to calculate a list of signals\"\"\"\n rais... | [
18,
19,
28,
30,
32
] |
<|reserved_special_token_0|>
class OptbenchRun(MeasurementSource):
def __init__(self, optbench_scenario: str, query: int):
self._executor: Optional[Executor] = None
self._optbench_scenario = optbench_scenario
self._query = query
<|reserved_special_token_0|>
<|reserved_special_token_... | flexible | {
"blob_id": "97ca134ffce404f4b2bc7352d4aac73a7bb764bd",
"index": 5708,
"step-1": "<mask token>\n\n\nclass OptbenchRun(MeasurementSource):\n\n def __init__(self, optbench_scenario: str, query: int):\n self._executor: Optional[Executor] = None\n self._optbench_scenario = optbench_scenario\n ... | [
7,
9,
12,
13,
14
] |
'''
swea 2806 N-Queen
'''
def nqueen(depth, n, history):
global cnt
if depth == n:
cnt += 1
else:
for i in range(n):
if i not in history:
for index, value in enumerate(history):
if abs(depth - index) == abs(i - value):
b... | normal | {
"blob_id": "b35686f7feec2c4a905007f3c105b6fa05b87297",
"index": 5365,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef nqueen(depth, n, history):\n global cnt\n if depth == n:\n cnt += 1\n else:\n for i in range(n):\n if i not in history:\n for inde... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [(... | flexible | {
"blob_id": "6670295241516664e30c7db5cd3b5e2fb6c4fb05",
"index": 1985,
"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 = [('app', '0005... | [
0,
1,
2,
3,
4
] |
from types import *
class Tokenizer:
def __init__(self, buf):
self.buf = buf
self.index = 0
def token(self):
return self.buf[self.index]
def move(self, value):
self.index += value
def skip_whitespaces(self):
while self.index < len(self.buf) and self.token().... | normal | {
"blob_id": "282bccf20cfb114e31c5465c110819796bf81bc0",
"index": 9318,
"step-1": "<mask token>\n\n\nclass Tokenizer:\n\n def __init__(self, buf):\n self.buf = buf\n self.index = 0\n <mask token>\n <mask token>\n\n def skip_whitespaces(self):\n while self.index < len(self.buf) and... | [
4,
5,
6,
7,
8
] |
#!/usr/bin/env python3
import collections
import glob
import os
import pandas as pd
import numpy as np
import torch.nn.functional as F
import PIL.Image as Image
from inference.base_image_utils import get_scale_size, image2batch, choose_center_full_size_crop_params
from inference.metrics.fid.fid_score import _compute_... | normal | {
"blob_id": "f6846bfc6c4d803cedaf37e079e01188733938c7",
"index": 8249,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef calc_optical_flow_metrics(flow_predictor, frames, movable_mask):\n if not movable_mask.any():\n return dict(flow_l2=float('nan'))\n assert not (frames < 0).any() and ... | [
0,
4,
5,
6,
7
] |
#
# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | normal | {
"blob_id": "a38a5010c9edbed0929da225b4288396bb0d814e",
"index": 6989,
"step-1": "<mask token>\n\n\nclass Lenet(nn.Module):\n <mask token>\n\n def forward(self, x):\n layer_w = self.fc2.weight\n sigma = layer_w.std().data.cpu().numpy()\n layer_w_numpy = layer_w.data.cpu().numpy()\n ... | [
2,
4,
5,
6,
7
] |
from mesa.visualization.modules import CanvasGrid
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.modules import ChartModule
from mesa.batchrunner import BatchRunner
from agentPortrayal import agent_portrayal
import metrics
from matplotlib import pyplot as plt
from Architecture... | normal | {
"blob_id": "57b51ea36e9e2a095cf7e9646db2cc400cc72b83",
"index": 1082,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n dir_path = os.path.dirname(os.path.realpath(__file__))\n if runBatch:\n fixed_params = {'width': 60, 'height': 60, 'splitSize': 1,\n '... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
conf = {'PROJECT': 'WCCIA', 'NAS_FOLDER':
'Q:\\GROUPS\\CORP_JGS_DSE\\ATI\\quotations', 'DB_SERVER': '10.0.36.129',
'DB_PORT': '34000/'}
| flexible | {
"blob_id": "fbce185671267bd70cf7b91696867b72dfcc8d5b",
"index": 1585,
"step-1": "<mask token>\n",
"step-2": "conf = {'PROJECT': 'WCCIA', 'NAS_FOLDER':\n 'Q:\\\\GROUPS\\\\CORP_JGS_DSE\\\\ATI\\\\quotations', 'DB_SERVER': '10.0.36.129',\n 'DB_PORT': '34000/'}\n",
"step-3": null,
"step-4": null,
"step... | [
0,
1
] |
import abc
try:
import cPickle as pickle
except ImportError:
import pickle
from typing import *
T = TypeVar('T')
class BaseSerializer(Generic[T]):
"""
The serializer is responsible for converting complex python data types
into primitive types that can be sent over zmq ports via msgpack.
""... | normal | {
"blob_id": "94f5fa411f8a41985caaf4eb7ab1cb4e45439405",
"index": 1524,
"step-1": "<mask token>\n\n\n@MultiSerializer.register(lambda x: True)\nclass PickleSerializer(BaseSerializer):\n <mask token>\n <mask token>\n <mask token>\n\n def deserialize(self, data):\n return pickle.loads(data)\n\n\n... | [
18,
26,
32,
33,
37
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.