code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
class Wspak: <|reserved_special_token_0|> def __init__(self, data): self.data = data self.index = -2 self.i = len(data) - 1 <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Wspak: """Iterator zwrac...
flexible
{ "blob_id": "ea1d62c4a8c406dde9bb138ee045be5e682fdbfe", "index": 566, "step-1": "class Wspak:\n <mask token>\n\n def __init__(self, data):\n self.data = data\n self.index = -2\n self.i = len(data) - 1\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Wspak:\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TestDictGroupBy(unittest.TestCase): def setUp(self): random.seed(0) self.sut = dict_groupby <|reserved_special_token_0|> def generate_facility(self): num_transactions = random.randint(1, 3) transactions = {} outstanding = 0 ...
flexible
{ "blob_id": "f8e6f6e1be6c4ea306b7770c918b97808a0765b2", "index": 6580, "step-1": "<mask token>\n\n\nclass TestDictGroupBy(unittest.TestCase):\n\n def setUp(self):\n random.seed(0)\n self.sut = dict_groupby\n <mask token>\n\n def generate_facility(self):\n num_transactions = random.r...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class SimulatorInfo(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class SimulatorInfo(object): def __init__(self, name=None, device_type=None, sdk=None, device_id= None, sim_id=None): self.name = name s...
flexible
{ "blob_id": "9b94e8aed2b0be2771a38cf2d1cf391772f3a9f0", "index": 6478, "step-1": "<mask token>\n", "step-2": "class SimulatorInfo(object):\n <mask token>\n", "step-3": "class SimulatorInfo(object):\n\n def __init__(self, name=None, device_type=None, sdk=None, device_id=\n None, sim_id=None):\n ...
[ 0, 1, 2 ]
from collections import defaultdict, deque N = int(input()) adj_list = defaultdict(list) E = [] V_number = [None] * N for _ in range(N - 1): a, b = map(int, input().split()) E.append((a, b)) adj_list[a].append(b) adj_list[b].append(a) C = sorted(list(map(int, input().split())), reverse=True) q = deque([...
normal
{ "blob_id": "b93f6c3192f8dd58b96dfdc6ea2b17e12cce34d0", "index": 9752, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(N - 1):\n a, b = map(int, input().split())\n E.append((a, b))\n adj_list[a].append(b)\n adj_list[b].append(a)\n<mask token>\nwhile q:\n v = q.popleft()\n ...
[ 0, 1, 2, 3 ]
# PDE: # add_library('hype') # processing.py: from hype.core.util import H from hype.core.interfaces import HCallback from hype.extended.behavior import HOscillator from hype.extended.drawable import HCanvas, HRect from hype.extended.layout import HGridLayout from hype.extended.util import HDrawablePool from random im...
normal
{ "blob_id": "b8a41c56a31acab0181ec364f76010ac12119074", "index": 5489, "step-1": "<mask token>\n\n\nclass Callback(HCallback):\n\n def __init__(self):\n pass\n\n @staticmethod\n def run(drawable):\n drawable.anchorAt(H.CENTER).fill(choice([color1, color2]))\n HOscillator().target(dr...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def contador_notas(multiplo, numero): if numero % multiplo == 0: notas = numero / multiplo return notas else: return -1 <|reserved_special_token_0|> <|reserved_special_token_1|> def contador_notas(multiplo, numero): if...
flexible
{ "blob_id": "a5c19ad60ac6312631273858cebaae944a2008ec", "index": 8876, "step-1": "<mask token>\n", "step-2": "def contador_notas(multiplo, numero):\n if numero % multiplo == 0:\n notas = numero / multiplo\n return notas\n else:\n return -1\n\n\n<mask token>\n", "step-3": "def conta...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Handler(object): <|reserved_special_token_0|> def get_rsp_from_url(self, url, params=None, method='get', data=None): logging.warning( 'when using method {}, header is:\n {} \n data is: \n{}.\n'. format(method, self.coffee_session.headers, dat...
flexible
{ "blob_id": "00228facd19c72bebd9afbbe52597e390233d41e", "index": 5822, "step-1": "<mask token>\n\n\nclass Handler(object):\n <mask token>\n\n def get_rsp_from_url(self, url, params=None, method='get', data=None):\n logging.warning(\n 'when using method {}, header is:\\n {} \\n data is: \\...
[ 4, 6, 8, 9, 10 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # groupby() # groupby()把迭代器中相邻的重复元素挑出来放在一起: import itertools for key, group in itertools.groupby('ABAABBBCCAAA'): print(key, list(group)) # 小结 # itertools模块提供的全部是处理迭代功能的函数,它们的返回值不是list,而是Iterator,只有用for循环迭代的时候才真正计算。
normal
{ "blob_id": "b5568e84e19719f0fd72197ead47bd050e09f55d", "index": 7310, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key, group in itertools.groupby('ABAABBBCCAAA'):\n print(key, list(group))\n", "step-3": "import itertools\nfor key, group in itertools.groupby('ABAABBBCCAAA'):\n print(key, l...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('files_with_extensions.txt', 'w', encoding='utf-8') as filewrite: for r, d, f in os.walk(startPath): for file in f: if file.endswith(extension0) or file.endswith(extension1 ) or fi...
flexible
{ "blob_id": "d287123acdbabdd5a223e774c89945ab888fcbcc", "index": 5439, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('files_with_extensions.txt', 'w', encoding='utf-8') as filewrite:\n for r, d, f in os.walk(startPath):\n for file in f:\n if file.endswith(extension0) or fi...
[ 0, 1, 2, 3, 4 ]
def long_alpha(str1): list1 = [] list2 = "" maxi = 0 j = 0 for i in range(len(str1)): if i == 0: list2 += str1[i] elif ord(str1[i - 1]) <= ord(str1[i]): list2 += str1[i] else: list1.append(list2) list2 = "" ...
normal
{ "blob_id": "e7c18fa99c801fd959c868954f020d8c55babe0d", "index": 7543, "step-1": "<mask token>\n", "step-2": "def long_alpha(str1):\n list1 = []\n list2 = ''\n maxi = 0\n j = 0\n for i in range(len(str1)):\n if i == 0:\n list2 += str1[i]\n elif ord(str1[i - 1]) <= ord(st...
[ 0, 1, 2, 3, 4 ]
<|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) <|reserved_special_token_0|> print(d) <|reserved_special_token_1|> a = len('Karen') print(a) b = 'Rainha Elizabeth'.count('a') print(b) c = 'k...
flexible
{ "blob_id": "3079fdbe6319454ad166d06bda5670554a5746ee", "index": 1004, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\n<mask token>\nprint(b)\n<mask token>\nprint(c)\n<mask token>\nprint(d)\n", "step-3": "a = len('Karen')\nprint(a)\nb = 'Rainha Elizabeth'.count('a')\nprint(b)\nc = 'karen nayar...
[ 0, 1, 2, 3 ]
import math import datetime import numpy as np import matplotlib.pyplot as plt def draw_chat( id, smooth_id, main_mode, my_name, chat_day_data, main_plot, pie_plot, list_chats_plot): min_in_day = 1440 possible_smooth = [1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, ...
normal
{ "blob_id": "b297a09ee19bb8069eb65eb085903b3219c6fe5a", "index": 7971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef draw_chat(id, smooth_id, main_mode, my_name, chat_day_data, main_plot,\n pie_plot, list_chats_plot):\n min_in_day = 1440\n possible_smooth = [1, 2, 3, 4, 5, 6, 8, 9, 10, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def run_Simulation2(k, N=100, T=10, start=1, p=0.5, q=0.08, startcenter= False, startcorner=False): """ run the simulation for the pop """ recover = [0] infect = [start] suspect = [N - start] pop = [Person() for i in range(N)] for i in range(start): ...
flexible
{ "blob_id": "92317996f884befd646138cd3a3dc3f8345679f4", "index": 2122, "step-1": "<mask token>\n\n\ndef run_Simulation2(k, N=100, T=10, start=1, p=0.5, q=0.08, startcenter=\n False, startcorner=False):\n \"\"\"\n run the simulation for the pop\n \"\"\"\n recover = [0]\n infect = [start]\n su...
[ 3, 4, 5, 6, 7 ]
from math import gcd from random import randint, choice task = """6. Реализовать алгоритм построения ПСП методом Фиббоначи с запаздываниями. Обосновать выбор коэффициентов алгоритма. Для начального заполнения использовать стандартную линейную конгруэнтную ПСП с выбранным периодом. Реализовать возможность для пользоват...
normal
{ "blob_id": "11e9d25c30c8c9945cfa3c234ffa1aab98d1869e", "index": 8023, "step-1": "<mask token>\n\n\ndef factor(n):\n result = []\n d = 2\n while d * d <= n:\n if n % d == 0:\n result.append(d)\n n //= d\n else:\n d += 1\n if n > 1:\n result.append...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def extraLongFactorials(n): print(math.factorial(n)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def extraLongFactorials(n): print(math.factorial(n)) if __name__ == '__...
flexible
{ "blob_id": "5c1ce46f45da33acf75a7f47add811b14d58414d", "index": 1169, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef extraLongFactorials(n):\n print(math.factorial(n))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef extraLongFactorials(n):\n print(math.factorial(n))\n\n\nif __name...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render from django.contrib import messages from django.views.generic import View from django.views.decorators.http import require_GET, require_POST from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse,HttpResponsePermanentRedirect,HttpResponseRedirect ...
normal
{ "blob_id": "11952e60ab95bc1896fd899a5ced126dcafec63a", "index": 9882, "step-1": "<mask token>\n\n\n@require_GET\ndef Follow(request, shorturl):\n link = get_object_or_404(Link, shorturl=shorturl)\n link.vi += 1\n print(link.vi)\n link.save()\n return HttpResponseRedirect(link.link)\n\n\ndef FormV...
[ 2, 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": "5e4a334b373d912ba37b18f95e4866450bda5570", "index": 3938, "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 = [('usuarios', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TasksSerializer(serializers.ModelSerializer): <|reserved_special_token_0|> class Meta: model = Tasks fields = ['id', 'created', 'title', 'description', 'status', 'user'] <|reserved_special_token...
flexible
{ "blob_id": "3fa1736fd87448ec0da4649153521d0aba048ccf", "index": 3689, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TasksSerializer(serializers.ModelSerializer):\n <mask token>\n\n\n class Meta:\n model = Tasks\n fields = ['id', 'created', 'title', 'description', 'status',...
[ 0, 1, 2, 3 ]
# First, we'll import pandas, a data processing and CSV file I/O library import pandas as pd # We'll also import seaborn, a Python graphing library import warnings # current version of seaborn generates a bunch of warnings that we'll ignore warnings.filterwarnings("ignore") import seaborn as sns import matplotlib.py...
normal
{ "blob_id": "0125abab0312d8f007e76ee710348efc9daae31e", "index": 4989, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings('ignore')\n<mask token>\nsns.set(style='white', color_codes=True)\n<mask token>\nsns.boxplot(x='Species', y='PetalLengthCm', data=iris)\nplt.show()\n", "step-3":...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Pan(games.Sprite): <|reserved_special_token_0|> def update(self): """ Move to mouse coordinates """ self.x = games.mouse.x self.check_collide() <|reserved_special_token_0|> class Pizza(games.Sprite): def update(self): global SCORE ...
flexible
{ "blob_id": "ee16b91ce1c12ce78d23ff655304aebc39cb1639", "index": 9693, "step-1": "<mask token>\n\n\nclass Pan(games.Sprite):\n <mask token>\n\n def update(self):\n \"\"\" Move to mouse coordinates \"\"\"\n self.x = games.mouse.x\n self.check_collide()\n <mask token>\n\n\nclass Pizza...
[ 7, 9, 10, 13, 14 ]
<|reserved_special_token_0|> class ServiceMap(Base): <|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": "a9e0659c6a18ffc954079845b7d0de04c46a78c9", "index": 7204, "step-1": "<mask token>\n\n\nclass ServiceMap(Base):\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 <mas...
[ 9, 10, 11, 13, 14 ]
"""Test the various means of instantiating and invoking filters.""" import types import test test.prefer_parent_path() import cherrypy from cherrypy import filters from cherrypy.filters.basefilter import BaseFilter class AccessFilter(BaseFilter): def before_request_body(self): if not cherrypy.confi...
normal
{ "blob_id": "8a412231c13df1b364b6e2a27549730d06048186", "index": 9978, "step-1": "<mask token>\n\n\nclass AccessFilter(BaseFilter):\n <mask token>\n\n\n<mask token>\n\n\nclass FilterTests(helper.CPWebCase):\n\n def testCPFilterList(self):\n self.getPage('/cpfilterlist/')\n self.assertBody('A ...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while x < 13: print(n, ' x ', x, ' = ', n * x) x = x + 1 <|reserved_special_token_1|> n = int(input('Enter any int number:\n')) x = 1 while x < 13: print(n, ' x ', x, ' = ', n * x) x = x + 1 <|reserved_special...
flexible
{ "blob_id": "a6c07146f1cbc766cd464dab620d1fb075759c12", "index": 4213, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile x < 13:\n print(n, ' x ', x, ' = ', n * x)\n x = x + 1\n", "step-3": "n = int(input('Enter any int number:\\n'))\nx = 1\nwhile x < 13:\n print(n, ' x ', x, ' = ', n * x)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Cif: def get_chain(self): return [chain for chain in list(self.structure.get_models())[0] if chain.get_id() == self.chain_id][0] def get_seq_from_pdb(self): seq_from_pdb = seq1(''.join([residue.get_resname() for residue in self.chai...
flexible
{ "blob_id": "ad5cdcfd9d7a3c07abcdcb701422f3c0fdc2b374", "index": 8860, "step-1": "<mask token>\n\n\nclass Cif:\n\n def get_chain(self):\n return [chain for chain in list(self.structure.get_models())[0] if \n chain.get_id() == self.chain_id][0]\n\n def get_seq_from_pdb(self):\n seq_...
[ 4, 6, 7, 9, 10 ]
../testing.py
normal
{ "blob_id": "616ff35f818130ebf54bd33f67df79857cd45965", "index": 6952, "step-1": "../testing.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> class Detailedreservation(RetrieveUpdateDestroyAPIView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ListReservation(ListCreateAPIView): <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "d437d77d5a57a6f2f4a2d530be05c3845dce93bc", "index": 1459, "step-1": "<mask token>\n\n\nclass Detailedreservation(RetrieveUpdateDestroyAPIView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ListReservation(ListCreateAPIView):\n <mask token>\n <mask token>\n\n\ncl...
[ 1, 7, 13, 14, 16 ]
from turtle import * def drawSquare(): for i in range(4): forward(100) left(90) if __name__ == '__main__': drawSquare() up() forward(200) down() drawSquare() mainloop()
normal
{ "blob_id": "1ce5b97148885950983e39b7e99d0cdfafe4bc16", "index": 5382, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef drawSquare():\n for i in range(4):\n forward(100)\n left(90)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef drawSquare():\n for i in range(4):\n ...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.7 on 2020-07-05 07:34 from django.db import migrations, models import location_field.models.plain class Migration(migrations.Migration): dependencies = [ ('driver', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='driver', ...
normal
{ "blob_id": "ea918bdf96572b38461dc1810bd0b8c16efd0f0d", "index": 5786, "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 = [('driver', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> decoded_image.set_shape([height, width, channels]) <|reserved_special_token_0|> with tf.Session() as sess: tf.initialize_all_variables().run() coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(sess=...
flexible
{ "blob_id": "1685a2c49bea14e6fcaffb03634f6875f8fa1049", "index": 3726, "step-1": "<mask token>\n", "step-2": "<mask token>\ndecoded_image.set_shape([height, width, channels])\n<mask token>\nwith tf.Session() as sess:\n tf.initialize_all_variables().run()\n coord = tf.train.Coordinator()\n threads = tf...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> c.translate(inch, inch) c.setFont('Helvetica', 80) c.setStrokeColorRGB(0.2, 0.5, 0.3) c.setFillColorRGB(1, 0, 1) c.rect(inch, inch, 6 * inch, 9 * inch, fill=1) c.rotate(90) c.setFillColorRGB(0, 0, 0.77) c.drawString(6 * inch, -6 *...
flexible
{ "blob_id": "7d6e8e6142184a1540daa29dac802fe75bd93d8e", "index": 4428, "step-1": "<mask token>\n", "step-2": "<mask token>\nc.translate(inch, inch)\nc.setFont('Helvetica', 80)\nc.setStrokeColorRGB(0.2, 0.5, 0.3)\nc.setFillColorRGB(1, 0, 1)\nc.rect(inch, inch, 6 * inch, 9 * inch, fill=1)\nc.rotate(90)\nc.setFil...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def buildTree(self, inorder, postorder): """ :type inorder: Lis...
flexible
{ "blob_id": "b59dfd97a2b52ddef4e37557ea96bff9edf34989", "index": 1342, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution(object):\n\n def buildTree(self, inorder, postorder):\n \"\"\"\n :type ino...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Mon Apr 16 21:26:03 2018 @author: Brandon """os.getcwd() Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'os' is not definimport os >>> os.getcwd() 'C:\\Users\\Brandon\\AppData\\Local\\Programs\\Python\\Python36-32' >>> os.chdir() Tracebac...
normal
{ "blob_id": "dc97703d39e7db29e0ba333c2797f4be6d015fd7", "index": 7886, "step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Apr 16 21:26:03 2018\n\n@author: Brandon\n\"\"\"os.getcwd()\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nNameError: name 'os' is not definimport os\n>...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def excel_table_byindex(file='D:\\基金公司\\数据库-制表符\\资产组合-基金公司维度.xlsx', colnameindex=0, by_index=0): data = open_excel(file='D:\\基金公司\\数据库-制表符\\资产组合-基金公司维度.xlsx') table = data.sheets()[by_index] nrows = table.nrows ...
flexible
{ "blob_id": "d211594a034489d36a5648bf0b926fbd734fd0df", "index": 6928, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef excel_table_byindex(file='D:\\\\基金公司\\\\数据库-制表符\\\\资产组合-基金公司维度.xlsx',\n colnameindex=0, by_index=0):\n data = open_excel(file='D:\\\\基金公司\\\\数据库-制表符\\\\资产组合-基金公司维度.xlsx')\n ...
[ 0, 1, 2, 3, 4 ]
#usage: exploit.py print "-----------------------------------------------------------------------" print ' [PoC 2] MS Visual Basic Enterprise Ed. 6 SP6 ".dsr" File Handling BoF\n' print " author: shinnai" print " mail: shinnai[at]autistici[dot]org" print " site: http://shinnai.altervista.org\n" print " Once you create...
normal
{ "blob_id": "40a73ceeeb310c490fe2467511966679a1afa92b", "index": 9585, "step-1": "#usage: exploit.py\n\nprint \"-----------------------------------------------------------------------\"\nprint ' [PoC 2] MS Visual Basic Enterprise Ed. 6 SP6 \".dsr\" File Handling BoF\\n'\nprint \" author: shinnai\"\nprint \" mail...
[ 0 ]
<|reserved_special_token_0|> def worker(server, commands): output = {} output['server'] = server session = sgc.Ssh(server=server) if session.ping == 'Alive': session.connect() if session.connection == False: output['commands'] = session.connection_error else: ...
flexible
{ "blob_id": "ace7e5676fcb01c3542952eaacdada9963b8467a", "index": 5168, "step-1": "<mask token>\n\n\ndef worker(server, commands):\n output = {}\n output['server'] = server\n session = sgc.Ssh(server=server)\n if session.ping == 'Alive':\n session.connect()\n if session.connection == Fal...
[ 1, 2, 3, 4, 5 ]
from flask_admin.contrib.sqla import ModelView from flask_admin import Admin from flask import abort import flask_login import logging from .models import User, sendUserMail, db as userdb from .box_models import Box, Image, db as boxdb from .box_queue import BoxQueue logger = logging.getLogger('labboxmain') class Au...
normal
{ "blob_id": "3f86227afd60be560ac3d4ce2bee1f6cf74a744d", "index": 3509, "step-1": "<mask token>\n\n\nclass UserModel(AuthModel):\n <mask token>\n <mask token>\n\n def on_model_change(self, form, model, is_created):\n if is_created:\n logger.warning('[Admin] Create for ' + model.email)\n...
[ 2, 6, 7, 8, 9 ]
aminotable = [ ['Ile' , 'AUU','AUC','AUA'], #0 ['Leu' , 'CUU','CUC','CUA','CUG','UUA','UUG'], #1 ['Val' , 'GUU','GUC','GUA','GUG'], #2 ['Phe' , 'UUU','UUC'], #3 ['Met' , 'AUG'], ...
normal
{ "blob_id": "d5a31e53444e2efa2eb972f1152b6d3e37d5ab79", "index": 5321, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Original sequence: ', sequence, '\\n')\n<mask token>\nprint('Amino Sequence: ')\nwhile n < seqlength:\n codon = sequence[n:n + 3]\n for amino in aminotable:\n for i in...
[ 0, 1, 2, 3 ]
from collections import namedtuple from weakref import ref l = list() _l = list() # Point = namedtuple('Point', ['x', 'y']) class Point: def __init__(self,x,y): self.x = x self.y = y def callback(ref): print ('__del__', ref) for x in range(10): p = Point(x,x**2) t = ref(p,callback)...
normal
{ "blob_id": "2542998c3a7decd6329856a31d8e9de56f82bae1", "index": 3922, "step-1": "<mask token>\n\n\nclass Point:\n\n def __init__(self, x, y):\n self.x = x\n self.y = y\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Point:\n\n def __init__(self, x, y):\n self.x = x\n ...
[ 2, 3, 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": "8e8c72362dfb1587150aadaa6b8a0aeb77c3641a", "index": 1516, "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 = [('blog', '000...
[ 0, 1, 2, 3, 4 ]
import requests import json import pandas as pd n1 = 'ADS' api_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1 df = pd.read_csv(api_url) df = df.head(100) print(df.head()) #print(list(data))
normal
{ "blob_id": "3dd4b4d4241e588cf44230891f496bafb30c6153", "index": 46, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(df.head())\n", "step-3": "<mask token>\nn1 = 'ADS'\napi_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1\ndf = pd.read_csv(api_url)\ndf = df.head(100)\nprint(df.head(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 from datetime import datetime import re import sys MONTHS_REGEXP = ('Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|' 'January|February|March|April|June|July|August|September|October|November|December') re_entry_begin = re.compile(r'(?P<version>[\d.]+)[ :]*\(?(?P<date>\d\d\d\d...
normal
{ "blob_id": "03677f02473019fcc6a40d91569a85be78ca0a87", "index": 7179, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n m = re_entry_begin.match(line)\n if m:\n if first_line_met:\n sys.stdout.write(signature_format.format(date=current_date))\n versio...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> siswa_1 = Siswa('Afif', 'A.I.', 17, 'XII IPA') siswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_4 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_5 = Siswa('Bayu', 'Sudra...
flexible
{ "blob_id": "bd2c327915c1e133a6e7b7a46290369440d50347", "index": 3876, "step-1": "<mask token>\n", "step-2": "<mask token>\nsiswa_1 = Siswa('Afif', 'A.I.', 17, 'XII IPA')\nsiswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_4 = Siswa('Bayu', 'Sudrajat',...
[ 0, 1, 2, 3 ]
i = 0 real_value = 8 while i <= 3: guess = int(input('Guess: ')) if guess == real_value: print('You Win!') break else: print('You lose')
normal
{ "blob_id": "70f2fc6873a78305c74e3c3ad04cb24d72019d56", "index": 8738, "step-1": "i = 0\nreal_value = 8\nwhile i <= 3:\n guess = int(input('Guess: '))\n if guess == real_value:\n print('You Win!')\n break\n else:\n print('You lose')\n \n", "step-2": null, "step-3": null, "step-4": null, "st...
[ 0 ]
<|reserved_special_token_0|> def problem_args(problem_name): args = ['--generate_data', '--model=transformer', '--hparams_set=transformer_librispeech_v1', '--problem=%s' % problem_name, '--data_dir=/tmp/refactor_test/problems/%s/data' % problem_name, '--tmp_dir=/tmp/refactor_test/problems/...
flexible
{ "blob_id": "cc5ad95419571d3eb2689b428e5805ad69958806", "index": 4796, "step-1": "<mask token>\n\n\ndef problem_args(problem_name):\n args = ['--generate_data', '--model=transformer',\n '--hparams_set=transformer_librispeech_v1', '--problem=%s' %\n problem_name, '--data_dir=/tmp/refactor_test/pr...
[ 1, 2, 3, 4, 5 ]
print ("Hello"*5)
normal
{ "blob_id": "9ae7b6d081529a5c70b7362c852647b3638e7e98", "index": 8105, "step-1": "<mask token>\n", "step-2": "print('Hello' * 5)\n", "step-3": "print (\"Hello\"*5)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import unittest import BasicVmLifecycleTestBase class testVmIsAccessibleViaSsh(BasicVmLifecycleTestBase. VmIsAccessibleViaSshTestBase): vmName = 'cernvm' timeout = 20 * 60 sshTimeout = 5 * 60 def suite(): return unittest.TestLoader().loadTestsFromTestCase(testVmIsAccessibleViaSsh )
normal
{ "blob_id": "79e4e37fc17462508abf259e3a7861bd76797280", "index": 9182, "step-1": "<mask token>\n\n\nclass testVmIsAccessibleViaSsh(BasicVmLifecycleTestBase.\n VmIsAccessibleViaSshTestBase):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass testVmI...
[ 1, 2, 3, 4 ]
""" 复习 面向对象:考虑问题从对象的角度出发. 抽象:从多个事物中,舍弃个别的/非本质的特征(不重要), 抽出共性的本质(重要的)过程。 三大特征: 封装:将每个变化点单独分解到不同的类中。 例如:老张开车去东北 做法:定义人类,定义车类。 继承:重用现有类的功能和概念,并在此基础上进行扩展。 统一概念 例如:图形管理器,统计圆形/矩形.....面积。 ...
normal
{ "blob_id": "2749a262bf8da99aa340e878c15a6dba01acc38c", "index": 7025, "step-1": "<mask token>\n", "step-2": "\"\"\"\n 复习\n 面向对象:考虑问题从对象的角度出发.\n 抽象:从多个事物中,舍弃个别的/非本质的特征(不重要),\n 抽出共性的本质(重要的)过程。\n 三大特征:\n 封装:将每个变化点单独分解到不同的类中。\n 例如:老张开车去东北\n ...
[ 0, 1 ]
class people: <|reserved_special_token_0|> def add_purchase(self, purchase): self.purchases.append(purchase) def add_description(self, description): self.purchase_descrip.append(description) <|reserved_special_token_0|> <|reserved_special_token_0|> def set_total(self): ...
flexible
{ "blob_id": "bdda42665acfefccad45a2b49f5436a186140579", "index": 8576, "step-1": "class people:\n <mask token>\n\n def add_purchase(self, purchase):\n self.purchases.append(purchase)\n\n def add_description(self, description):\n self.purchase_descrip.append(description)\n <mask token>\n...
[ 13, 18, 20, 22, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': run() <|reserved_special_token_1|> from ..src.script import run if __name__ == '__main__': run() <|reserved_special_token_1|> # 只放置可执行文件 # # from ..src import package # data_dict = package....
flexible
{ "blob_id": "4f870e0d86d9f9b8c620115a618ea32abc24c52d", "index": 3008, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n run()\n", "step-3": "from ..src.script import run\nif __name__ == '__main__':\n run()\n", "step-4": "# 只放置可执行文件\n#\n# from ..src import package\n# d...
[ 0, 1, 2, 3 ]
from Products.CMFPlone.utils import getFSVersionTuple from bda.plone.ticketshop.interfaces import ITicketShopExtensionLayer from plone.app.robotframework.testing import MOCK_MAILHOST_FIXTURE from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting from plone.app.testing import PL...
normal
{ "blob_id": "5d7080f2778133d1938853512ca038edcf7c0dc4", "index": 1002, "step-1": "<mask token>\n\n\nclass TicketshopATLayer(PloneSandboxLayer):\n defaultBases = PLONE_FIXTURE,\n\n def setUpZope(self, app, configurationContext):\n import Products.ATContentTypes\n self.loadZCML(package=Products...
[ 4, 7, 10, 11, 14 ]
<|reserved_special_token_0|> class xCNNlow(torch.nn.Module): def __init__(self, channels, filters, kernel_size, padding=0, stride=1, groups=1, rank=1, bias=True): super(xCNNlow, self).__init__() self.filters = filters self.times = 2 self.kernel_size = kernel_size s...
flexible
{ "blob_id": "f714c7006f50379cc7508a13d710d902d38d2d1f", "index": 425, "step-1": "<mask token>\n\n\nclass xCNNlow(torch.nn.Module):\n\n def __init__(self, channels, filters, kernel_size, padding=0, stride=1,\n groups=1, rank=1, bias=True):\n super(xCNNlow, self).__init__()\n self.filters =...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def save_card(word, image_path, filepath='data/cards/', filename=None): """Функция для генерации и сохранения изображения Возвращает filepath+filename Параметры: word - слово, чей контент будет на карточке ...
flexible
{ "blob_id": "6bf1d410a33e3b2535e39e4f8c5c7f8278b3de67", "index": 330, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save_card(word, image_path, filepath='data/cards/', filename=None):\n \"\"\"Функция для генерации и сохранения изображения\n Возвращает filepath+filename\n \n Параметры...
[ 0, 1, 2, 3, 4 ]
n = int(input()) m = int(input()) x = int(input()) y = int(input()) if m < n: if m - x < x: x = m - x if n - y < y: y = n - y else: if n - x < x: x = n - x if m - y < y: y = m - y if x < y: print(x) else: print(y)
normal
{ "blob_id": "002cced6d24a4790d29f195355c795d609f744a7", "index": 9134, "step-1": "<mask token>\n", "step-2": "<mask token>\nif m < n:\n if m - x < x:\n x = m - x\n if n - y < y:\n y = n - y\nelse:\n if n - x < x:\n x = n - x\n if m - y < y:\n y = m - y\nif x < y:\n pr...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class WebCommandException(SoftException): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class WebCommandException(SoftException): def __init__(self, description): su...
flexible
{ "blob_id": "0f4864b745768994ea55a931e4d8b0681c058465", "index": 2828, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass WebCommandException(SoftException):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass WebCommandException(SoftException):\n\n def __init__(self, description):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for root in rootsToAdd: for elem in root: root1.append(elem) rutas0k_10k.write('rutas/rutas0k-110k.xml') <|reserved_special_token_1|> <|reserved_special_token_0|> rutas0k_10k = ET.parse('rutas/rutas0k-10k.xml') ruta...
flexible
{ "blob_id": "b4b7e20c9558bd1b29a1c1fa24bfca8a2d292b27", "index": 398, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor root in rootsToAdd:\n for elem in root:\n root1.append(elem)\nrutas0k_10k.write('rutas/rutas0k-110k.xml')\n", "step-3": "<mask token>\nrutas0k_10k = ET.parse('rutas/rutas0k...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def generate_model(output_len, chars=None): """Generate the model""" print('Build model...') chars = chars or CHARS model = Sequential() for layer_number in range(INPUT_LAYERS): model.add(recurrent.LSTM(HIDDEN_SIZE, input_shape=(None, len(chars) ), ...
flexible
{ "blob_id": "572a098053ebae4f42cd020d1003cc18eceb6af0", "index": 4984, "step-1": "<mask token>\n\n\ndef generate_model(output_len, chars=None):\n \"\"\"Generate the model\"\"\"\n print('Build model...')\n chars = chars or CHARS\n model = Sequential()\n for layer_number in range(INPUT_LAYERS):\n ...
[ 6, 7, 8, 10, 12 ]
# Classic solution for merging two sorted arrays/list to a new one. # (Based on Merge Sort) class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ m->Size of nums1 list n->Size of nums2 list """ mergedArray = [] i = 0 ...
normal
{ "blob_id": "a732e7141ffb403ca6c5d9c4204cb96c8e831aab", "index": 6814, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) ->None:\n \"\"\"\n m->Size of nums1 list\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Rule: def __init__(self, template, alive): self.template = template self.alive = alive def parse(string): match = rule_regex.match(string) if match: template = match.group(1) alive = match.group(2) return ...
flexible
{ "blob_id": "8c683c109aba69f296b8989915b1f3b3eecd9745", "index": 4274, "step-1": "<mask token>\n\n\nclass Rule:\n\n def __init__(self, template, alive):\n self.template = template\n self.alive = alive\n\n def parse(string):\n match = rule_regex.match(string)\n if match:\n ...
[ 5, 7, 9, 10, 12 ]
# -*- coding: utf-8 -*- from LibTools.filesystem import Carpeta from slaves import SentinelSat import settings if __name__ == '__main__': carpeta = Carpeta(settings.folder_sat) sentinela = SentinelSat(carpeta) sentinela.start_Monitoring()
normal
{ "blob_id": "9e3f4484542c2629d636fcb4166584ba52bebe21", "index": 2196, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n carpeta = Carpeta(settings.folder_sat)\n sentinela = SentinelSat(carpeta)\n sentinela.start_Monitoring()\n", "step-3": "from LibTools.filesystem im...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def connect(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((exchange_hostname, port)) return s.makefile('rw', 1) def write_to_exchange(exchange, obj): json.dump(obj, exchange) exchange.write('\n') <|reserved_special_token_0|> def hello(): ...
flexible
{ "blob_id": "56c5c515de8490f2e3516563e037c375aba03667", "index": 3221, "step-1": "<mask token>\n\n\ndef connect():\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.connect((exchange_hostname, port))\n return s.makefile('rw', 1)\n\n\ndef write_to_exchange(exchange, obj):\n json.dump(obj, ex...
[ 5, 8, 9, 10, 16 ]
<|reserved_special_token_0|> class OrderVector: <|reserved_special_token_0|> def insert(self, vertex): if self.last_pos == self.size - 1: print('Capacidad max do Vector atingida') return pos = 0 for i in range(self.last_pos + 1): pos = i ...
flexible
{ "blob_id": "87291d066b94aca1d94cbe5d9281fc72da1b0c35", "index": 9483, "step-1": "<mask token>\n\n\nclass OrderVector:\n <mask token>\n\n def insert(self, vertex):\n if self.last_pos == self.size - 1:\n print('Capacidad max do Vector atingida')\n return\n pos = 0\n ...
[ 6, 7, 9, 10, 11 ]
__author__ = 'jamjiang' class Person: def __init__(self, name): self.name = name def sayHi(self): print 'hi!, I am', self.name david = Person('David') david.sayHi() Person('leo').sayHi()
normal
{ "blob_id": "fcc12b26308e3031de7e8fcf4ad43ec92279d400", "index": 5922, "step-1": "__author__ = 'jamjiang'\nclass Person:\n def __init__(self, name):\n self.name = name\n def sayHi(self):\n print 'hi!, I am', self.name\n\ndavid = Person('David')\ndavid.sayHi()\n\nPerson('leo').sayHi()\n\n"...
[ 0 ]
# python2.7 #formats for oracle lists import pyperclip text = str(pyperclip.paste()).strip() lines = text.split('\n') for i in range(len(lines)): if (i+1) < len(lines): lines[i] = str('\'')+str(lines[i]).replace("\r","").replace("\n","") + str('\',') elif (i+1) == len(lines): lines[...
normal
{ "blob_id": "454fd88af552d7a46cb39167f21d641420973959", "index": 2312, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(lines)):\n if i + 1 < len(lines):\n lines[i] = str(\"'\") + str(lines[i]).replace('\\r', '').replace('\\n', ''\n ) + str(\"',\")\n elif i + 1 ==...
[ 0, 1, 2, 3, 4 ]
'''code for recursuve binary search ''' def rbinarysearch(l, k, begin, end): if(begin == end): if(l[begin] == k): return 1 else: return 0 if(end-begin == 1): if(l[end] == k) or (l[begin] == k): return 1 else: return 0 if(end...
normal
{ "blob_id": "7171edc3eecd2f0cdebd914e89a7a7e0353ddf63", "index": 9209, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef rbinarysearch(l, k, begin, end):\n if begin == end:\n if l[begin] == k:\n return 1\n else:\n return 0\n if end - begin == 1:\n if ...
[ 0, 1, 2, 3 ]
#!/usr/bin/python from PyMca5.PyMcaGui import PyMcaQt as qt from RixsTool import mainWindow app = qt.QApplication([]) win = mainWindow.RIXSMainWindow() win.show() app.exec_()
normal
{ "blob_id": "34c8541e640596f51a5232cba06172df5814db14", "index": 7734, "step-1": "<mask token>\n", "step-2": "<mask token>\nwin.show()\napp.exec_()\n", "step-3": "<mask token>\napp = qt.QApplication([])\nwin = mainWindow.RIXSMainWindow()\nwin.show()\napp.exec_()\n", "step-4": "from PyMca5.PyMcaGui import P...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TotalReshape(Layer): def __init__(self, target_shape, **kwargs): self.target_shape = target_shape super(TotalReshape, self).__init__(**kwargs) def compute_output_shape(self, input_shape): return tuple(x if x != -1 else None for x in self.target_shap...
flexible
{ "blob_id": "0eefae7e0d341d74154bbe480f5ed766829e3ce3", "index": 3734, "step-1": "<mask token>\n\n\nclass TotalReshape(Layer):\n\n def __init__(self, target_shape, **kwargs):\n self.target_shape = target_shape\n super(TotalReshape, self).__init__(**kwargs)\n\n def compute_output_shape(self, i...
[ 17, 20, 24, 29, 31 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def clean_files(folder='.', posreg='.*[.]((py)|(rst))$', negreg= '.*[.]git/.*', op='CR', fLOG=print): """ Cleans ``\\r`` in files a folder and subfolders with a given extensions. Backslashes are replaces by ``/``...
flexible
{ "blob_id": "57972e6368aa5749edeab94e45d84f7897ca14ab", "index": 8751, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef clean_files(folder='.', posreg='.*[.]((py)|(rst))$', negreg=\n '.*[.]git/.*', op='CR', fLOG=print):\n \"\"\"\n Cleans ``\\\\r`` in files a folder and subfolders with a gi...
[ 0, 1, 2, 3, 4 ]
from django.conf.urls import url from tree import views urlpatterns = [ url('/home', views.home), url('/about', views.about), ]
normal
{ "blob_id": "3313f01ed98433f4b150c4d8e877ac09eb8403b4", "index": 5652, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('/home', views.home), url('/about', views.about)]\n", "step-3": "from django.conf.urls import url\nfrom tree import views\nurlpatterns = [url('/home', views.home), ur...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Meaning(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): if self.value is None: return '' return self.value[:20] class Meta: ...
flexible
{ "blob_id": "067e0129b1a9084bbcee28d1973504299b89afdb", "index": 8911, "step-1": "<mask token>\n\n\nclass Meaning(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n if self.value is None:\n return ''\n return self.value[:20]...
[ 13, 14, 15, 17, 19 ]
import unittest from Spreadsheet.HTML import Table class TestColGroup(unittest.TestCase): def test_colgroup(self): return data = [ ['a','b','c'], [1,2,3], [4,5,6], ] gen = Table( { 'data': data, 'colgroup': { 'span': 3, 'width': 100 }, 'attr_so...
normal
{ "blob_id": "24f87bd6aab0ff65cf2153e27df31122818ad0ac", "index": 766, "step-1": "<mask token>\n\n\nclass TestColGroup(unittest.TestCase):\n <mask token>\n\n def test_col(self):\n return\n data = [['a', 'b', 'c'], [1, 2, 3], [4, 5, 6]]\n gen = Table({'data': data, 'colgroup': {'span': 3...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def RandomString(Length): Letters = string.ascii_lowercase return ''.join(random.choice(Letters) for i in range(Length)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def RandomString(Length): Letters = string.ascii_lowercase ...
flexible
{ "blob_id": "ce11a5c2fbd6e0ea0f8ab293dc53afd07a18c25c", "index": 6160, "step-1": "<mask token>\n\n\ndef RandomString(Length):\n Letters = string.ascii_lowercase\n return ''.join(random.choice(Letters) for i in range(Length))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef RandomString(Length):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @njit(parallel=True) def parallel_test(subject_array, typeII_error, typeI_error, num): test_result = np.zeros(subject_array.shape, dtype=int) random_table = np.random.uniform(0, 1, (subject_array.shape[0], num)) for i in range(len(subject_array)): subject = subject_arr...
flexible
{ "blob_id": "e564e0d05c3c0e60f356422722803df510d9dd0b", "index": 281, "step-1": "<mask token>\n\n\n@njit(parallel=True)\ndef parallel_test(subject_array, typeII_error, typeI_error, num):\n test_result = np.zeros(subject_array.shape, dtype=int)\n random_table = np.random.uniform(0, 1, (subject_array.shape[0...
[ 10, 14, 15, 17, 20 ]
import pandas as pd def _get_site_name(f,i): data_file = f +"\\"+"new_desc_sele_data.csv" site_name=pd.read_csv(data_file)["SITE_ID"][i] return site_name def _get_site_DD_dataset_csv(f,i): '''获取经过全部数据集(经过全部的特征选择)''' site_path=_get_site_folder(f,i) data_path=site_path+"\\data_confirm.csv" ...
normal
{ "blob_id": "c034fba0b9204545b00ba972a17e63cf9c20854e", "index": 3930, "step-1": "<mask token>\n\n\ndef _get_site_name(f, i):\n data_file = f + '\\\\' + 'new_desc_sele_data.csv'\n site_name = pd.read_csv(data_file)['SITE_ID'][i]\n return site_name\n\n\n<mask token>\n\n\ndef _get_version_res_folder(f, ve...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @bot.event async def on_ready(): print(f'Logged in as {bot.user.name}') @bot.command() async def ping(ctx): await ctx.send('pong') @bot.command() async def lucky(ctx): spamCount = random.randint(0, 50) for nu...
flexible
{ "blob_id": "b48bc9475a8dc593ba858af8ed4e930ae290fd69", "index": 6479, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@bot.event\nasync def on_ready():\n print(f'Logged in as {bot.user.name}')\n\n\n@bot.command()\nasync def ping(ctx):\n await ctx.send('pong')\n\n\n@bot.command()\nasync def luck...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> test_f.close() <|reserved_special_token_0|> expected_f.close() assert len(inputs) == len(expecteds) for i in range(len(inputs)): connection.request('GET', '<start>%s<end>' % inputs[i]) response = connection.getresponse() ...
flexible
{ "blob_id": "cd9b04a93d85ba0ee2a38b534386f9aec0ef6895", "index": 5165, "step-1": "<mask token>\n", "step-2": "<mask token>\ntest_f.close()\n<mask token>\nexpected_f.close()\nassert len(inputs) == len(expecteds)\nfor i in range(len(inputs)):\n connection.request('GET', '<start>%s<end>' % inputs[i])\n resp...
[ 0, 1, 2, 3, 4 ]
from auth_passwordreset_reset import auth_passwordreset_reset from auth_register import auth_register from data import * import pytest #invalid reset code def test_auth_passwordreset_reset1(): #create a test account register = auth_register("Someemial@hotmail.com.au", "Hello123", "First", "Last") ...
normal
{ "blob_id": "a315d01f0fb16f0c74c447c07b76f33e6ff6427d", "index": 9742, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_auth_passwordreset_reset1():\n register = auth_register('Someemial@hotmail.com.au', 'Hello123',\n 'First', 'Last')\n auth_passwordreset_request('Someemial@hotmai...
[ 0, 2, 3, 4, 5 ]
from bs4 import BeautifulSoup import urllib.request import re import math url_header = "http://srh.bankofchina.com/search/whpj/search.jsp?erectDate=2016-01-25&nothing=2016-02-25&pjname=1314" Webpage = urllib.request.urlopen(url_header).read() Webpage=Webpage.decode('UTF-8') # soup = BeautifulSoup(Webpage) print (Webp...
normal
{ "blob_id": "62a86bd33755510f0d71f4920e63be1a3ce8c563", "index": 6304, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(Webpage)\n<mask token>\nprint(a)\n<mask token>\nprint(total_page)\n", "step-3": "<mask token>\nurl_header = (\n 'http://srh.bankofchina.com/search/whpj/search.jsp?erectDate=201...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MyLoginView(LoginView): redirect_authenticated_user = True template_name = 'login.html' class HomeView(View): def get(self, request, *args, **kwargs): form = NewVacancyForm() if request.user.is_staff else NewResumeForm() context = {'form': form, 'is_au...
flexible
{ "blob_id": "a75691af17f6d1effd469d5c2ded340c71521ee1", "index": 9310, "step-1": "<mask token>\n\n\nclass MyLoginView(LoginView):\n redirect_authenticated_user = True\n template_name = 'login.html'\n\n\nclass HomeView(View):\n\n def get(self, request, *args, **kwargs):\n form = NewVacancyForm() i...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def to_matrix(lines, token_to_id, max_len=None, pad=0, dtype='int32', time_major=False): """Converts a list of names into rnn-digestable matrix with paddings added after the end""" max_len = max_len or max(map(len, lines)) matrix = np.empty([len(lines), max_len], dtype) ...
flexible
{ "blob_id": "7f7ebc6d3d69fbb19071c63a9ab235ad01f1d414", "index": 306, "step-1": "<mask token>\n\n\ndef to_matrix(lines, token_to_id, max_len=None, pad=0, dtype='int32',\n time_major=False):\n \"\"\"Converts a list of names into rnn-digestable matrix with paddings added after the end\"\"\"\n max_len = ma...
[ 4, 5, 6, 7, 9 ]
# https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/ # BruteForce class BruteForceSolution: def smallerNumbersThanCurrent(self, nums): answer = [] for num in nums: counter = 0 for i in range(len(nums)): if n...
normal
{ "blob_id": "58e023c3c453d1e190fdb5bc457358f42d1bd93f", "index": 397, "step-1": "class BruteForceSolution:\n <mask token>\n\n\nclass Solution:\n\n def smallerNumbersThanCurrent(self, nums):\n answer = []\n sortedNums = sorted(nums)\n for num in nums:\n answer.append(sortedNu...
[ 3, 4, 5, 6, 7 ]
def drive(carspeed): if carspeed>200: print("very fast") elif carspeed>100: print("toofast") elif carspeed>70 and carspeed<80: print("optimal speed") else: print("below speed limit") print(drive(234)) print(drive(34)) drive(134) #how none will be removed? def compare(a): if a>11: print("big") elif a==1...
normal
{ "blob_id": "de3eaa5823fb396050527c148273c30bed6ce8ca", "index": 2644, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef compare(a):\n if a > 11:\n print('big')\n elif a == 10:\n print('reallybig')\n\n\n<mask token>\n", "step-3": "def drive(carspeed):\n if carspeed > 200:\n ...
[ 0, 1, 2, 3, 4 ]
import discord import requests import math from keys import GITHUB_DISCORD_TOKEN, GITHUB_FORTNITE_API_KEY client = discord.Client() # Constant DISCORD_TOKEN = GITHUB_DISCORD_TOKEN FORTNITE_API_KEY = GITHUB_FORTNITE_API_KEY LIST = ['Verified'] VERIFIED = 4 # Return the current season squad K/D of the fortnite player...
normal
{ "blob_id": "6c6a49dfced680fe034cbbc2fa28d57d2aa1273e", "index": 8973, "step-1": "<mask token>\n\n\ndef get_ratio(username):\n try:\n print(username)\n link = 'https://api.fortnitetracker.com/v1/profile/pc/' + username\n response = requests.get(link, headers={'TRN-Api-Key': FORTNITE_API_K...
[ 1, 2, 3, 4, 5 ]
from django.db import models class FoodCategory(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=200, default='') class Meta: db_table = 'kitchenrock_category' def __str__(self): return self.name
normal
{ "blob_id": "9bb1fc4df80d183c70d70653faa3428964b93a94", "index": 9494, "step-1": "<mask token>\n\n\nclass FoodCategory(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'kitchenrock_category'\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FoodCategory(models....
[ 1, 2, 3, 4 ]
import torch from torch import nn import torch.nn.functional as F class JointModel(nn.Module): def __init__(self, d_v, d_e, d_t, encoder_layers, generator_layers,encoder_shortcut, generator_shortcut, generator_transform, num_word, emb_size, word_rnn_size, word_rnn_num_layer, word_rnn_dropout, word...
normal
{ "blob_id": "4f3e297b6925f8d65aacaa59bb837e746747c33f", "index": 2608, "step-1": "<mask token>\n\n\nclass JointModel(nn.Module):\n\n def __init__(self, d_v, d_e, d_t, encoder_layers, generator_layers,\n encoder_shortcut, generator_shortcut, generator_transform, num_word,\n emb_size, word_rnn_siz...
[ 5, 6, 8, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from external.odds.betclic.api import get_odds <|reserved_special_token_1|> from external.odds.betclic.api import get_odds # FDJ parsing is broken - their UI has been refactored with JS framework & # protected async JSON API usage (requires HEADERS) and m...
flexible
{ "blob_id": "8b583ee55df409020a605b467479236e610a2efe", "index": 3646, "step-1": "<mask token>\n", "step-2": "from external.odds.betclic.api import get_odds\n", "step-3": "from external.odds.betclic.api import get_odds\n\n# FDJ parsing is broken - their UI has been refactored with JS framework &\n# protected...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open( 'D:\\Documents\\PythonDocs\\ehmatthes-pcc-f555082\\chapter_10\\programming.txt' ) as f_obj: lines = f_obj.readlines() <|reserved_special_token_0|> for line in lines: m_line = line.replace('python', 'C#')...
flexible
{ "blob_id": "03da813650d56e7ab92885b698d4af3a51176903", "index": 3878, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(\n 'D:\\\\Documents\\\\PythonDocs\\\\ehmatthes-pcc-f555082\\\\chapter_10\\\\programming.txt'\n ) as f_obj:\n lines = f_obj.readlines()\n<mask token>\nfor line in lines:...
[ 0, 1, 2, 3, 4 ]
k = 0 for x in range(100, 1000, 2): x = str(x) if x[0] == x[1] or x[0] == x[2] or x[1] == x[2]: k += 1 print(k)
normal
{ "blob_id": "af6dd7bde25453f25c0701e4ac246ff6bce29fa7", "index": 1141, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(100, 1000, 2):\n x = str(x)\n if x[0] == x[1] or x[0] == x[2] or x[1] == x[2]:\n k += 1\nprint(k)\n", "step-3": "k = 0\nfor x in range(100, 1000, 2):\n x ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def minNumberOfFrogs(self, croakOfFrogs: str) ->int: c, r, o, a, k = 0, 0, 0, 0, 0 ans = 0 for i in range(len(croakOfFrogs)): ...
flexible
{ "blob_id": "b4491b5522e85fec64164b602045b9bd3e58c5b8", "index": 4666, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def minNumberOfFrogs(self, croakOfFrogs: str) ->int:\n c, r, o, a, k = 0, 0, 0, 0, 0\n ans = 0\n for i in ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @app.route('/buy', methods=['GET', 'POST']) @login_required def buy(): """Buy shares of stock""" if request.method == 'POST': if not request.form.get('symbol'): return apology('must provide symbol', 400) elif not request.form.get('shares'): ...
flexible
{ "blob_id": "c66f4ee5719f764c8c713c23815302c00b6fb9af", "index": 310, "step-1": "<mask token>\n\n\n@app.route('/buy', methods=['GET', 'POST'])\n@login_required\ndef buy():\n \"\"\"Buy shares of stock\"\"\"\n if request.method == 'POST':\n if not request.form.get('symbol'):\n return apolog...
[ 3, 9, 13, 14, 15 ]
# *Using Min & Max Exercise def extremes(nums): return (max(nums), min(nums))
normal
{ "blob_id": "0577c274672bac333500535f21f568ade62100c7", "index": 3580, "step-1": "<mask token>\n", "step-2": "def extremes(nums):\n return max(nums), min(nums)\n", "step-3": "\n# *Using Min & Max Exercise\ndef extremes(nums):\n return (max(nums), min(nums))\n", "step-4": null, "step-5": null, "st...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def estudios(Minisoup): print('2.Estudios') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def estudios(Minisoup): print('2.Estudios') try: html_content = requests.get(url2).text except: print(f'unable to get {url2}') sy...
flexible
{ "blob_id": "846682072a125c76fc9ffa011109abce7c3bb5d7", "index": 3269, "step-1": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\ntry:\n html_content = requests.get(url2).text\nexcept:...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- #some xml helpers from xml.dom.minidom import Document class XMLReport: def __init__(self, name): self.doc = Document() self.main_node = self.add(name, node=self.doc) def add(self, name, node=None): if node is None: node = self.main_node elem = self.doc.createElement(name) ...
normal
{ "blob_id": "146487738006ce3efb5bd35c425835a1fd8e0145", "index": 9490, "step-1": "# -*- coding: utf-8 -*-\n#some xml helpers\nfrom xml.dom.minidom import Document\n\nclass XMLReport:\n def __init__(self, name):\n\tself.doc = Document()\n\tself.main_node = self.add(name, node=self.doc)\n \n def add(s...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def get_case(str_arg): first_life_and_work(str_arg) print('small_hand') <|reserved_special_token_0|> <|reserved_special_token_1|> def get_case(str_arg): first_life_and_work(str_arg) print('small_hand') def first_life_and_work(str_arg): ...
flexible
{ "blob_id": "7a2ac3a3a2bbd7349e8cc62b4d357394d9600cc8", "index": 6326, "step-1": "<mask token>\n", "step-2": "def get_case(str_arg):\n first_life_and_work(str_arg)\n print('small_hand')\n\n\n<mask token>\n", "step-3": "def get_case(str_arg):\n first_life_and_work(str_arg)\n print('small_hand')\n\...
[ 0, 1, 2, 3, 4 ]
def firstDuplicate(array): """ Time O(n) | Space O(n) """ dic = {} for num in array: if num in dic: return num else: dic[num] = True return -1 print(firstDuplicate([2, 1, 3, 5, 3]))
normal
{ "blob_id": "47259844f76f12060f0cf52f1086c05b9f300175", "index": 8581, "step-1": "<mask token>\n", "step-2": "def firstDuplicate(array):\n \"\"\"\n Time O(n) | Space O(n)\n \"\"\"\n dic = {}\n for num in array:\n if num in dic:\n return num\n else:\n dic[num] ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> application_vue_demo = Blueprint('application_vue_demo', __name__) <|reserved_special_token_0|> <|reserved_special_token_1|> from flask import Blueprint application_vue_demo = Blueprint('application_vue_demo', __name__) from . ...
flexible
{ "blob_id": "a33abd253288140f8051aced1d0ed1e41b2fc786", "index": 8067, "step-1": "<mask token>\n", "step-2": "<mask token>\napplication_vue_demo = Blueprint('application_vue_demo', __name__)\n<mask token>\n", "step-3": "from flask import Blueprint\napplication_vue_demo = Blueprint('application_vue_demo', __n...
[ 0, 1, 2 ]
import os if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "day66.settings") import django django.setup() from applistions.models import MyClass,Student,Teacher,Employee from django.db.models import Avg, Sum, Max, Min, Count # 1.求所有人里面工资最高的 ret = Employee.object...
normal
{ "blob_id": "ee72262fb29b46784fb357269dd5160192968c1b", "index": 1713, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'day66.settings')\n import django\n django.setup()\n from applistions.models import MyClass, Stude...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Dot(Sprite): <|reserved_special_token_0|> def update(self, dt): arena = self.parent.parent snake = arena.snake self.check_kill(snake) for s in arena.enemies: self.check_kill(s) <|reserved_special_token_0|> <|reserved_special...
flexible
{ "blob_id": "be06a0ad22f4ae9ab4c0acea6a7c601c14a90fc4", "index": 1995, "step-1": "<mask token>\n\n\nclass Dot(Sprite):\n <mask token>\n\n def update(self, dt):\n arena = self.parent.parent\n snake = arena.snake\n self.check_kill(snake)\n for s in arena.enemies:\n self...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def init(): glClearColor(1.0, 1.0, 1.0, 1.0) glClear(GL_COLOR_BUFFER_BIT) glColor3f(1.0, 0.0, 0.0) glPointSize(2) gluOrtho2D(0.0, 500.0, 0.0, 500.0) <|reserved_special_token_0|> def mouse(btn, state, x, y): global t_start if btn == 0 and state == 1: ...
flexible
{ "blob_id": "d85c0929b22f57367c0e707bac78e56027113417", "index": 4539, "step-1": "<mask token>\n\n\ndef init():\n glClearColor(1.0, 1.0, 1.0, 1.0)\n glClear(GL_COLOR_BUFFER_BIT)\n glColor3f(1.0, 0.0, 0.0)\n glPointSize(2)\n gluOrtho2D(0.0, 500.0, 0.0, 500.0)\n\n\n<mask token>\n\n\ndef mouse(btn, s...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class curso(db.Model): idcurso = db.Column(db.Integer, primary_key=True) nombre_curso = db.Column(db.String(45)) precio = db.Column(db.Integer) def __init__(self, nombre, precio): self.nombre_curso = nombre self.precio = precio <|reserved_special_token_0...
flexible
{ "blob_id": "5c1d1eafb913822be9b6e46b15c6886f8bf3e2e1", "index": 3622, "step-1": "<mask token>\n\n\nclass curso(db.Model):\n idcurso = db.Column(db.Integer, primary_key=True)\n nombre_curso = db.Column(db.String(45))\n precio = db.Column(db.Integer)\n\n def __init__(self, nombre, precio):\n se...
[ 9, 10, 11, 13, 14 ]
import torch import torch.nn as nn class DehazeNet(nn.Module): def __init__(self, input=16, groups=4): super(DehazeNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=5) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(in_channels=4, out_channels=...
normal
{ "blob_id": "a8cf8d0965cb877d50cee403fbc30f27484f4f36", "index": 8201, "step-1": "<mask token>\n\n\nclass DehazeNet(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DehazeNet(nn.Module):\n\n def __init__(self, input=16, groups=4):\n super(DehazeNet, self).__init_...
[ 1, 2, 3, 4, 5 ]