code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from time import sleep import sys def cmdline(): available_commands = ['help', 'quit', 'echo', 'pbar', 'joke'] keepgoing = True while (keepgoing): typed = input("Type something. (Type 'help' for options)") words = [w for w in typed.split(" ")] command = words[0].lower() argu...
normal
{ "blob_id": "a028661f9bcaa6dfe5389cb57f31b07d7e981487", "index": 9890, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cmdline():\n available_commands = ['help', 'quit', 'echo', 'pbar', 'joke']\n keepgoing = True\n while keepgoing:\n typed = input(\"Type something. (Type 'help' for...
[ 0, 1, 2, 3, 4 ]
<|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": "0e73153d004137d374637abf70faffabf0bab1fb", "index": 9762, "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 = [('orders', '0...
[ 0, 1, 2, 3, 4 ]
from pylab import * import pandas as pd from matplotlib import pyplot import pylab from mpl_toolkits.mplot3d import Axes3D from threading import Thread from threading import Semaphore from threading import Lock from Queue import Queue sam = Semaphore(1) lck = Lock() q=Queue(10) def myFunc(z): #if z%2==0 and z>1: ...
normal
{ "blob_id": "33c0efb47e3253442b6a808c7ebffac275c19321", "index": 7763, "step-1": "from pylab import *\nimport pandas as pd\nfrom matplotlib import pyplot\nimport pylab\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom threading import Thread\nfrom threading import Semaphore\nfrom threading import Lock\nfrom Queue i...
[ 0 ]
# -*- coding: utf-8 -*- import os import time import pandas as pd file_dir = os.getcwd() # 获取当前工作目录 file_list_all = os.listdir(file_dir) # 获取目录下的所有文件名 file_list_excel = [item for item in file_list_all if ('.xlsx' in item) or ('.xls' in item)] # 清洗非excel文件 new_list = [] # 空列表用于存放下面各个清洗后的表格 for file in file_list_ex...
normal
{ "blob_id": "ea646068d48a9a4b5a578a5fb1399d83a4812b02", "index": 1134, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file in file_list_excel:\n \"\"\"遍历所有excel文件,删除空行\"\"\"\n file_path = os.path.join(file_dir, file)\n df = pd.read_excel(file_path)\n data = pd.DataFrame(df.iloc[:, :]).dro...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(url) < 1: url = 'http://py4e-data.dr-chuck.net/comments_70857.xml' <|reserved_special_token_0|> print(len(xml)) <|reserved_special_token_0|> print('Comment count:', len(lst)) <|reserved_special_token_0|> for item in lst...
flexible
{ "blob_id": "3b8c4f19e28e54e651862ec9b88b091c9faff02b", "index": 9525, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(url) < 1:\n url = 'http://py4e-data.dr-chuck.net/comments_70857.xml'\n<mask token>\nprint(len(xml))\n<mask token>\nprint('Comment count:', len(lst))\n<mask token>\nfor item in l...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: None Do not return anyt...
flexible
{ "blob_id": "8855747f58b48bedc362930662e147b1fc4ebd63", "index": 4182, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def moveZeroes(self, nums):\n \"\"\"\n :type nums: List[int]\n :rt...
[ 1, 2, 3, 4, 5 ]
from dataclasses import dataclass from models.user import User class Customer(User): def __init__(self, first_name: str, last_name: str, user_name: str, email: str, password: str): super(Customer, self).__init__(first_name, last_name, user_name, email, password) # def __str__(self): # return...
normal
{ "blob_id": "254f34c923d49374e09b579c5bc1b17b8c69c0e4", "index": 2661, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Customer(User):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Customer(User):\n\n def __init__(self, first_name: str, last_name: str, user_name: str,\n em...
[ 0, 1, 2, 3, 4 ]
import utilities import sys if __name__ == "__main__": print('I am main!') else: print(__name__) for i in range(0,6): print(i) mylist = [12, 13, 14, 13, 12] print(mylist) #Enter iterations to run [0-5] #value = -1 value = 3 while (value not in range(0,6)): try: value =...
normal
{ "blob_id": "f218f47acfb078877645de26c64e57f92dbcd953", "index": 8003, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n print('I am main!')\nelse:\n print(__name__)\nfor i in range(0, 6):\n print(i)\n<mask token>\nprint(mylist)\n<mask token>\nwhile value not in range(0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def button_click(number): current = e.get() e.delete(0, END) e.insert(0, str(current) + str(number)) def button_clear(): e.delete(0, END) def button_add(): first_number = e.get() global f_num global math math = 'addition' f_num = int(first_number) ...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RequestAnnotation: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RequestAnnotation: def schedule(self, command: str, **kwargs): response = requests.post(...
flexible
{ "blob_id": "6782761bcbf53ea5076b6dfb7de66d0e68a9f45d", "index": 3123, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RequestAnnotation:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass RequestAnnotation:\n\n def schedule(self, command: str, **kwargs):\n response = requests....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(miLista) <|reserved_special_token_0|> print(miLista) miLista.append('NuevoDato') print(miLista) <|reserved_special_token_1|> miLista = ['cadena', 21, 2.8, 'nuevo dato', 25] print(miLista) miLista[2] = 3.8 print(miLista) m...
flexible
{ "blob_id": "27ec06d084bf819383801be0351c04e7d1fc1752", "index": 5176, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(miLista)\n<mask token>\nprint(miLista)\nmiLista.append('NuevoDato')\nprint(miLista)\n", "step-3": "miLista = ['cadena', 21, 2.8, 'nuevo dato', 25]\nprint(miLista)\nmiLista[2] = 3....
[ 0, 1, 2, 3 ]
#!/usr/bin/python # Classification (U) """Program: elasticsearchrepo_create_repo.py Description: Unit testing of create_repo in elastic_class.ElasticSearchRepo class. Usage: test/unit/elastic_class/elasticsearchrepo_create_repo.py Arguments: """ # Libraries and Global Variables # St...
normal
{ "blob_id": "5c01b83634b7ae9bc691341d7432a4e59617444c", "index": 5182, "step-1": "<mask token>\n\n\nclass Elasticsearch(object):\n <mask token>\n <mask token>\n\n\nclass UnitTest(unittest.TestCase):\n \"\"\"Class: UnitTest\n\n Description: Class which is a representation of a unit testing.\n\n M...
[ 10, 12, 13, 14, 16 ]
<|reserved_special_token_0|> class RuleDST(Tracker): <|reserved_special_token_0|> def __init__(self): Tracker.__init__(self) self.state = init_state() prefix = os.path.dirname(os.path.dirname(convlab.__file__)) self.value_dict = json.load(open(prefix + '/data/multi...
flexible
{ "blob_id": "8de82d09c8a9a1c1db59b0cac9cf8dda04f35847", "index": 3335, "step-1": "<mask token>\n\n\nclass RuleDST(Tracker):\n <mask token>\n\n def __init__(self):\n Tracker.__init__(self)\n self.state = init_state()\n prefix = os.path.dirname(os.path.dirname(convlab.__file__))\n ...
[ 3, 4, 5, 6, 7 ]
from django.shortcuts import resolve_url as r from django.test import TestCase class coreGetHome(TestCase): def setUp(self): self.resp = self.client.get(r('core:core_home')) def test_template_home(self): self.assertTemplateUsed(self.resp, 'index.html') def test_200_template_home(self): ...
normal
{ "blob_id": "d20e41dd7054ff133be264bebf13e4e218710ae5", "index": 933, "step-1": "<mask token>\n\n\nclass coreGetHome(TestCase):\n <mask token>\n <mask token>\n\n def test_200_template_home(self):\n self.assertEqual(200, self.resp.status_code)\n", "step-2": "<mask token>\n\n\nclass coreGetHome(T...
[ 2, 3, 4, 5 ]
ba1466.pngMap = [ '11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111', '11111111111111111111111111111110000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111', '1111111111111111111111111111111000000...
normal
{ "blob_id": "dbefca59376e567a6116dec4e07c44b1fe301ca9", "index": 9911, "step-1": "<mask token>\n", "step-2": "ba1466.pngMap = [\n '11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111'\n ,\n '1111111111111111111111111111111000...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class MultimediaTest(BaseTestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_add_media(self): """ Tests create media """ self.login_editor() form_data = minimal_form_data() ...
flexible
{ "blob_id": "a253ab5ef80a61c3784862625cde81de4c4ef984", "index": 2094, "step-1": "<mask token>\n\n\nclass MultimediaTest(BaseTestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_add_media(self):\n \"\"\"\n Tests create media\n \"\"\"\n self.login_editor()\n...
[ 8, 9, 12, 14, 16 ]
<|reserved_special_token_0|> def bamToBed(infile, outfile): """convert bam to bed with bedtools.""" statement = 'bamToBed -i %(infile)s > %(outfile)s' % locals() E.debug("executing statement '%s'" % statement) retcode = subprocess.call(statement, cwd=os.getcwd(), shell=True) if retcode < 0: ...
flexible
{ "blob_id": "e886b88a0b7e8c06772fe8a9554cab1bfe9e94a7", "index": 7208, "step-1": "<mask token>\n\n\ndef bamToBed(infile, outfile):\n \"\"\"convert bam to bed with bedtools.\"\"\"\n statement = 'bamToBed -i %(infile)s > %(outfile)s' % locals()\n E.debug(\"executing statement '%s'\" % statement)\n retc...
[ 3, 4, 5, 6, 7 ]
A = int(input()) B = int(input()) C = int(input()) number = A * B * C num = str(number) for i in range(10): # 9를 입력해서 첨에 틀림 ! count = 0 for j in range(len(num)): if i == int(num[j]): count += 1 else: continue print(count)
normal
{ "blob_id": "b43ea8c32207bf43abc3b9b490688fde0706d876", "index": 4633, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(10):\n count = 0\n for j in range(len(num)):\n if i == int(num[j]):\n count += 1\n else:\n continue\n print(count)\n", "step-...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @register_command('sig gallery-application version show') class Show(AAZCommand): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|res...
flexible
{ "blob_id": "8197d918b86f0e38fb4320434b61aa4186853af9", "index": 1131, "step-1": "<mask token>\n\n\n@register_command('sig gallery-application version show')\nclass Show(AAZCommand):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 5, 8, 9, 10, 16 ]
<|reserved_special_token_0|> class G: pmi_vers = [] cmd_list = [] cmd_hash = {} class RE: m = None def match(pat, str, flags=0): RE.m = re.match(pat, str, flags) return RE.m def search(pat, str, flags=0): RE.m = re.search(pat, str, flags) return RE.m <|res...
flexible
{ "blob_id": "76382f353c47747ee730d83c2d3990049c4b0d98", "index": 6795, "step-1": "<mask token>\n\n\nclass G:\n pmi_vers = []\n cmd_list = []\n cmd_hash = {}\n\n\nclass RE:\n m = None\n\n def match(pat, str, flags=0):\n RE.m = re.match(pat, str, flags)\n return RE.m\n\n def search(...
[ 10, 13, 15, 18, 19 ]
from django.urls import path from .views import PostListView, PostDetailView urlpatterns = [ path('blog/', PostListView.as_view()), path('blog/<pk>/', PostDetailView.as_view()), ]
normal
{ "blob_id": "be7fb94c3c423b67aa917a34328acda5926cf78a", "index": 3133, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('blog/', PostListView.as_view()), path('blog/<pk>/',\n PostDetailView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import PostListView, Po...
[ 0, 1, 2, 3 ]
from django.apps import AppConfig class StonewallConfig(AppConfig): name = 'stonewall'
normal
{ "blob_id": "8364264851895ccabeb74fd3fab1d4f39da717f8", "index": 8398, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StonewallConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass StonewallConfig(AppConfig):\n name = 'stonewall'\n", "step-4": "from django.apps impo...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import numpy as np def gauss_seidel(relax, est, stop): """ Método iterativo de Gauss-Seidel para o sistema linear do trabalho. Onde relax é o fator de relaxação, est é o valor inicial, stop é o critério de parada, n é a quantidade de linhas do sistema e k é o nú...
normal
{ "blob_id": "51540a80c7b29dc0bbb6342ee45008108d54b6f2", "index": 714, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef gauss_seidel(relax, est, stop):\n \"\"\"\n Método iterativo de Gauss-Seidel para o sistema linear do trabalho.\n Onde relax é o fator de relaxação, est é o valor ini...
[ 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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "58b12418a2a6b1ef9b63800b89e7f0b9fffd908c", "index": 9223, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# "" # "deb_char_cont_x9875" # # def watch_edit_text(self): # execute when test edited # # logging.info("TQ : " + str(len(self.te_sql_cmd.toPlainText()))) # # logging.info("TE : " + str(len(self.cmd_last_text))) # # logging.info("LEN : " + str(self.cmd_len)) # # if len(self.te_sql_cmd.toPlainText()) < ...
normal
{ "blob_id": "f70f4f093aa64b8cd60acbb846855ca3fed13c63", "index": 4837, "step-1": "# \"\"\n# \"deb_char_cont_x9875\"\n# # def watch_edit_text(self): # execute when test edited\n# # logging.info(\"TQ : \" + str(len(self.te_sql_cmd.toPlainText())))\n# # logging.info(\"TE : \" + str(len(self.cmd_last_text))...
[ 1 ]
import sys import pygame import pygame.camera from pygame.locals import * from PIL import Image pygame.init() pygame.camera.init() camlist = pygame.camera.list_cameras() print(camlist) # images = map(Image.open, ['Test1.jpg', 'Test2.jpg', 'Test3.jpg']) # widths, heights = zip(*(i.size for i in images)) # total_wi...
normal
{ "blob_id": "aae280e049c00e70e2214662a07eee8bfa29227e", "index": 6632, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.init()\npygame.camera.init()\n<mask token>\nprint(camlist)\n", "step-3": "<mask token>\npygame.init()\npygame.camera.init()\ncamlist = pygame.camera.list_cameras()\nprint(camlist...
[ 0, 1, 2, 3, 4 ]
import struct class H264Packet: UNKNOWN_TYPE, I_HDR, P_HDR, B_HDR, I_DATA, P_DATA, B_DATA = range(7) def __init__(self, packet): self.packet = packet self.type = None self.data = None if len(packet) > 3: (self.type,) = struct.unpack('H', packet[0:2]) self.data = packet[2:] def serialize(self): r...
normal
{ "blob_id": "ff1db5981a0163df1dfb44869a3d4af2be03c10a", "index": 2745, "step-1": "<mask token>\n\n\nclass H264Packet:\n <mask token>\n\n def __init__(self, packet):\n self.packet = packet\n self.type = None\n self.data = None\n if len(packet) > 3:\n self.type, = struc...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/python3 #https://github.com/pfnet-research/chainer-gan-lib/blob/master/wgan_gp/updater.py import numpy as np import chainer import chainer.functions as F from chainer import Variable from chainer.dataset import convert class WGANUpdater(chainer.training.updaters.StandardUpdater): def __init__(self, *a...
normal
{ "blob_id": "a7099b2506de08893ca849146813505d88784895", "index": 2402, "step-1": "<mask token>\n\n\nclass WGANUpdater(chainer.training.updaters.StandardUpdater):\n\n def __init__(self, *args, **kwargs):\n self.gen, self.dis = kwargs.pop('models')\n self.n_dis = kwargs.pop('n_dis')\n self....
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def minWindow(self, s: str, t: str) ->str: char_cnt = {} for character in t: if character not in char_cnt: char_c...
flexible
{ "blob_id": "22706d7d9c04bb660c9bf0df66de89ed6bd480c2", "index": 8210, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def minWindow(self, s: str, t: str) ->str:\n char_cnt = {}\n for character in t:\n if character not in...
[ 0, 1, 2, 3 ]
''' Условие Дано два числа a и b. Выведите гипотенузу треугольника с заданными катетами. ''' import math a = int(input()) b = int(input()) print(math.sqrt(a * a + b * b))
normal
{ "blob_id": "c0348fc5f51e6f7a191fea6d0e3cb84c60b03e22", "index": 597, "step-1": "'''\nУсловие\nДано два числа a и b. Выведите гипотенузу треугольника с заданными катетами.\n'''\nimport math\na = int(input())\nb = int(input())\nprint(math.sqrt(a * a + b * b))", "step-2": null, "step-3": null, "step-4": nul...
[ 0 ]
# Generated by Django 3.2.3 on 2021-05-29 16:37 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('logi...
normal
{ "blob_id": "6285d1665bacbff746f44f42ce65981f937fff64", "index": 4189, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
from allcode.controllers.image_classifiers.image_classifier import ImageClassifier class ImageClassifierMockup(ImageClassifier): def classify_images(self, images): pass def classify_image(self, image): return {'final_class': 'dog', 'final_prob': .8}
normal
{ "blob_id": "71fb9dc9f9ac8b1cdbc6af8a859dbc211512b4d1", "index": 1675, "step-1": "<mask token>\n\n\nclass ImageClassifierMockup(ImageClassifier):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ImageClassifierMockup(ImageClassifier):\n <mask token>\n\n def classify_image(self, ...
[ 1, 2, 3, 4, 5 ]
my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam'] while 'spam' in my_order: print("I don't like spam!") my_order.remove('spam') print(my_order)
normal
{ "blob_id": "8e8629dd2d4bb601347694b18d7cb6a94880201d", "index": 8192, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 'spam' in my_order:\n print(\"I don't like spam!\")\n my_order.remove('spam')\nprint(my_order)\n", "step-3": "my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam']...
[ 0, 1, 2 ]
__author__ = 'changwoncheo' # -*- coding: utf-8 -*- import threading import logging logging.basicConfig(filename='crawl2.log',level=logging.DEBUG) class NoParsingFilter(logging.Filter): def filter(self, record): msg = record.getMessage() return not ('Starting' in msg or 'GET' in msg) logger = loggin...
normal
{ "blob_id": "a52f009a755b45f8ed653a4a0385b1eb667f2318", "index": 9797, "step-1": "__author__ = 'changwoncheo'\n# -*- coding: utf-8 -*-\nimport threading\nimport logging\nlogging.basicConfig(filename='crawl2.log',level=logging.DEBUG)\nclass NoParsingFilter(logging.Filter):\n def filter(self, record):\n ...
[ 0 ]
import VL53L1X from sensor_msgs.msg import Range class _VL53L1(): def __init__(self, address=0x29): address = int(address, 16) print("initialising sensor with address: {}".format(hex(address))) try: self.tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=address) ...
normal
{ "blob_id": "c6d9b971ab6919846807b740313d450d086ecc23", "index": 7643, "step-1": "<mask token>\n\n\nclass _VL53L1:\n <mask token>\n\n def set_range(self, rng):\n if rng < 4 and rng >= 0:\n self.tof.set_range()\n else:\n raise Exception('Invalid range: 1 - short, 2 - med,...
[ 3, 4, 5, 6, 7 ]
<|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": "3ab1de77147f6abfabeea10f2a4e85686edffd6f", "index": 2573, "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 = [('autotasks',...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 17 17:24:39 2020 @author: code """ import sys import keras import cv2 import numpy import matplotlib import skimage print('Python: {}'.format(sys.version)) print('Numpy: {}'.format(numpy.__version__)) print('Keras: {}'.format(keras.__version__)) p...
normal
{ "blob_id": "e086bebaa166abeea066fe49076f1b007858951f", "index": 7052, "step-1": "<mask token>\n\n\ndef compare_images(target, ref):\n scores = []\n scores.append(psnr(target, ref))\n scores.append(mse(target, ref))\n scores.append(ssim(target, ref, multichannel=True))\n return scores\n\n\ndef pre...
[ 3, 7, 9, 10, 12 ]
# coding=utf-8 from numpy import * """ 1 函数loadDataSet()创建了一些实验样本。 该函数返回的第一个变量是进行词条切分后的文档集合, 这些文档来自斑点犬爱好者留言 板。 这些留言文本被切分成一系列的词条集合, 标点符号从文本中去掉, loadDataSet( )函数返回的第二个 变量是一个类别标签的集合。 这里有两类, 侮辱性和非侮辱性。 这些文本的类别由人工标注, 这些标注信息用于训练程序以便自动检测侮辱性留言 """ def loadDataSet(): postingList=[['my', 'dog', 'has', 'flea', 'problems', ...
normal
{ "blob_id": "1a166a08c835caa8dd308d59227051751aff7c0f", "index": 9059, "step-1": "\n# coding=utf-8\n\nfrom numpy import *\n\n\"\"\" 1\n函数loadDataSet()创建了一些实验样本。 该函数返回的第一个变量是进行词条切分后的文档集合, 这些文档来自斑点犬爱好者留言\n板。 这些留言文本被切分成一系列的词条集合, 标点符号从文本中去掉, \nloadDataSet( )函数返回的第二个\n变量是一个类别标签的集合。 这里有两类, 侮辱性和非侮辱性。 这些文本的类别由人工标注, 这些标注...
[ 0 ]
#!/usr/bin/env python3 import sys import csv import math import collections import argparse import fileinput import lp parser = argparse.ArgumentParser(description="Takes an input of *.lp format and sets all radii to the same value") parser.add_argument("inputfile", help="if specified reads a *.lp formatted file oth...
normal
{ "blob_id": "00f62fec7f5372c5798b0ebf3f3783233360581e", "index": 2987, "step-1": "<mask token>\n\n\ndef main():\n reader = csv.reader(row for row in fileinput.input() if not row.\n startswith('#'))\n circles = lps.parse_lps(reader)\n for circle in circles:\n circle.r = R\n print(cir...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pwnlib.gdb.attach(p) <|reserved_special_token_0|> while 'You found a' not in r: r = p.recvuntil('>') p.send('AAAA\n') p.send('AAAA\n') <|reserved_special_token_0|> while 'You found a' not in r: r = p.recvuntil('>') ...
flexible
{ "blob_id": "5eb4c71869b077dac0d61072c99d801030395fc2", "index": 636, "step-1": "<mask token>\n", "step-2": "<mask token>\npwnlib.gdb.attach(p)\n<mask token>\nwhile 'You found a' not in r:\n r = p.recvuntil('>')\n p.send('AAAA\\n')\np.send('AAAA\\n')\n<mask token>\nwhile 'You found a' not in r:\n r = ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def generateComponent(m): """Creates oscillating components to be mixed""" freq = 25 * np.random.random() phase = 2 * np.pi * np.random.random() x = np.arange(m) return np.cos(x / freq - phase) ** 2 <|reserved_special_token_0|> def add_noise(Y, sigma): """Adds ...
flexible
{ "blob_id": "0edc0c2f86bda0122d4b231eed700d7a5b08ec1e", "index": 8279, "step-1": "<mask token>\n\n\ndef generateComponent(m):\n \"\"\"Creates oscillating components to be mixed\"\"\"\n freq = 25 * np.random.random()\n phase = 2 * np.pi * np.random.random()\n x = np.arange(m)\n return np.cos(x / fr...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ Package for django_static_template. """
flexible
{ "blob_id": "818623621b609d67f8f657be4ade6e3bb86a0bc5", "index": 4226, "step-1": "<mask token>\n", "step-2": "\"\"\"\r\nPackage for django_static_template.\r\n\"\"\"\r\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def searchRange(self, nums: List[int], target: int) ->List[int]: res = [-1, -1] def binary_serach(left, right, target, res): if ...
flexible
{ "blob_id": "18b82f83d3bf729eadb2bd5a766f731a2c54a93b", "index": 1607, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def searchRange(self, nums: List[int], target: int) ->List[int]:\n res = [-1, -1]\n\n def binary_serach(left, rig...
[ 0, 1, 2 ]
<|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": "1049a7d2cdc54c489af6246ec014deb63a98f96d", "index": 3951, "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 = [('levantamien...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- import os import numpy as np import tensorflow as tf from translate import datautil import seq2seq_model _buckets = [] convo_hist_limit = 1 max_source_length = 1 max_target_length = 2 flags = tf.app.flags FLAGS = flags.FLAGS tf.reset_default_graph max_train_data_size = 0 data_dir = 'datacn...
normal
{ "blob_id": "b7007778ea9dfac3af8c31d66d32d8157dc0d69b", "index": 1517, "step-1": "<mask token>\n\n\ndef getfanyiInfo():\n vocaben, rev_vocaben = datautil.initialize_vocabulary(os.path.join(\n datautil.data_dir, datautil.vocabulary_fileen))\n vocab_sizeen = len(vocaben)\n vocabch, rev_vocabch = da...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Classe(PolymorphicModel): <|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_tok...
flexible
{ "blob_id": "c07454dfb9dabb89c86f63063231ae9cf915aa38", "index": 4116, "step-1": "<mask token>\n\n\nclass Classe(PolymorphicModel):\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...
[ 15, 20, 23, 25, 35 ]
<|reserved_special_token_0|> def insert_returns(body): if isinstance(body[-1], ast.Expr): body[-1] = ast.Return(body[-1].value) ast.fix_missing_locations(body[-1]) if isinstance(body[-1], ast.If): insert_returns(body[-1].body) insert_returns(body[-1].orelse) if isinstance(b...
flexible
{ "blob_id": "4f9729e396e01cb3d6c9011f79a1ebe618a8e762", "index": 7787, "step-1": "<mask token>\n\n\ndef insert_returns(body):\n if isinstance(body[-1], ast.Expr):\n body[-1] = ast.Return(body[-1].value)\n ast.fix_missing_locations(body[-1])\n if isinstance(body[-1], ast.If):\n insert_r...
[ 1, 3, 4, 5, 6 ]
#! /usr/bin/python import glo print glo.x a = "hello world" print id(a) a = "ni hao" print id(a) for y in range(0, 5, 2): print y for y in 1, 2, 3: print y if (glo.x == 2): print("a==2") else: print("a!=2") tuple_name = ("name", "age", "school") #can't modify, only-read list_name = ["boy", "girl...
normal
{ "blob_id": "17326597d0597d16717c87c9bdf8733fb3acb77b", "index": 7943, "step-1": "#! /usr/bin/python\n\nimport glo\nprint glo.x\n\na = \"hello world\"\nprint id(a)\n\na = \"ni hao\"\nprint id(a)\n\nfor y in range(0, 5, 2):\n print y\n\nfor y in 1, 2, 3:\n print y\n\nif (glo.x == 2):\n print(\"a==2\")\ne...
[ 0 ]
"""Stencil based grid operations in 2D.""" from .advection_flux_2d import gen_advection_flux_conservative_eno3_pyst_kernel_2d from .advection_timestep_2d import ( gen_advection_timestep_euler_forward_conservative_eno3_pyst_kernel_2d, ) from .brinkmann_penalise_2d import ( gen_brinkmann_penalise_pyst_kernel_2d, ...
normal
{ "blob_id": "2dddee735e23e8cdb7df83f47f63926727cf8963", "index": 2731, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .advection_flux_2d import gen_advection_flux_conservative_eno3_pyst_kernel_2d\nfrom .advection_timestep_2d import gen_advection_timestep_euler_forward_conservative_eno3_pyst_kernel_2...
[ 0, 1, 2 ]
class Box: def __init__(self, id, capacity): self.id = id self.dogs = [] self.capacity = capacity <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Box: def __init__(self, id, capacity): self...
flexible
{ "blob_id": "5f24c5a21dc151e9efbbfaff0fe1e71e65d1eb67", "index": 1590, "step-1": "class Box:\n\n def __init__(self, id, capacity):\n self.id = id\n self.dogs = []\n self.capacity = capacity\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Box:\n\n def __init...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> DotExporter(webtest).to_picture('webtest.png') <|reserved_special_token_1|> <|reserved_special_token_0|> webtest = Node('WebappTest') registration = Node('Registration', parent=webtest) smsconfirm = Node('SMSconfirm', parent=re...
flexible
{ "blob_id": "33ac328b2bf16380b50c58013bd0d4d888dc3952", "index": 4693, "step-1": "<mask token>\n", "step-2": "<mask token>\nDotExporter(webtest).to_picture('webtest.png')\n", "step-3": "<mask token>\nwebtest = Node('WebappTest')\nregistration = Node('Registration', parent=webtest)\nsmsconfirm = Node('SMSconf...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RBox: def __init__(self): self.x = 0 self.y = 0 self.w = 0 self.h = 0 @staticmethod def fromClassicalBoundingBox(box): rbox = RBox() rbox.x = box[0] rbox.y = box[1] rbox.w = box[2] rbox.h = box[3] ...
flexible
{ "blob_id": "f3895f38be29fb07903237d8846cc9d657b39ea9", "index": 6495, "step-1": "<mask token>\n\n\nclass RBox:\n\n def __init__(self):\n self.x = 0\n self.y = 0\n self.w = 0\n self.h = 0\n\n @staticmethod\n def fromClassicalBoundingBox(box):\n rbox = RBox()\n r...
[ 23, 26, 28, 37, 41 ]
<|reserved_special_token_0|> def read_list_int(): return list(map(int, sys.stdin.readline().strip().split(' '))) <|reserved_special_token_0|> def selection_sort(nums, k): sorted_index = 0 while True: minimum = 9999999999 min_index = 0 for i, n in enumerate(nums[sorted_index:], ...
flexible
{ "blob_id": "f4ab6df8efc334fa338ade7deecd36d8cd859e96", "index": 4174, "step-1": "<mask token>\n\n\ndef read_list_int():\n return list(map(int, sys.stdin.readline().strip().split(' ')))\n\n\n<mask token>\n\n\ndef selection_sort(nums, k):\n sorted_index = 0\n while True:\n minimum = 9999999999\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class BertPretrainingDataLayer(DataLayerNM): <|reserved_special_token_0|> def __init__(self, *, tokenizer, dataset, name, max_seq_length, sentence_indices_filename=None, mask_probability=0.15, **kwargs): DataLayerNM.__init__(self, **kwargs) self._device = ...
flexible
{ "blob_id": "a47ffd5df49ec627442a491f81a117b3e68ff50b", "index": 2326, "step-1": "<mask token>\n\n\nclass BertPretrainingDataLayer(DataLayerNM):\n <mask token>\n\n def __init__(self, *, tokenizer, dataset, name, max_seq_length,\n sentence_indices_filename=None, mask_probability=0.15, **kwargs):\n ...
[ 4, 5, 6, 7, 8 ]
from django.utils.text import slugify from pyexpat import model from django.db import models # Create your models here. from rest_framework_simplejwt.state import User FREQUENCY = ( ('daily', 'Diario'), ('weekly', 'Semanal'), ('monthly', 'Mensual') ) class Tags(models.Model): name = models.CharField(m...
normal
{ "blob_id": "71503282e58f60e0936a5236edc094f1da937422", "index": 6565, "step-1": "<mask token>\n\n\nclass Tags(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = '-created_at',\n\n\nclass Newsletter(m...
[ 5, 7, 8, 10, 11 ]
from typing import List import pandas as pd import numpy as np import pickle from catboost import CatBoostRegressor from sklearn.preprocessing import MinMaxScaler def calculate_probable_age(usersEducationFeatures): prob_age = {} grads_count = {} age_diff1 = 17 # age difference for school ...
normal
{ "blob_id": "ee0ed255b6851696dc57c01100cd67f5f959cf01", "index": 7437, "step-1": "<mask token>\n\n\ndef get_prob_age(uids, prob_age) ->List[int]:\n res = [0] * len(uids)\n for i, uid in enumerate(uids):\n res[i] = prob_age.setdefault(uid, 0)\n return res\n\n\ndef get_grads_count(uids, grads_count...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .login import LoginTask from .tag_search import TagSearchTask from .timeline import TimelineTask from .get_follower import GetFollowerTask from .followback import FollowBackTask from .unfollow import UnFollowTask
flexible
{ "blob_id": "e899b093152ee0923f1e5ad3b5719bbf9eb4339c", "index": 7466, "step-1": "<mask token>\n", "step-2": "from .login import LoginTask\nfrom .tag_search import TagSearchTask\nfrom .timeline import TimelineTask\nfrom .get_follower import GetFollowerTask\nfrom .followback import FollowBackTask\nfrom .unfollo...
[ 0, 1 ]
# processing functions for diagrams import torch import numpy as np def remove_filler(dgm, val=np.inf): """ remove filler rows from diagram """ inds = (dgm[:,0] != val) return dgm[inds,:] def remove_zero_bars(dgm): """ remove zero bars from diagram """ inds = dgm...
normal
{ "blob_id": "ac459bff6d4281ce07b70dbccde3243412ddb414", "index": 3155, "step-1": "<mask token>\n\n\ndef remove_zero_bars(dgm):\n \"\"\"\n remove zero bars from diagram\n \"\"\"\n inds = dgm[:, 0] != dgm[:, 1]\n return dgm[inds, :]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef remove_fil...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def move(x, y, step, angle=0): nx = x + step * math.cos(angle) ny = y - step * math.sin(angle) return nx, ny <|reserved_special_token_0|> def enroll(name, gender, age=6, city='Beijing'): print('name:', name) print('gender', gender) print('age', age) print('...
flexible
{ "blob_id": "8a6eb2eb746e3b9de92998b70ddff2a39cb1f269", "index": 6374, "step-1": "<mask token>\n\n\ndef move(x, y, step, angle=0):\n nx = x + step * math.cos(angle)\n ny = y - step * math.sin(angle)\n return nx, ny\n\n\n<mask token>\n\n\ndef enroll(name, gender, age=6, city='Beijing'):\n print('name:...
[ 9, 14, 15, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for n in range(1, T + 1): N = int(input()) arr = [list(map(int, list(input()))) for _ in range(N)] a = N // 2 b = N // 2 result = 0 for i in range(N): for j in range(a, b + 1): result +=...
flexible
{ "blob_id": "2236591b3a30f51442beb20c6c43cc9e6cd921d2", "index": 7530, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(1, T + 1):\n N = int(input())\n arr = [list(map(int, list(input()))) for _ in range(N)]\n a = N // 2\n b = N // 2\n result = 0\n for i in range(N):\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SignUpForm(UserCreationForm): """ Sign up form fetching form the User creation form and the email and password is necessary not the user """ class Meta: model = User fields = 'email', 'password1', 'password2' <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "7c3569c43d27ba605c0dba420690e18d7f849965", "index": 7372, "step-1": "<mask token>\n\n\nclass SignUpForm(UserCreationForm):\n \"\"\" Sign up form fetching form the User creation form\n and the email and password is necessary not the user \"\"\"\n\n\n class Meta:\n model = User\n ...
[ 2, 3, 4, 5, 6 ]
"""SamsungTV Encrypted.""" import aiohttp from aioresponses import aioresponses import pytest from yarl import URL from samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator @pytest.mark.asyncio async def test_authenticator(aioresponse: aioresponses) -> None: with open("tests/fixtures...
normal
{ "blob_id": "e1448e62020f87e315d219be97d9af84607441df", "index": 9104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.asyncio\nasync def test_authenticator(aioresponse: aioresponses) ->None:\n with open('tests/fixtures/auth_pin_status.xml') as file:\n aioresponse.get('http://1....
[ 0, 1, 2, 3 ]
from simulating_blobs_of_fluid.simulation import Simulation from simulating_blobs_of_fluid.fluid_renderer import FluidRenderer import arcade def main(): simulation = Simulation(particle_count=50, dt=0.016, box_width=250) FluidRenderer(simulation.box_width, 800, simulation) arcade.run() if __name__ == ...
normal
{ "blob_id": "83733e707a1be131335c4980cdf4beed365eb530", "index": 6011, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n simulation = Simulation(particle_count=50, dt=0.016, box_width=250)\n FluidRenderer(simulation.box_width, 800, simulation)\n arcade.run()\n\n\n<mask token>\n", ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DataResource(resources.ModelResource): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: fields = 'groupname', 'system_name', 'I6000' class DataAdmin(ImportExportMixin, admin.ModelAdmin): list_display =...
flexible
{ "blob_id": "016b64a2eb4af3034d54272c878fb917506d330c", "index": 648, "step-1": "<mask token>\n\n\nclass DataResource(resources.ModelResource):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n fields = 'groupname', 'system_name', 'I6000'\n\n\nclass DataAdmin(ImportExportMixin, ...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import chainer.links as L import chainer.functions as F from chainer import optimizer, optimizers, training, iterators from chainer.training import extensions from chainer.datasets import tuple_dataset class SoftMaxTrainer(): def __init__(self, net): self.model = L.Classifier(net)...
normal
{ "blob_id": "474700968e563d34d6a0296ec62950e2e71fe1b0", "index": 1671, "step-1": "<mask token>\n\n\nclass SoftMaxTrainer:\n\n def __init__(self, net):\n self.model = L.Classifier(net)\n\n def set_train_data(self, train_x, train_t, valid_x, valid_t, n_batch):\n train = tuple_dataset.TupleDatas...
[ 4, 5, 6, 7, 8 ]
""" All requests will be sent to backend as: { name: <class name>, data: { <all instance variables> } } """ class NewDriver: def __init__(self, uri, authToken): self.uri = uri self.authorizationToken = authToken class DriverClose: def __init__(self...
normal
{ "blob_id": "dfcb095b26a21ba0c8ccc2a2c664bcfab29b8351", "index": 8214, "step-1": "<mask token>\n\n\nclass SessionRun:\n\n def __init__(self, sessionId, cypher, params):\n self.sessionId = sessionId\n self.cypher = cypher\n self.params = params\n\n\nclass SessionReadTransaction:\n\n def...
[ 14, 16, 17, 19, 23 ]
from django.contrib import admin from xchanger.models import Currency, Rates, UpdateInfo class CurrencyAdmin(admin.ModelAdmin): pass class UpdAdmin(admin.ModelAdmin): pass class RatesAdmin(admin.ModelAdmin): list_filter = ['c_code_id', 'upd_id'] admin.site.register(Currency, CurrencyAdmin) admin.sit...
normal
{ "blob_id": "20ccdd319bfbbb4f17e8518eb60d125112c05d8e", "index": 6828, "step-1": "<mask token>\n\n\nclass RatesAdmin(admin.ModelAdmin):\n list_filter = ['c_code_id', 'upd_id']\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass CurrencyAdmin(admin.ModelAdmin):\n pass\n\n\nclass UpdAdmin(admin.ModelA...
[ 2, 4, 5, 6 ]
# DO NOT EDIT THIS FILE! # # Python module managedElementManager generated by omniidl import omniORB omniORB.updateModule("managedElementManager") # ** 1. Stub files contributing to this module import managedElementManager_idl # ** 2. Sub-modules # ** 3. End
normal
{ "blob_id": "7727896d4e1b2b415c398b206f9fb7e228e6f26d", "index": 8602, "step-1": "<mask token>\n", "step-2": "<mask token>\nomniORB.updateModule('managedElementManager')\n<mask token>\n", "step-3": "import omniORB\nomniORB.updateModule('managedElementManager')\nimport managedElementManager_idl\n", "step-4"...
[ 0, 1, 2, 3 ]
from django.db import models from django.contrib.auth.models import User from django.db.models.deletion import CASCADE class Profile(models.Model): user = models.OneToOneField(User, on_delete=CASCADE) # portfolio = models.ManyToOneRel(User, on_delete=) def __str__(self): return f"{self.user.user...
normal
{ "blob_id": "51ff1181f0ddac3a8f7cbd9f9d2eedae29a6c559", "index": 6654, "step-1": "<mask token>\n\n\nclass Profile(models.Model):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Profile(models.Model):\n <mask token>\n\n def __str__(self):\n return f'{self.user.username} P...
[ 1, 2, 3, 4, 5 ]
#!/g/kreshuk/lukoianov/miniconda3/envs/inferno/bin/python3 # BASIC IMPORTS import argparse import os import subprocess import sys import numpy as np # INTERNAL IMPORTS from src.datasets import CentriollesDatasetOn, CentriollesDatasetBags, GENdataset from src.utils import get_basic_transforms, log_info, get_resps_tran...
normal
{ "blob_id": "604c94e50b1fb9b5e451c4432113498410a4ac1f", "index": 5262, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description=\n 'Run learning of simple CNN implementation')\n parser.add_argument('--model_name', type=str, defa...
[ 0, 1, 2, 3 ]
from app import create_app from app.config import Config app = create_app(Config) if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=True)
normal
{ "blob_id": "bea90bbcd4d34b64c21f022b6f3af2bee2d978e4", "index": 1123, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run(host='0.0.0.0', port=5000, debug=True)\n", "step-3": "<mask token>\napp = create_app(Config)\nif __name__ == '__main__':\n app.run(host='0.0.0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'user' urlpatterns = [url('^$', views.index, name='index'), url('login/', views. login, name='login'), url('regist/', views.regist, name='regist'), url( '^getuser\\w*/(?P<id>\\d*)', views.getUserById, name='getu...
flexible
{ "blob_id": "de7b5e44c5c213e4ab70b0f8c0c402edaf4926e0", "index": 211, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'user'\nurlpatterns = [url('^$', views.index, name='index'), url('login/', views.\n login, name='login'), url('regist/', views.regist, name='regist'), url(\n '^getuser\\\\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Main: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def func(): pass class Main: def __init__(self): pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_spe...
flexible
{ "blob_id": "797cedc9dc2a47713b9554e4f5975a4505ecf6d3", "index": 9568, "step-1": "<mask token>\n\n\nclass Main:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func():\n pass\n\n\nclass Main:\n\n def __init__(self):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\...
[ 1, 3, 4, 5, 6 ]
<|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": "fd52379d125d6215fe12b6e01aa568949511549d", "index": 6964, "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 = [('products', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __version__ = 'alph 1.0' <|reserved_special_token_1|> __version__ = "alph 1.0"
flexible
{ "blob_id": "2c4eb07a32c6903ae31006f42c13c55e6cc42eb5", "index": 5245, "step-1": "<mask token>\n", "step-2": "__version__ = 'alph 1.0'\n", "step-3": "__version__ = \"alph 1.0\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^stats/$', views.get_stats, name='stats'), url(r'^follow/me/$', views.follow_me, name='follow_me'), url(r'^follower/confirm/$', views.confirm_follower, name='follower_confirm'), url(r'^execute/', views.execute, name='executed')...
normal
{ "blob_id": "33b68246dd3da9561c1d4adb5a3403cba656dcee", "index": 9175, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^stats/$', views.get_stats, name='stats'), url(\n '^follow/me/$', views.follow_me, name='follow_me'), url(\n '^follower/confirm/$', views.confirm_follower, name=...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> async def consumer(queue, name): while True: val = await queue.get() print(f"{name} get a val: {val} at {time.strftime('%X')}") await asyncio.sleep(1) async def producer(queue, name): for i in r...
flexible
{ "blob_id": "e1172e2d9f20e56241829b3e4ccb4bcf6b5440be", "index": 9233, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def consumer(queue, name):\n while True:\n val = await queue.get()\n print(f\"{name} get a val: {val} at {time.strftime('%X')}\")\n await asyncio.sleep(1...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @ecdsa_app.get('/create_pkey') def private_key(): return {'status': 'success', 'result': sk.to_string().hex()} @ecdsa_app.post('/op') def check_op(): input = request.get_json() operators = ['+', '-', '*', '/', '**', '//', '%'] finaloutput = {} if input['data']['op'] ...
flexible
{ "blob_id": "4eb7abb24451f3f895d0731de7b29a85d90c1539", "index": 8246, "step-1": "<mask token>\n\n\n@ecdsa_app.get('/create_pkey')\ndef private_key():\n return {'status': 'success', 'result': sk.to_string().hex()}\n\n\n@ecdsa_app.post('/op')\ndef check_op():\n input = request.get_json()\n operators = ['...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def read_summary(summary_file): return json.loads(open(summary_file, 'r').read()) def get_descriptions(summary): d = {} for o in summary['ontology_events']: print(o) d[o] = summary['ontology_events'][o].get('description', summary[ 'ontology_events...
flexible
{ "blob_id": "7036ae5f74e6cb04518c20bb52122a1dfae76f23", "index": 712, "step-1": "<mask token>\n\n\ndef read_summary(summary_file):\n return json.loads(open(summary_file, 'r').read())\n\n\ndef get_descriptions(summary):\n d = {}\n for o in summary['ontology_events']:\n print(o)\n d[o] = sum...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Staff(commands.Cog): <|reserved_special_token_0|> @commands.command(name='stop', aliases=['shutdown'], description= 'This is a command for staff only to stop the bot') @is_owner() async def stop_bot(self, ctx): """Shutdown the bot""" await ct...
flexible
{ "blob_id": "23b2cc5b561a11ae7757a281a141491d5b7e23ca", "index": 2683, "step-1": "<mask token>\n\n\nclass Staff(commands.Cog):\n <mask token>\n\n @commands.command(name='stop', aliases=['shutdown'], description=\n 'This is a command for staff only to stop the bot')\n @is_owner()\n async def st...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(a) <|reserved_special_token_0|> print(b) <|reserved_special_token_0|> print(c) print(19 - 1) <|reserved_special_token_0|> print(d) <|reserved_special_token_0|> print(e) <|reserved_special_token_0|> print(f) <|reserved_specia...
flexible
{ "blob_id": "d28f5f95b375a1e075fdfcbc0350c90cf96f0212", "index": 9694, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\n<mask token>\nprint(b)\n<mask token>\nprint(c)\nprint(19 - 1)\n<mask token>\nprint(d)\n<mask token>\nprint(e)\n<mask token>\nprint(f)\n<mask token>\nprint(g)\n<mask token>\nprin...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def increment(number): number += 1 return number <|reserved_special_token_0|> <|reserved_special_token_1|> x = 10 def increment(number): number += 1 return number x = increment(x) <|reserved_special_to...
flexible
{ "blob_id": "a0460b100a750b685f3e831a19379b0e26da4b35", "index": 7368, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef increment(number):\n number += 1\n return number\n\n\n<mask token>\n", "step-3": "x = 10\n\n\ndef increment(number):\n number += 1\n return number\n\n\nx = increment...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: print( """ Welcome to HMS 1. Are you want enter data 2. Are you want see record 3. exit """ ) option = int(input('enter your option')) print(option) ...
flexible
{ "blob_id": "5c5a0fd67a6d6e805b77ddfddfe959335daa3bad", "index": 6383, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n print(\n \"\"\" Welcome to HMS\n 1. Are you want enter data\n 2. Are you want see record\n 3. exit\n \"\"\"\n )\n opti...
[ 0, 1, 2, 3, 4 ]
from flask_table import Table, Col """Lets suppose that we have a class that we get an iterable of from somewhere, such as a database. We can declare a table that pulls out the relevant entries, escapes them and displays them. """ class Item(object): def __init__(self, name, category): self.name = name...
normal
{ "blob_id": "3191fa5f9c50993d17e12e4e2e9d56cfce2108e7", "index": 5646, "step-1": "<mask token>\n\n\nclass Item(object):\n\n def __init__(self, name, category):\n self.name = name\n self.category = category\n\n\nclass Category(object):\n\n def __init__(self, name):\n self.name = name\n\...
[ 6, 7, 8, 9, 10 ]
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: Nirvana # # Created: 07/06/2014 # Copyright: (c) Nirvana 2014 # Licence: <your licence> #------------------------------------------------------------------------------- import r...
normal
{ "blob_id": "eb246beb05249f5dfde019b773698ba3bb1b1118", "index": 544, "step-1": "<mask token>\n\n\nclass Coin(object):\n\n def __init__(self):\n self.sideup = 'Heads'\n\n def toss(self):\n if random.randint(0, 1) == 0:\n self.sideup = 'Heads'\n else:\n self.sideup...
[ 4, 5, 6, 7, 8 ]
"""Changed Views table name Revision ID: 7f559bb24ca4 Revises: cc927fe47c8f Create Date: 2021-08-20 23:20:31.959984 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "7f559bb24ca4" down_revision = "cc927fe47c8f" branch_labels = None depends_on = None def upgrade...
normal
{ "blob_id": "fd2b60de2ef540264855f04e1c5bcb9d1cf23c51", "index": 9561, "step-1": "<mask token>\n\n\ndef upgrade():\n op.create_table('views', sa.Column('id', sa.Integer(), autoincrement=\n True, nullable=False), sa.Column('url_id', sa.String(length=31),\n nullable=True), sa.ForeignKeyConstraint(...
[ 1, 2, 3, 4, 5 ]
from HDPython import * import HDPython.examples as ahe from enum import Enum, auto class counter_state(Enum): idle = auto() running = auto() done = auto() class Counter_cl(v_class_master): def __init__(self): super().__init__() self.counter = v_variable(v_slv(32)) self.cou...
normal
{ "blob_id": "046db03b146ce0182ba7889908f536a09de051d5", "index": 5069, "step-1": "<mask token>\n\n\nclass Counter_cl(v_class_master):\n\n def __init__(self):\n super().__init__()\n self.counter = v_variable(v_slv(32))\n self.counter_max = v_variable(v_slv(32))\n self.state = v_vari...
[ 7, 8, 9, 12, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @nox.session(python=['3.9', '3.8', '3.7', '3.6'], venv_backend='conda', venv_params=['--use-local']) def test(session): """Add tests """ session.install() session.run('pytest') <|reserved_special_token_0|> ...
flexible
{ "blob_id": "9aecf297ed36784d69e2be6fada31f7c1ac37500", "index": 4778, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@nox.session(python=['3.9', '3.8', '3.7', '3.6'], venv_backend='conda',\n venv_params=['--use-local'])\ndef test(session):\n \"\"\"Add tests\n \"\"\"\n session.install()\n...
[ 0, 1, 2, 3, 4 ]
#-*- coding: utf-8 -*- s = "123" try: print(int(s) + 1) print(int(s) / 1) except ValueError as ve: print("ValueError occurs!!!", ve) except ZeroDivisionError as e: print("ValueError occurs!!!", e) except : print("Error occurs!!!") else: print("elseeeeeeeeeeeeeee") finally: print("ABCDE...
normal
{ "blob_id": "1bf79319613ca1454f3a9ed21068bd899616395c", "index": 624, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n print(int(s) + 1)\n print(int(s) / 1)\nexcept ValueError as ve:\n print('ValueError occurs!!!', ve)\nexcept ZeroDivisionError as e:\n print('ValueError occurs!!!', e)\ne...
[ 0, 1, 2, 3 ]
class Vehicle(object): count_list = [] def __init__(self, registration_number): self.registration_number = registration_number Vehicle.count_list.append(self) Vehicle.count = len(Vehicle.count_list)
normal
{ "blob_id": "8b9336113f64a88eeabe6e45021938fac9efd1c6", "index": 6442, "step-1": "<mask token>\n", "step-2": "class Vehicle(object):\n <mask token>\n <mask token>\n", "step-3": "class Vehicle(object):\n <mask token>\n\n def __init__(self, registration_number):\n self.registration_number = ...
[ 0, 1, 2, 3 ]
import argparse import glob import importlib import inspect import math import os import re import subprocess import sys import moviepy.audio.fx.all as afx import moviepy.video.fx.all as vfx import numpy as np from _appmanager import get_executable from _shutil import format_time, get_time_str, getch, print2 from movi...
normal
{ "blob_id": "9e21a39358d97633b49ad83805990c29c19a80ed", "index": 8599, "step-1": "<mask token>\n\n\ndef _update_mpy_clip(clip, subclip, speed, frame, norm, loop, duration, pos,\n scale, vol, **kwargs):\n assert duration is not None\n if subclip is not None:\n if isinstance(subclip, (int, float)):...
[ 8, 9, 10, 12, 15 ]
<|reserved_special_token_0|> class NewProjectWindow(boring.dialog.DefaultDialog): def __init__(self, master, _dict=None): self._dict = _dict self.output = None boring.dialog.DefaultDialog.__init__(self, master) <|reserved_special_token_0|> def apply(self): """ cal...
flexible
{ "blob_id": "76420ec1b37d4b9b85f35764a7f8a0e1f19a15dd", "index": 5745, "step-1": "<mask token>\n\n\nclass NewProjectWindow(boring.dialog.DefaultDialog):\n\n def __init__(self, master, _dict=None):\n self._dict = _dict\n self.output = None\n boring.dialog.DefaultDialog.__init__(self, maste...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): env = gym.make('Pendulum-v0') log_dir = 'log/pendulum' agent = DDPG(env, sigma=0.2, num_episodes=250, buffer_size=1000000, batch_size=64, tau=0.001, batch_norm=False, merge_layer=0) agent.trai...
flexible
{ "blob_id": "153e7e66e2b796d011b78aed102d30e37bb0b80f", "index": 1374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n env = gym.make('Pendulum-v0')\n log_dir = 'log/pendulum'\n agent = DDPG(env, sigma=0.2, num_episodes=250, buffer_size=1000000,\n batch_size=64, tau=0.001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def gen_sig(): """@brief return the MD5 checksum """ return hashlib.md5((app.config['ROVI_API_KEY'] + app.config[ 'ROVI_SHARED_SECRET'] + repr(int(time.time()))).encode('utf-8') ).hexdigest() def get_track_image(artist, album): """@brief get the track image f...
flexible
{ "blob_id": "86f33895e9ae0e026d7d6e40e611796b2dc2c713", "index": 8394, "step-1": "<mask token>\n\n\ndef gen_sig():\n \"\"\"@brief return the MD5 checksum \"\"\"\n return hashlib.md5((app.config['ROVI_API_KEY'] + app.config[\n 'ROVI_SHARED_SECRET'] + repr(int(time.time()))).encode('utf-8')\n )...
[ 16, 17, 18, 20, 23 ]
<|reserved_special_token_0|> def create_test_file(filename): with open(filename, 'w') as f: f.write('foobar') <|reserved_special_token_0|> def main(): parser = argparse.ArgumentParser(description='Filling In The Gaps program') parser.add_argument('-d', '--dir', help='Directory path.', dest= ...
flexible
{ "blob_id": "db684185c2b0a26cb101dc40090c84b64c554eeb", "index": 2595, "step-1": "<mask token>\n\n\ndef create_test_file(filename):\n with open(filename, 'w') as f:\n f.write('foobar')\n\n\n<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(description='Filling In The Gaps program')\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # 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 o...
normal
{ "blob_id": "e7ef8debbff20cb178a3870b9618cbb0652af5af", "index": 1626, "step-1": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the Lice...
[ 0 ]
<|reserved_special_token_0|> @app.route('/') def index(): return '2018/6/1 hello python' @app.route('/news') def news(): return '内蒙古新闻资讯,请选择浏览' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def index(): return '2018/6/1 hello python' @app...
flexible
{ "blob_id": "f9d8280d765826b05bfa7989645e487431799f85", "index": 7809, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return '2018/6/1 hello python'\n\n\n@app.route('/news')\ndef news():\n return '内蒙古新闻资讯,请选择浏览'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index()...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def control(q): gs = np.array([pi / 2, 0, 0, 0]) return -k.dot(q - gs) def reward_fn(s, a): reward = np.sin(s[0]) + 2 * np.sin(s[0] + s[1]) done = reward < 2 return reward, done def do_rollout(args): x, trial_num = args th1, th2, dth1, dth2 = x np.rando...
flexible
{ "blob_id": "358d4573ff386d6874d5bb5decfe71c71141bf1c", "index": 2525, "step-1": "<mask token>\n\n\ndef control(q):\n gs = np.array([pi / 2, 0, 0, 0])\n return -k.dot(q - gs)\n\n\ndef reward_fn(s, a):\n reward = np.sin(s[0]) + 2 * np.sin(s[0] + s[1])\n done = reward < 2\n return reward, done\n\n\n...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Facility(models.Model): facility_id = models.IntegerField(primary_key=True) facility_name = models.CharField(max_length=50) facility_description = models.CharField(max_length=100, blank=True, null=True) project = models.ForeignKey('Project', models.DO_NOTHING...
flexible
{ "blob_id": "2783fc24806c323ab4ac44fbac55eef73142ab80", "index": 7710, "step-1": "<mask token>\n\n\nclass Facility(models.Model):\n facility_id = models.IntegerField(primary_key=True)\n facility_name = models.CharField(max_length=50)\n facility_description = models.CharField(max_length=100, blank=True,\...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TestIetAdmDriver(tf.TargetDriverFixture): <|reserved_special_token_0|> def test_get_target(self): tmp_file = six.StringIO() tmp_file.write( """tid:1 name:iqn.2010-10.org.openstack:volume-83c2e877-feed-46be-8435-77884fe55b45 sid:8444270312...
flexible
{ "blob_id": "932502c93dd7dfc095adfe2ab88b4404396d9845", "index": 8680, "step-1": "<mask token>\n\n\nclass TestIetAdmDriver(tf.TargetDriverFixture):\n <mask token>\n\n def test_get_target(self):\n tmp_file = six.StringIO()\n tmp_file.write(\n \"\"\"tid:1 name:iqn.2010-10.org.opensta...
[ 3, 7, 8, 9, 12 ]