code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> class TestList(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_list_objective(self): output = popen(['substra', 'list', 'objective', '--config=/tmp/.substra_e2e'], stdout=PIPE).communicate()[0] res = output.decode('utf...
flexible
{ "blob_id": "c55b768466309d2e655c9222e0674a6bc2a958b3", "index": 9899, "step-1": "<mask token>\n\n\nclass TestList(TestCase):\n <mask token>\n <mask token>\n\n def test_list_objective(self):\n output = popen(['substra', 'list', 'objective',\n '--config=/tmp/.substra_e2e'], stdout=PIPE)...
[ 4, 6, 8, 9, 12 ]
a = [1, 11, 21, 1211, 111221] for i in range(30): #next_num_list = [] next_num = '' next_char = '' step = 0 count = 0 # Analyze the string. for char in str(a[i+4]): if step == 0: next_char = char count += 1 step = 1 elif step == 1: ...
normal
{ "blob_id": "3cb3361e8777d31575d81d2a1191f137e4174492", "index": 8224, "step-1": "a = [1, 11, 21, 1211, 111221]\n\nfor i in range(30):\n\n #next_num_list = []\n next_num = ''\n\n next_char = ''\n\n step = 0\n count = 0\n\n # Analyze the string.\n for char in str(a[i+4]):\n if step == ...
[ 0 ]
import cv2 import os import re class TestData: def __init__(self, image_path= '../../data/test_images/'): test_names = os.listdir(image_path) self.images = [] self.numbers = [] self.treshold = .25 for name in test_names: self.images.append(cv2.imread(...
normal
{ "blob_id": "122c4f3a2949ee675b7dd64b9f9828e80cbe5610", "index": 1246, "step-1": "<mask token>\n\n\nclass TestData:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestData:\n <mask token>\n\n def get_test_data(self):\n return self.images\n", "step-3": "<mask token>\n\...
[ 1, 2, 3, 4, 5 ]
import pymongo from FlaskScripts.database.user_database import user from FlaskScripts.database.blog_database import blog myclient = {} try: myclient = pymongo.MongoClient("mongodb://localhost:27017/") myclient.server_info() print('Database Connected') except: print('Database Error') mydb = myclient["jm...
normal
{ "blob_id": "aafdd228cf2859d7f013b088263eab544e19c481", "index": 9995, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n myclient.server_info()\n print('Database Connected')\nexcept:\n print('Database Error')\n<mask token>\n",...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from http.client import HTTPConnection import pytest from circuits.web import Controller from circuits.web.client import Client, request from .helpers import urlopen class Root(Controller): def index(self): return "Hello World!" def request_body(self): return self.r...
normal
{ "blob_id": "eb891341488e125ae8c043788d7264fff4018614", "index": 6585, "step-1": "<mask token>\n\n\nclass Root(Controller):\n\n def index(self):\n return 'Hello World!'\n\n def request_body(self):\n return self.request.body.read()\n\n def response_body(self):\n return 'ä'\n\n def...
[ 8, 9, 11, 12, 15 ]
import csv import datetime import json import re import requests import os r = requests.get("https://www.hithit.com/cs/project/4067/volebni-kalkulacka-on-steroids") path = os.path.dirname(os.path.realpath(__file__)) + "/" if r.status_code == 200: text = r.text pattern = 'Přispěvatel' m = re.search(patter...
normal
{ "blob_id": "f3329962004a4454c04327da56d8dd1d0f1d45e7", "index": 763, "step-1": "<mask token>\n", "step-2": "<mask token>\nif r.status_code == 200:\n text = r.text\n pattern = 'Přispěvatel'\n m = re.search(pattern, text)\n pattern2 = '<strong>([0-9]{1,})'\n m2 = re.search(pattern2, text[m.start(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution(object): def depthSum(self, nestedList): if len(nestedList) == 0: return 0 from queue import Queue q = Queue() sum = 0 depth = 1 for item in nestedList: q.put(item) while not q.empty(): ...
flexible
{ "blob_id": "bb81027ed5311e625591d98193997e5c7b533b70", "index": 4945, "step-1": "<mask token>\n\n\nclass Solution(object):\n\n def depthSum(self, nestedList):\n if len(nestedList) == 0:\n return 0\n from queue import Queue\n q = Queue()\n sum = 0\n depth = 1\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> default_app_config = 'teacher.apps.A1Config'
flexible
{ "blob_id": "c466c7e05608b1fbba5eea5bec16d301cee3688f", "index": 9817, "step-1": "<mask token>\n", "step-2": "default_app_config = 'teacher.apps.A1Config'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from math import sqrt def prime_generator(n): pp=[2,3] for i in range(3,n): i+=2 count=0 for ps in pp: if ps>(sqrt(i)+1): break if i%ps==0: count+=1 break if count==0: pp.append(i) return pp ...
normal
{ "blob_id": "cfa064611a4aa16638bd649c68d64872b9fac1ff", "index": 4647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef prime_generator(n):\n pp = [2, 3]\n for i in range(3, n):\n i += 2\n count = 0\n for ps in pp:\n if ps > sqrt(i) + 1:\n break\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Calculator(QWidget): <|reserved_special_token_0|> def accept_button_value(self, number): if number == 'Clean': self.number_str = '' elif number == 'Backspace': self.number_str = list(self.number_str) if len(self.number_str...
flexible
{ "blob_id": "4df9af863a857c3bbc3c266d745a49b6ef78ba9b", "index": 1994, "step-1": "<mask token>\n\n\nclass Calculator(QWidget):\n <mask token>\n\n def accept_button_value(self, number):\n if number == 'Clean':\n self.number_str = ''\n elif number == 'Backspace':\n self.nu...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class StoreIdAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StoreIdAdmin(admin.ModelAdmin): list_display = ('userid', 'aladin_id', 'yes24_id'...
flexible
{ "blob_id": "6475fd59ba2414ea9a174297a8d94e5a2e0a7d8f", "index": 3783, "step-1": "<mask token>\n\n\nclass StoreIdAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass StoreIdAdmin(admin.ModelAdmin):\n list_display = ('userid', 'aladin_id', 'yes...
[ 1, 2, 3, 4, 5 ]
import os import time import json import click import click_log import logging from flightsio.scraper import FlightScraper logger = logging.getLogger(__name__) click_log.basic_config(logger) @click.group() def main(): """ An empty click group, required in order to bundle the other commands. """ pass...
normal
{ "blob_id": "234aad868ea71bbe476b303bcff37221820f1d90", "index": 4310, "step-1": "<mask token>\n\n\n@click.group()\ndef main():\n \"\"\"\n An empty click group, required in order to bundle the other commands.\n \"\"\"\n pass\n\n\n<mask token>\n\n\n@main.command(help=\n \"\"\"Reads the route list b...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for k in range(1, size + 1): nums.append(k) <|reserved_special_token_0|> while position != deque([]): if position[0] == 1: size.popleft() position.popleft() for i in range(len(position)): ...
flexible
{ "blob_id": "c0c0ed31a09f2b49448bc1f3519aa61daaba20af", "index": 5023, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in range(1, size + 1):\n nums.append(k)\n<mask token>\nwhile position != deque([]):\n if position[0] == 1:\n size.popleft()\n position.popleft()\n for i i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for color in list_1: for size in list_2: print(color, size) <|reserved_special_token_0|> list_3.reverse() print(list_3) <|reserved_special_token_1|> list_1 = ['color', 'white', 'black'] list_2 = ['short', 'medium', ...
flexible
{ "blob_id": "6cba431650ee8b74baa8310c144321b2e587155e", "index": 2163, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor color in list_1:\n for size in list_2:\n print(color, size)\n<mask token>\nlist_3.reverse()\nprint(list_3)\n", "step-3": "list_1 = ['color', 'white', 'black']\nlist_2 = ['...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def lane_emden_int(dz=2.0 ** -14, n=3.0, w=0.0): """ Interface to FORTRAN90 Lane-Emden Integrator. Call: ndata, data = laneemden.lane_emden_int(dz, n, w) INPUT: dz: step in z, maye use 2**(-14) n: polytropic index (use 3.) ...
flexible
{ "blob_id": "10723f703f40b5db2b7c9532cda520b2ae078546", "index": 2175, "step-1": "<mask token>\n\n\ndef lane_emden_int(dz=2.0 ** -14, n=3.0, w=0.0):\n \"\"\"\n Interface to FORTRAN90 Lane-Emden Integrator.\n\n Call:\n ndata, data = laneemden.lane_emden_int(dz, n, w)\n\n INPUT:\n dz:\n ...
[ 2, 3, 4, 5, 6 ]
from .authenticators import CookieAuthenticator, HeaderAuthenticator from .paginators import LimitOffsetPaginator, PageNumberPaginator from .views import * # pylint:disable=W0401
normal
{ "blob_id": "dab53d10958b36cf75ab53bf30f744b1ed8a09b6", "index": 6475, "step-1": "<mask token>\n", "step-2": "from .authenticators import CookieAuthenticator, HeaderAuthenticator\nfrom .paginators import LimitOffsetPaginator, PageNumberPaginator\nfrom .views import *\n", "step-3": "from .authenticators impor...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while sair: num = int(input('informe um numero inteiro:')) if num < 16: fatorial = 1 x = num while x >= 1: print(x, '.') fatorial = fatorial * x x -= 1 pr...
flexible
{ "blob_id": "421e7ed0cc5a8c8acc9b98fae4ee6cc784d9b068", "index": 9683, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile sair:\n num = int(input('informe um numero inteiro:'))\n if num < 16:\n fatorial = 1\n x = num\n while x >= 1:\n print(x, '.')\n fat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def threeSum(self, nums: List[int]) ->List[List[int]]: res = [] nums.sort() for k in range(len(nums) - 2): if k > 0 and n...
flexible
{ "blob_id": "ccf3ada9a2bedf29820170f2e8184fc16f1b7aea", "index": 9580, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def threeSum(self, nums: List[int]) ->List[List[int]]:\n res = []\n nums.sort()\n for k in range(len(nums)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> file_one_time_pad.close() print(p_text) <|reserved_special_token_0|> for i in p_text: main_text.append(i) for i in range(length_p_text): for j in range(25): if main_text[i] == alphabets[j]: p_text_numer...
flexible
{ "blob_id": "4b647d37d390a4df42f29bbfc7e4bae4e77c5828", "index": 8935, "step-1": "<mask token>\n", "step-2": "<mask token>\nfile_one_time_pad.close()\nprint(p_text)\n<mask token>\nfor i in p_text:\n main_text.append(i)\nfor i in range(length_p_text):\n for j in range(25):\n if main_text[i] == alph...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Formatter(ABC): <|reserved_special_token_0|> class TitleFormatter(Formatter): def format(self, book: Book) ->str: return book.title class ContentFormatter(Formatter): def format(self, book: Book) ->str: return book.content class Printer: def ...
flexible
{ "blob_id": "d025b0719c6eecdfccb2e39a58af7842f4229c72", "index": 2678, "step-1": "<mask token>\n\n\nclass Formatter(ABC):\n <mask token>\n\n\nclass TitleFormatter(Formatter):\n\n def format(self, book: Book) ->str:\n return book.title\n\n\nclass ContentFormatter(Formatter):\n\n def format(self, b...
[ 7, 8, 10, 11 ]
<|reserved_special_token_0|> class Ui_MainWindow(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8('MainWindow')) ...
flexible
{ "blob_id": "9dde8e5fd0e83860ee86cf5402ab6eeb5b07ab2c", "index": 7761, "step-1": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n\n def setupUi(self, MainWindow):\n MainWindow.setObjectName(_fromUtf8('M...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Accounts(object): <|reserved_special_token_0|> def __init__(self): self.users = {} def add_user(self, user): if user.id in self.users: raise UserAlreadyExist else: self.users.update({user.id: user}) <|reserved_special...
flexible
{ "blob_id": "88cc4ae4137cf9c0e9c39874b36f7a2770550f96", "index": 5431, "step-1": "<mask token>\n\n\nclass Accounts(object):\n <mask token>\n\n def __init__(self):\n self.users = {}\n\n def add_user(self, user):\n if user.id in self.users:\n raise UserAlreadyExist\n else:\...
[ 4, 5, 6, 7, 9 ]
import sys import time from cli.utils import get_container_runtime, get_containers, run_shell_cmd runtime = get_container_runtime() def rm(ids): cmd = f'{runtime} rm {" ".join(ids)}' sys.stdout.write(f'{cmd}\n') run_shell_cmd(cmd) def stop(ids): cmd = f'{runtime} stop {" ".join(ids)}' sys.stdout...
normal
{ "blob_id": "eb3a32c17d8e5e9f717e813d5612d077c8feac48", "index": 7145, "step-1": "<mask token>\n\n\ndef rm(ids):\n cmd = f\"{runtime} rm {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}\\n')\n run_shell_cmd(cmd)\n\n\ndef stop(ids):\n cmd = f\"{runtime} stop {' '.join(ids)}\"\n sys.stdout.write(f'{cmd}...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> def test_aPartywithOneGuestShouldHaveOnePartyGuest(): party = Party() lisa = Guest('Lisa', 'female') party.attendedBy(lisa) assert 1 == party.numberOfGuests() def test_aPartywithThreeGuestsShouldHaveThreeGuests(): party = Party() lisa = Guest('Lisa', 'female') ...
flexible
{ "blob_id": "a8df6b575afbf6db415e0676a796623f2a9b7a70", "index": 8416, "step-1": "<mask token>\n\n\ndef test_aPartywithOneGuestShouldHaveOnePartyGuest():\n party = Party()\n lisa = Guest('Lisa', 'female')\n party.attendedBy(lisa)\n assert 1 == party.numberOfGuests()\n\n\ndef test_aPartywithThreeGuest...
[ 6, 8, 9, 10, 12 ]
import math r = float(input()) p = int(input()) obim = 2 * r * math.pi ukupanPut = p * obim # centimetre pretvaramo u metre ukupanPut = ukupanPut * 0.01 print("%.2f" % ukupanPut)
normal
{ "blob_id": "1f27b697985c7417e6d8d978703175a415c6c57d", "index": 327, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('%.2f' % ukupanPut)\n", "step-3": "<mask token>\nr = float(input())\np = int(input())\nobim = 2 * r * math.pi\nukupanPut = p * obim\nukupanPut = ukupanPut * 0.01\nprint('%.2f' % uk...
[ 0, 1, 2, 3, 4 ]
import numpy as np from scipy import fft import math from sklearn import svm from activity_recognition import WiiGesture class WiiGestureClassifier(): """ This class uses the FFT on the average of all three sensor values to provide the training data for the SVM Three good distinguishable gestures are...
normal
{ "blob_id": "0b7bba826b82c3751c072395431e17bc1dc9bb90", "index": 6037, "step-1": "<mask token>\n\n\nclass WiiGestureClassifier:\n <mask token>\n\n def __init__(self):\n super(self.__class__, self).__init__()\n <mask token>\n\n def parseArrays(self, data):\n parsedData = []\n for ...
[ 7, 8, 10, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if real_fdragon50 == input: print('Hello!') else: print('Who are you') <|reserved_special_token_1|> <|reserved_special_token_0|> input = 11 real_fdragon50 = 11 if real_fdragon50 == input: print('Hello!') else: p...
flexible
{ "blob_id": "2da6debb1f9ae2c966a17fdfb3b668160a3ef8d7", "index": 1384, "step-1": "<mask token>\n", "step-2": "<mask token>\nif real_fdragon50 == input:\n print('Hello!')\nelse:\n print('Who are you')\n", "step-3": "<mask token>\ninput = 11\nreal_fdragon50 = 11\nif real_fdragon50 == input:\n print('H...
[ 0, 1, 2, 3 ]
import glob from collections import defaultdict from stylalto.datasets.extractor import read_alto_for_training, extract_images_from_bbox_dict_for_training, split_dataset data = defaultdict(list) images = {} for xml_path in glob.glob("./input/**/*.xml", recursive=True): current, image = read_alto_for_training(xml_...
normal
{ "blob_id": "41e642c4acb212470577ef43908a1dcf2e0f5730", "index": 7159, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor xml_path in glob.glob('./input/**/*.xml', recursive=True):\n current, image = read_alto_for_training(xml_path)\n images[image] = current\n for key in current:\n data[k...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in values: for y in values: if x + y == 100 and x != y: value1 = x value2 = y print(value1) print(value2) <|reserved_special_token_1|> <|reserved_special_token_0|> values = [72, 50, 48,...
flexible
{ "blob_id": "c0ebf10b8c0cb4af11608cafcdb85dbff4abdf90", "index": 4755, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in values:\n for y in values:\n if x + y == 100 and x != y:\n value1 = x\n value2 = y\nprint(value1)\nprint(value2)\n", "step-3": "<mask token>\nva...
[ 0, 1, 2, 3 ]
''' Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Here are few examples. [1,3,5,6], 5 -> 2 [1,3,5,6], 2 -> 1 [1,3,5,6], 7 -> 4 [1,3,5,6], 0 -> 0 ''' class Solution(o...
normal
{ "blob_id": "0a7ffc027511d5fbec0076f6b25a6e3bc3dfdd9b", "index": 12, "step-1": "'''\nGiven a sorted array and a target value, return the index if the target is found.\nIf not, return the index where it would be if it were inserted in order.\n\nYou may assume no duplicates in the array.\n\nHere are few examples.\...
[ 0 ]
<|reserved_special_token_0|> def parse_command_line(argv): """Parse command line argument. See -h option :param argv: arguments on the command line must include caller file name. """ formatter_class = argparse.RawDescriptionHelpFormatter parser = argparse.ArgumentParser(description=module, formatt...
flexible
{ "blob_id": "46adb1834f6013ca0f13a64f280182a805d76278", "index": 215, "step-1": "<mask token>\n\n\ndef parse_command_line(argv):\n \"\"\"Parse command line argument. See -h option\n :param argv: arguments on the command line must include caller file name.\n \"\"\"\n formatter_class = argparse.RawDesc...
[ 2, 3, 4, 5, 6 ]
from .FactorWarData import Get_FactorWar_Data
normal
{ "blob_id": "5aa55a96e414ad6b3ceebbcbd71c23a1fd69f0d1", "index": 6400, "step-1": "<mask token>\n", "step-2": "from .FactorWarData import Get_FactorWar_Data\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(string.casefold()) print(len(string)) <|reserved_special_token_0|> print(string.lower()) print(string.upper()) <|reserved_special_token_0|> print(a) print(a.strip()) <|reserved_special_token_0|> print(b) <|reserved_special...
flexible
{ "blob_id": "024bc95f7255bb8be5c3c4ade9d212c9555a4f01", "index": 3034, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(string.casefold())\nprint(len(string))\n<mask token>\nprint(string.lower())\nprint(string.upper())\n<mask token>\nprint(a)\nprint(a.strip())\n<mask token>\nprint(b)\n", "step-3": ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class GameStdIO: <|reserved_special_token_0|> <|reserved_special_token_0|> def _done_sending(self): """ Finish sending commands to the game. :return: nothing """ sys.stdout.write('\n') sys.stdout.flush() def _get_string(se...
flexible
{ "blob_id": "09d31df9c76975377b44470e1f2ba4a5c4b7bbde", "index": 912, "step-1": "<mask token>\n\n\nclass GameStdIO:\n <mask token>\n <mask token>\n\n def _done_sending(self):\n \"\"\"\n Finish sending commands to the game.\n\n :return: nothing\n \"\"\"\n sys.stdout.wri...
[ 8, 14, 18, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calc_optical_flow_metrics(flow_predictor, frames, movable_mask): if not movable_mask.any(): return dict(flow_l2=float('nan')) assert not (frames < 0).any() and not (frames > 1).any() flows = flow_predicto...
flexible
{ "blob_id": "f6846bfc6c4d803cedaf37e079e01188733938c7", "index": 8249, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef calc_optical_flow_metrics(flow_predictor, frames, movable_mask):\n if not movable_mask.any():\n return dict(flow_l2=float('nan'))\n assert not (frames < 0).any() and ...
[ 0, 4, 5, 6, 7 ]
def check_ip_or_mask(temp_str): IPv4_regex = (r'(?:[0-9]{1,3}\.){3}[0-9]{1,3}') temp_list_ip_mask = re.findall(IPv4_regex, temp_str) binary_temp_list_ip_mask = [] temp_binary_ip_mask = '' for x in range(len(temp_list_ip_mask)): split_ip_address = re.split(r'\.', temp_list_ip_mask[x]) ...
normal
{ "blob_id": "fe597ad4462b1af3f3f99346c759c5fa8a7c14f4", "index": 741, "step-1": "<mask token>\n", "step-2": "def check_ip_or_mask(temp_str):\n IPv4_regex = '(?:[0-9]{1,3}\\\\.){3}[0-9]{1,3}'\n temp_list_ip_mask = re.findall(IPv4_regex, temp_str)\n binary_temp_list_ip_mask = []\n temp_binary_ip_mask...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for s in sys.argv[3:]: file = open(s + '.' + sys.argv[1] + '-' + sys.argv[2] + '.trimmed', 'w') r_list = [] size = 0 for r in SeqIO.parse(s, 'fastq'): r_list.append(r[start:end]) size += 1 i...
flexible
{ "blob_id": "4a8663531f303da29371078e34dc7224fc4580e3", "index": 6283, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor s in sys.argv[3:]:\n file = open(s + '.' + sys.argv[1] + '-' + sys.argv[2] + '.trimmed', 'w')\n r_list = []\n size = 0\n for r in SeqIO.parse(s, 'fastq'):\n r_list....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class WebsitePreferencesInstanceInline(admin.TabularInline): model = WebsitePreferences class SiteAdmin(admin.ModelAdmin): list_filter = 'domain', 'name' inlines = [CustomSiteInstanceInline, WebsitePreferencesInstanceInline] <|reserved_special_token_0|> <|reserved_specia...
flexible
{ "blob_id": "614d6484678890df2ae0f750a3cad51a2b9bd1c6", "index": 2315, "step-1": "<mask token>\n\n\nclass WebsitePreferencesInstanceInline(admin.TabularInline):\n model = WebsitePreferences\n\n\nclass SiteAdmin(admin.ModelAdmin):\n list_filter = 'domain', 'name'\n inlines = [CustomSiteInstanceInline, We...
[ 4, 10, 12, 14, 15 ]
import pymongo import pandas as pd import re from pymongo import MongoClient from nltk.corpus import stopwords from nltk import word_tokenize from gensim import corpora import pickle client = MongoClient() db = client.redditCrawler collection = db.data_test1 def remove_posts(data, index_list): data = data.drop(i...
normal
{ "blob_id": "341fb4442ba1d1bb13dbbe123e1051e1ceeb91e7", "index": 4431, "step-1": "<mask token>\n\n\ndef remove_posts(data, index_list):\n data = data.drop(index_list)\n return data.reset_index(drop=True)\n\n\n<mask token>\n\n\ndef preprocess(text):\n text = text.lower()\n text = text.replace('$', ' '...
[ 3, 4, 5, 6, 7 ]
sheik=['a','e','i','o','u','A','E','I','O','U'] s=raw_input() if(s in sheik): print('Vowel') elif(s!=sheik): print('Consonant') else: print('invalid')
normal
{ "blob_id": "0fb8a9b1073446a62b46a802da69b66e78533c2a", "index": 7293, "step-1": "<mask token>\n", "step-2": "<mask token>\nif s in sheik:\n print('Vowel')\nelif s != sheik:\n print('Consonant')\nelse:\n print('invalid')\n", "step-3": "sheik = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\ns = ...
[ 0, 1, 2, 3 ]
from stats_arrays.distributions import GeneralizedExtremeValueUncertainty as GEVU from stats_arrays.errors import InvalidParamsError from ..base import UncertaintyTestCase import numpy as np class GeneralizedExtremeValueUncertaintyTestCase(UncertaintyTestCase): def test_random_variables(self): params = s...
normal
{ "blob_id": "997c1c86848b59a3986a579d5b1b50313fdfdf44", "index": 8161, "step-1": "<mask token>\n\n\nclass GeneralizedExtremeValueUncertaintyTestCase(UncertaintyTestCase):\n\n def test_random_variables(self):\n params = self.make_params_array()\n params['loc'] = 2\n params['scale'] = 5\n ...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python3 import datetime, random class State(object): def __init__(self, name): self.name = name def __str__(self): return self.name class State_New(State): def __init__(self): super(State_New, self).__init__("New") class State_Underway(State): def __init__(sel...
normal
{ "blob_id": "e40b34f0ee51cc14615c6225a7676929e6d2876a", "index": 2975, "step-1": "<mask token>\n\n\nclass State_Underway(State):\n\n def __init__(self):\n super(State_Underway, self).__init__('Underway')\n\n\nclass State_Paused(State):\n\n def __init__(self):\n super(State_Paused, self).__ini...
[ 25, 26, 30, 31, 34 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for year in range(BASE_YEAR, END_YEAR + 1): filename1 = 'dist-table-all-clp-avg-' + str(year) + '.txt' df1 = pd.read_fwf(filename1) df1.drop('Unnamed: 0', axis=1, inplace=True) col_list = df1.columns[1:] + '_avg_cl...
flexible
{ "blob_id": "c3967ab15b8278d958fa5ff6ff48bbfb0b086238", "index": 3729, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor year in range(BASE_YEAR, END_YEAR + 1):\n filename1 = 'dist-table-all-clp-avg-' + str(year) + '.txt'\n df1 = pd.read_fwf(filename1)\n df1.drop('Unnamed: 0', axis=1, inplace=T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(data.head(6)) <|reserved_special_token_0|> print(data) <|reserved_special_token_0|> print(X_train.shape) print(y_train.shape) print(X_test.shape) print(y_test.shape) <|reserved_special_token_0|> model.fit(X_train, y_train) <...
flexible
{ "blob_id": "7da2be1b530faa8ce9a8570247887e8e0d74c310", "index": 711, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(data.head(6))\n<mask token>\nprint(data)\n<mask token>\nprint(X_train.shape)\nprint(y_train.shape)\nprint(X_test.shape)\nprint(y_test.shape)\n<mask token>\nmodel.fit(X_train, y_train...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if (sum(prices) - prices[k]) // 2 == taken: print('Bon Appetit') else: print(taken - (sum(prices) - prices[k]) // 2) <|reserved_special_token_1|> n, k = map(int, input().split()) prices = [int(temp) for temp in input()....
flexible
{ "blob_id": "aa15f684d23d97a45a416b1fdcfb192710ebb56f", "index": 2151, "step-1": "<mask token>\n", "step-2": "<mask token>\nif (sum(prices) - prices[k]) // 2 == taken:\n print('Bon Appetit')\nelse:\n print(taken - (sum(prices) - prices[k]) // 2)\n", "step-3": "n, k = map(int, input().split())\nprices =...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def maximumTime(self, time: str) ->str: ans = '' for i in range(5): if time[i] != '?': ans += time[i] ...
flexible
{ "blob_id": "e7494104ab98df2b640f710fa69584802b3e1259", "index": 3032, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def maximumTime(self, time: str) ->str:\n ans = ''\n for i in range(5):\n if time[i] != '?':\n ...
[ 0, 1, 2 ]
import logging from blogofile.cache import bf github = bf.config.controllers.github from github2.client import Github github_api = Github() config = { "name": "Github", "description": "Makes a nice github project listing for the sidebar", "priority": 95.0, } def get_list(user): """ Each item...
normal
{ "blob_id": "ee2cf6c472fa955ba3718bf3a3f60b66811b4907", "index": 4705, "step-1": "<mask token>\n\n\ndef get_list(user):\n \"\"\"\n Each item in the list has:\n name, url, description, forks, watchers, homepage, open_issues\n\n \"\"\"\n return [g for g in github_api.repos.list(user) if not g.fo...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('oi') <|reserved_special_token_1|> from ShazamAPI import Shazam import json import sys print('oi') <|reserved_special_token_1|> from ShazamAPI import Shazam import json import sys print("oi")
flexible
{ "blob_id": "c248d653556ecdf27e56b57930832eb293dfd579", "index": 5413, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('oi')\n", "step-3": "from ShazamAPI import Shazam\nimport json\nimport sys\nprint('oi')\n", "step-4": "from ShazamAPI import Shazam\nimport json\nimport sys\n\nprint(\"oi\")\n",...
[ 0, 1, 2, 3 ]
# Представлен список чисел. # Необходимо вывести элементы исходного списка, # значения которых больше предыдущего элемента. from random import randint list = [] y = int(input("Введите количество элементов в списке>>> ")) for i in range(0, y): list.append(randint(1, 10)) new = [el for num, el in enumerate(list) if...
normal
{ "blob_id": "bfc4f5e90b7c22a29d33ae9b4a5edfb6086d79f4", "index": 2344, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, y):\n list.append(randint(1, 10))\n<mask token>\nprint(f'Исходный список: {list}')\nprint(f'Новый список список: {new}')\n", "step-3": "<mask token>\nlist = []\ny =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StanfordPOSTagger(stanford.StanfordPOSTagger): <|reserved_special_token_0|> def __init__(self, model_filename, path_to_jar, *args, **kwargs): self._SEPARATOR = '/' super(stanford.StanfordPOSTagger, self).__init__(*args, model_filename=model_filen...
flexible
{ "blob_id": "1ac3630e6433a2d11c716b558640cab7c559f6ba", "index": 4483, "step-1": "<mask token>\n\n\nclass StanfordPOSTagger(stanford.StanfordPOSTagger):\n <mask token>\n\n def __init__(self, model_filename, path_to_jar, *args, **kwargs):\n self._SEPARATOR = '/'\n super(stanford.StanfordPOSTag...
[ 3, 5, 7, 8, 9 ]
def merge(self, intervals): intervals.sort() arr = [] for i in intervals: if len(arr) == 0 or arr[-1][1] < i[0]: arr.append(i) else: arr[-1][1] = max(arr[-1][1], i[1]) return arr
normal
{ "blob_id": "a65dfca1773c1e4101ebfb953e0f617a2c345695", "index": 334, "step-1": "<mask token>\n", "step-2": "def merge(self, intervals):\n intervals.sort()\n arr = []\n for i in intervals:\n if len(arr) == 0 or arr[-1][1] < i[0]:\n arr.append(i)\n else:\n arr[-1][1]...
[ 0, 1 ]
<|reserved_special_token_0|> def show_humidity(): a.clear() a.plot(fds, humidity, 'b.--') a.set_ylabel('Humidity %', color='b') a.xaxis.set_major_formatter(hfmt) a.grid(color='blue') for tick in a.xaxis.get_major_ticks(): tick.label.set_fontsize(7) tick.label.set_rotation(15) ...
flexible
{ "blob_id": "2de12085ddc73fed85dda8ce3d6908b42fdc4bcc", "index": 3046, "step-1": "<mask token>\n\n\ndef show_humidity():\n a.clear()\n a.plot(fds, humidity, 'b.--')\n a.set_ylabel('Humidity %', color='b')\n a.xaxis.set_major_formatter(hfmt)\n a.grid(color='blue')\n for tick in a.xaxis.get_major...
[ 2, 3, 5, 6, 7 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from dynamic_rest import viewsets from django.shortcuts import render import os from rest_framework import permissions from rest_framework.response import Response from rest_framework.permissions import AllowAny from rest_framework.decorators import api_vi...
normal
{ "blob_id": "8c6b7f29b8dca61a5218b51c85149c9642af5649", "index": 6665, "step-1": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nfrom dynamic_rest import viewsets\nfrom django.shortcuts import render\nimport os\nfrom rest_framework import permissions\nfrom rest_framework.response import Respon...
[ 0 ]
<|reserved_special_token_0|> class Text(QtGui.QGraphicsTextItem): <|reserved_special_token_0|> def getName(self): return self.__name class GUI(QtGui.QWidget): def __init__(self): super(GUI, self).__init__() self.exp = experiment.Experiments(20, 3) self.matching = self.e...
flexible
{ "blob_id": "edbb721784dff81e3e1ab5e0458a4080508807fe", "index": 4335, "step-1": "<mask token>\n\n\nclass Text(QtGui.QGraphicsTextItem):\n <mask token>\n\n def getName(self):\n return self.__name\n\n\nclass GUI(QtGui.QWidget):\n\n def __init__(self):\n super(GUI, self).__init__()\n ...
[ 18, 20, 23, 25, 32 ]
import os import sys import re import traceback import logging import queue import threading from logging.handlers import TimedRotatingFileHandler from pathlib import Path import click import inotify.adapters from inotify.constants import (IN_ATTRIB, IN_DELETE, IN_MOVED_FROM, IN_MOVED_TO,...
normal
{ "blob_id": "3a96ede91069df0c71905415e598dbbd9d3056fd", "index": 9730, "step-1": "<mask token>\n\n\ndef configure_log(log_file, verbose=False):\n filename = log_file\n if log_file == 'STDOUT':\n handler = logging.StreamHandler(sys.stdout)\n elif log_file == 'STDERR':\n handler = logging.St...
[ 7, 11, 12, 14, 16 ]
import smart_imports smart_imports.all() class LogicTests(utils_testcase.TestCase): def setUp(self): super(LogicTests, self).setUp() game_logic.create_test_map() self.account_1 = self.accounts_factory.create_account() self.account_1_items = prototypes.AccountItemsPrototype.ge...
normal
{ "blob_id": "89e5e82c073f7f87c00fc844c861c6c5cbe6a695", "index": 8893, "step-1": "<mask token>\n\n\nclass LogicTests(utils_testcase.TestCase):\n\n def setUp(self):\n super(LogicTests, self).setUp()\n game_logic.create_test_map()\n self.account_1 = self.accounts_factory.create_account()\n ...
[ 5, 6, 7, 8, 9 ]
# This script runs nightly to process users' preinstall history # no it doesn't, you liar from bson.objectid import ObjectId import ConfigParser import os from text_processing.textprocessing import start_text_processing_queue from pymongo import MongoClient import time from os import listdir from os.path import isfile,...
normal
{ "blob_id": "73058bd9533ef6c0d1a4faf96930077147631917", "index": 9289, "step-1": "# This script runs nightly to process users' preinstall history\n# no it doesn't, you liar\nfrom bson.objectid import ObjectId\nimport ConfigParser\nimport os\nfrom text_processing.textprocessing import start_text_processing_queue\...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def handle(req): """handle a request to the function Args: req (str): request body """ start = time() event = json.loads(req) user_id = event['user_id'] post_id = event['post_id'] timestam...
flexible
{ "blob_id": "37969899aa646f4cdd7a5513f17d26b334870f1b", "index": 6598, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef handle(req):\n \"\"\"handle a request to the function\n Args:\n req (str): request body\n \"\"\"\n start = time()\n event = json.loads(req)\n user_id = ev...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def cut_off(x): if x <= 0: print('Cut_off is applied') return float('inf') return x def compute_dice(out_fol, steps=100): files = [x for x in os.listdir(out_fol) if 'npy' in x] thresholds = np.array(range(30, 60)) / steps dice_thresholds = np.zeros(le...
flexible
{ "blob_id": "4892d4f364b03b53b1ad6f4c2177bbe2898edbda", "index": 3691, "step-1": "<mask token>\n\n\ndef cut_off(x):\n if x <= 0:\n print('Cut_off is applied')\n return float('inf')\n return x\n\n\ndef compute_dice(out_fol, steps=100):\n files = [x for x in os.listdir(out_fol) if 'npy' in x...
[ 2, 4, 5, 6, 8 ]
# Generated by Django 3.2.9 on 2021-11-10 13:36 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('settings', '0003_auto_20210814_2246'), ] operations = [ migrations.AlterField( model_name='building', name='id', ...
normal
{ "blob_id": "9dfbf14a2005aad87be82e5e482c6b0347f32f2c", "index": 8007, "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 = [('settings', ...
[ 0, 1, 2, 3, 4 ]
import testr import testg import time def run(): parser = testg.OptionParser(description='Autonomous grasp and manipulation planning example.') parser.add_option('--scene', action="store",type='string',dest='scene',default='/home/user/experiment/data/lab1.env.xml', h...
normal
{ "blob_id": "62857a015087500fec534ba1297d42a33ae61927", "index": 7153, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run():\n parser = testg.OptionParser(description=\n 'Autonomous grasp and manipulation planning example.')\n parser.add_option('--scene', action='store', type='string...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def node(peer: pd.Peer): if peer.data_infection is None: return '' return '\t' + 'node [' + '\n' + '\t' + '\t' + 'id {}'.format(peer.id ) + '\n' + '\t' + '\t' + 'label "{}"'.format(node_label(peer) ) + '\n' + '\t' + ']' + '\n' <|reserved_special_token_0|>...
flexible
{ "blob_id": "cb0b963c0e5aadcb67b5ee5f055fb9b6f21892fc", "index": 5292, "step-1": "<mask token>\n\n\ndef node(peer: pd.Peer):\n if peer.data_infection is None:\n return ''\n return '\\t' + 'node [' + '\\n' + '\\t' + '\\t' + 'id {}'.format(peer.id\n ) + '\\n' + '\\t' + '\\t' + 'label \"{}\"'.fo...
[ 2, 5, 6, 7, 8 ]
from sqlalchemy import (Column, Integer, Float, String, ForeignKey) from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship from .meta import Base, BaseModel class Stock(Base, BaseModel): __tablename__ = 'stock' name = Column(String(255), nullable=False) starting_price = ...
normal
{ "blob_id": "7251d32918b16166e9b7c9613726e6dc51d6fea4", "index": 3834, "step-1": "<mask token>\n\n\nclass StockType(Base, BaseModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __json__(self, _):\n return {'id': self.id, 'name': self.name}\n", "s...
[ 2, 3, 5, 6, 8 ]
<|reserved_special_token_0|> def adVector(v, w): n = len(v) r = [] for k in range(n): r += [lc.cplxsum(v[k], w[k])] return r <|reserved_special_token_0|> def MultEscalarVector(v, w): n = len(w) r = [] for k in range(n): r += [lc.cplxproduct(v, w[k])] return r def ...
flexible
{ "blob_id": "5f242ae801a239dde6a22e4fb68b4ef4b2459be6", "index": 2599, "step-1": "<mask token>\n\n\ndef adVector(v, w):\n n = len(v)\n r = []\n for k in range(n):\n r += [lc.cplxsum(v[k], w[k])]\n return r\n\n\n<mask token>\n\n\ndef MultEscalarVector(v, w):\n n = len(w)\n r = []\n for...
[ 10, 13, 14, 15, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for row in range(num, 0, -1): for col in range(row, 0, -1): print(a, end='') a -= 1 print() <|reserved_special_token_1|> num = 5 a = 5 for row in range(num, 0, -1): for col in range(row, 0, -1): ...
flexible
{ "blob_id": "a567a2dc1dbb59979d849a5a772e4592910a9f27", "index": 2783, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in range(num, 0, -1):\n for col in range(row, 0, -1):\n print(a, end='')\n a -= 1\n print()\n", "step-3": "num = 5\na = 5\nfor row in range(num, 0, -1):\n for...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> r.set('counter', 40) print(r.get('counter')) print(r.incr('counter')) print(r.incr('counter')) print(r.get('counter')) <|reserved_special_token_1|> <|reserved_special_token_0|> r = redis.StrictRedis() r.set('counter', 40) print...
flexible
{ "blob_id": "b38c9357030b2eac8298743cfb4d6c4d58c99ed4", "index": 7463, "step-1": "<mask token>\n", "step-2": "<mask token>\nr.set('counter', 40)\nprint(r.get('counter'))\nprint(r.incr('counter'))\nprint(r.incr('counter'))\nprint(r.get('counter'))\n", "step-3": "<mask token>\nr = redis.StrictRedis()\nr.set('c...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def inventory(component, component_type): try: component_inventory = _inventory[component] except KeyError: raise ValueError('Illegal assembly component: {}'.format(component)) try: component_class = component_inventory[component_type] except KeyErr...
flexible
{ "blob_id": "1450d3b8cc4cef1c5f802e4d84e2211b7467fe12", "index": 2212, "step-1": "<mask token>\n\n\ndef inventory(component, component_type):\n try:\n component_inventory = _inventory[component]\n except KeyError:\n raise ValueError('Illegal assembly component: {}'.format(component))\n try...
[ 2, 3, 4, 5, 6 ]
# MEDIUM # TLE if decrement divisor only # Bit manipulation. # input: 100 / 3 # times = 0 # 3 << 0 = 3 # 3 << 1 = 6 # 3 << 2 = 12 # 3 << 3 = 24 # 3 << 4 = 48 # 3 << 5 = 96 # 3 << 6 = 192 => greater than dividend 100 => stop here # times -=1 becaus...
normal
{ "blob_id": "d1864f454b1909196fd9a6e2279b23f4c4148917", "index": 7232, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def divide(self, dividend: int, divisor: int) ->int:\n if dividend == -2 ** 31 and divisor == -1:\n return 2 ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class HoR(object): <|reserved_special_token_0|> def __init__(self, parties, name='HoR'): self.name = name self._parties = tuple(sorted(parties, key=lambda p: (p.seats, p. votes), reverse=True)) self._party_mapping = {p.name: p for p in self._pa...
flexible
{ "blob_id": "4c927f14065d0557dbe7b371002e133c351d3478", "index": 6933, "step-1": "<mask token>\n\n\nclass HoR(object):\n <mask token>\n\n def __init__(self, parties, name='HoR'):\n self.name = name\n self._parties = tuple(sorted(parties, key=lambda p: (p.seats, p.\n votes), reverse...
[ 31, 32, 34, 36, 39 ]
<|reserved_special_token_0|> class GiveExp(EventCommand): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class SetExp(EventCommand): nid = 'set_exp' tag = Tags.MODIFY_UNIT_PROPERTIES keywords = ['GlobalUnit', 'PositiveInteger'] class GiveWexp(EventCo...
flexible
{ "blob_id": "c2dba981b0d628aebdf8cebfb890aad74a629b08", "index": 7365, "step-1": "<mask token>\n\n\nclass GiveExp(EventCommand):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SetExp(EventCommand):\n nid = 'set_exp'\n tag = Tags.MODIFY_UNIT_PROPERTIES\n keywords = ['GlobalUnit', 'Posit...
[ 119, 154, 180, 218, 252 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: r = requests.get('http://skitter.com') print(r) except (requests.ConnectionError, requests.Timeout) as x: pass <|reserved_special_token_1|> import requests try: r = requests.get('http://skitter.com') pr...
flexible
{ "blob_id": "a26cab29f0777764f014eeff13745be60e55b62d", "index": 724, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n r = requests.get('http://skitter.com')\n print(r)\nexcept (requests.ConnectionError, requests.Timeout) as x:\n pass\n", "step-3": "import requests\ntry:\n r = requests...
[ 0, 1, 2, 3 ]
"""Those things that are core to tests. This module provides the most fundamental test entities, which include such things as: - Tests - Suites - Test states """ from __future__ import print_function __docformat__ = "restructuredtext" import os import textwrap import time import weakref import inspect from clevers...
normal
{ "blob_id": "cac9d84f20a79b115c84ff4fe8cf4640182a42d7", "index": 754, "step-1": "<mask token>\n\n\nclass Test(TestItem):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def abortRun(self):\n self._runHistory.pop()\n <m...
[ 33, 64, 81, 104, 122 ]
from qcg.appscheduler.errors import * class Node: def __init__(self, name=None, totalCores=0, used=0): self.__name = name self.__totalCores = totalCores self.__usedCores = used self.resources = None def __getName(self): return self.__name def __getTotalCores(self)...
normal
{ "blob_id": "23a7aa6b9a98bfd4fd43fea1ecfa26cb44969804", "index": 8061, "step-1": "<mask token>\n\n\nclass Node:\n <mask token>\n\n def __getName(self):\n return self.__name\n\n def __getTotalCores(self):\n return self.__totalCores\n\n def __setTotalCores(self, total):\n assert to...
[ 21, 23, 26, 28, 29 ]
<|reserved_special_token_0|> class MVCRecordingControlGUI(MVCRecordingControlBase): <|reserved_special_token_0|> def __init__(self, config): assertMainThread() super().__init__(config) self._directory = str(Path('.').absolute()) srv = Services.getService('MainWindow') ...
flexible
{ "blob_id": "3e4771d074218fb0a77332ee61a4cc49f1c301b7", "index": 9356, "step-1": "<mask token>\n\n\nclass MVCRecordingControlGUI(MVCRecordingControlBase):\n <mask token>\n\n def __init__(self, config):\n assertMainThread()\n super().__init__(config)\n self._directory = str(Path('.').ab...
[ 6, 8, 9, 12, 15 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Eric Pascual' from tornado.web import RequestHandler import os class UIHandler(RequestHandler): def get_template_args(self): return { 'app_title':"Capteurs de lumière et de couleur" } def get(self, *args, **kwargs): ...
normal
{ "blob_id": "b13d4b0ccb693fb97befb4ee47974d8ee076b52b", "index": 5177, "step-1": "<mask token>\n\n\nclass UIHBarrier(UIHandler):\n <mask token>\n\n\nclass UIWBDetector(UIHandler):\n\n def get(self, *args, **kwargs):\n template_args = self.get_template_args()\n template_args['demo_title'] = 'D...
[ 7, 11, 14, 15, 16 ]
#!/usr/bin/env python from django.contrib import admin from models import UserProfile, AuditTrail class UserProfileAdmin(admin.ModelAdmin): list_display = [i.name for i in UserProfile._meta.fields] admin.site.register(UserProfile, UserProfileAdmin) class AuditTrailUserAdmin(admin.ModelAdmin): list_display ...
normal
{ "blob_id": "477d1629c14609db22ddd9fc57cb644508f4f490", "index": 8905, "step-1": "<mask token>\n\n\nclass UserProfileAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n\n\nclass AuditTrailUserAdmin(admin.ModelAdmin):\n list_display = 'id', 'date', 'user', 'level', 'message'\n list_filter = 'leve...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('yelp_review.csv', encoding='utf8') as csvfile: wordFrequencies = defaultdict(int) def beautifyDate(res): dt = time.strptime(res, '%Y-%m-%d') return calendar.timegm(dt) def getAsciiFriendlyS...
flexible
{ "blob_id": "ba54b3a148a34ced74a337665ddd5f2d9084553b", "index": 1489, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('yelp_review.csv', encoding='utf8') as csvfile:\n wordFrequencies = defaultdict(int)\n\n def beautifyDate(res):\n dt = time.strptime(res, '%Y-%m-%d')\n retur...
[ 0, 1, 2, 3, 4 ]
class Solution: def uncommonFromSentences(self, A: str, B: str) ->List[str]: word_count = {} A = A.split() B = B.split() whole = A + B for word in whole: if word not in word_count: word_count[word] = 1 else: word_count[...
normal
{ "blob_id": "09420360ddcf2f74c2e130b4e09ae2a959e42e50", "index": 8305, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def uncommonFromSentences(self, A: str, B: str) ->List[str]:\n word_count = {}\n A = A.split()\n B = B.spl...
[ 0, 1, 2 ]
from erlport.erlterms import Atom from scipy.optimize import basinhopping import numpy as np import qsim class Bounds(object): '''Required for acceptance testing in scipy.optimize.basinhopping''' def __init__(self, xmin, xmax, costs): self.xmax = xmax self.xmin = xmin self.costs = costs...
normal
{ "blob_id": "0f4bdaecef356e01cbef527d4886564d9ef840fa", "index": 5573, "step-1": "<mask token>\n\n\nclass Bounds(object):\n \"\"\"Required for acceptance testing in scipy.optimize.basinhopping\"\"\"\n\n def __init__(self, xmin, xmax, costs):\n self.xmax = xmax\n self.xmin = xmin\n self...
[ 16, 17, 22, 23, 24 ]
from pwn import * p = process("./weeb_hunting") elf = ELF("/lib/x86_64-linux-gnu/libc-2.23.so") pwnlib.gdb.attach(p) r = p.recv() while "You found a" not in r: r = p.recvuntil(">") p.send("AAAA\n") p.send("AAAA\n") r = p.recv() while "You found a" not in r: r = p.recvuntil(">") p.send("AAAA\n") p.send("AAAA\n")...
normal
{ "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 ]
"""slack_utils.py: slack-specific utilities""" from os import path import pprint HERE = path.abspath(path.dirname(__file__)) PP = pprint.PrettyPrinter(indent=2) def parse_slack_message_object(message_obj): """parse user_name/channel_name out of slack controller Notes: `slackbot.message`.keys(): [type...
normal
{ "blob_id": "2df2cccc22aba2104ab15820e13d304addf83f63", "index": 7163, "step-1": "<mask token>\n\n\ndef parse_slack_message_object(message_obj):\n \"\"\"parse user_name/channel_name out of slack controller\n\n Notes:\n `slackbot.message`.keys(): [type, channel, user, text, ts, source_team, team]\n\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MainCentralWidget(QWidget): def __init__(self): super().__init__() tab_bar = self.getTabBar(('录制', '运行')) tab_page = self.getTabPage() tab_bar.currentRowChanged.connect(tab_page.setCurrentIndex) hbox = QHBoxLayout(spacing=0) hbox....
flexible
{ "blob_id": "252a6b97f108b7fdc165ccb2a7f61ce31f129d3d", "index": 8693, "step-1": "<mask token>\n\n\nclass MainCentralWidget(QWidget):\n\n def __init__(self):\n super().__init__()\n tab_bar = self.getTabBar(('录制', '运行'))\n tab_page = self.getTabPage()\n tab_bar.currentRowChanged.con...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> def main(): trim = sys.stdin.read() if len(sys.argv) > 7: trim_reads(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv [4]), sys.argv[5], sys.argv[6], int(sys.argv[7]), trim) else: print( 'trim_reads.py [fastq] [selection] [extrac...
flexible
{ "blob_id": "3f3ed40bf800eddb2722171d5fd94f6c292162de", "index": 5865, "step-1": "<mask token>\n\n\ndef main():\n trim = sys.stdin.read()\n if len(sys.argv) > 7:\n trim_reads(sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv\n [4]), sys.argv[5], sys.argv[6], int(sys.argv[7]), trim)...
[ 1, 2, 3, 4, 5 ]
import logging import subprocess from pathlib import Path from typing import Union from git import Repo def init_repo(metadata: str, path: str, deep_clone: bool) -> Repo: clone_path = Path(path) if not clone_path.exists(): logging.info('Cloning %s', metadata) repo = (Repo.clone_from(metadata, ...
normal
{ "blob_id": "cb2dd08a09d2e39bd83f82940c3d9a79a5a27918", "index": 6523, "step-1": "<mask token>\n\n\ndef init_ssh(key: str, key_path: Path) ->None:\n if not key:\n logging.warning('Private Key required for SSH Git')\n return\n logging.info('Private Key found, writing to disk')\n key_path.mk...
[ 1, 2, 3, 4, 5 ]
# coding: utf-8 #ack program with the ackermann_function """ ackermann_function """ def ack(m,n): #n+1 if m = 0 if m is 0: return n + 1 #A(m−1, 1) if m > 0 and n = 0 if m > 0 and n is 0: return ack(m-1, 1) #A(m−1, A(m, n−1)) if m > 0 and n > 0 if m > 0 and n > 0: re...
normal
{ "blob_id": "0ecd2a298203365b20b2369a99c3c1d7c0646f19", "index": 34, "step-1": "# coding: utf-8\n#ack program with the ackermann_function\n\n\"\"\" ackermann_function \"\"\"\ndef ack(m,n):\n #n+1 if m = 0\n if m is 0:\n \treturn n + 1\n #A(m−1, 1) if m > 0 and n = 0 \n if m > 0 and n is 0:...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def train(num_epochs=30): lossfunction = nn.CrossEntropyLoss() trainset = TrainDataSet() model = BiAffineSrlModel(vocabs=trainset.vocabs) optimizer = torch.optim.Adam(model.parameters(), lr=0.01) since = time...
flexible
{ "blob_id": "038ccba05113fb7f2f589eaa7345df53cb59a5af", "index": 18, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef train(num_epochs=30):\n lossfunction = nn.CrossEntropyLoss()\n trainset = TrainDataSet()\n model = BiAffineSrlModel(vocabs=trainset.vocabs)\n optimizer = torch.optim.Ada...
[ 0, 1, 2, 3, 4 ]
"""helloworld URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ https://docs.djangoproject.com/zh-hans/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add ...
normal
{ "blob_id": "a470aad80e47b244811e4d9aed4a630ba36a8daf", "index": 4112, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', include(\n 'blog.urls', namespace='blog')), url('^hello/([0-9]{4})/$', view.hello),\n url('^ifor/', view.ifor)]\n<mask token...
[ 0, 1, 2, 3 ]
___ findmissingnumberusingxor(myarray print "Given Array:", myarray #print "Len of the Array:", len(myarray) arraylen _ l..(myarray) xorval _ 0 #print "In the First loop" ___ i __ r..(1, arraylen + 2 #print xorval,"^",i,"is",xorval^i xorval _ xorval ^ i #print "In t...
normal
{ "blob_id": "892dd4259950c66669b21c5dbc7b738ddb5aa586", "index": 5734, "step-1": "\n___ findmissingnumberusingxor(myarray\n print \"Given Array:\", myarray\n #print \"Len of the Array:\", len(myarray)\n\tarraylen _ l..(myarray)\n\txorval _ 0\n #print \"In the First loop\"\n\t___ i __ r..(1, ...
[ 0 ]
<|reserved_special_token_0|> class TracePoint: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def clear(): TracePoint.classes = [] TracePoint.funcs = [] TracePoint.flow = [] def __init__(self, cls, func, t): ...
flexible
{ "blob_id": "80bf208f1d658b639d650af8208a744ed2dd258f", "index": 9355, "step-1": "<mask token>\n\n\nclass TracePoint:\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def clear():\n TracePoint.classes = []\n TracePoint.funcs = []\n TracePoint.flow = []\n\n d...
[ 6, 9, 11, 12, 14 ]
from django.contrib.postgres.fields import JSONField from django.db import models from service.models import TimeStampedModel class Praise(TimeStampedModel): class Meta: verbose_name = '칭찬' verbose_name_plural = verbose_name content = models.CharField(verbose_name='내용', unique=True, max_leng...
normal
{ "blob_id": "a4db12fee72989f983c1069839dc0a5ede4561a3", "index": 686, "step-1": "<mask token>\n\n\nclass PraiseHistory(TimeStampedModel):\n\n\n class Meta:\n verbose_name = '칭찬 내역'\n verbose_name_plural = verbose_name\n praise = models.ForeignKey(Praise, verbose_name='칭찬')\n choices = JSON...
[ 2, 3, 4, 5 ]
# Кицела Каролина ИВТ 3 курс # Вариант 6 # Найти сумму всех чисел с плавающей точкой b = ("name", " DeLorean DMC-12", "motor_pos", "rear", "n_of_wheels", 4, "n_of_passengers", 2, "weight", 1.230, "height", 1.140, "length", 4.216, "width", 1.857, "max_speed", 177) print sum(b[9:16:2])
normal
{ "blob_id": "b5160a2574dd2c4eec542d7aca8288da0feadaba", "index": 5702, "step-1": "# Кицела Каролина ИВТ 3 курс \n# Вариант 6 \n# Найти сумму всех чисел с плавающей точкой\n\nb = (\"name\",\t\"\tDeLorean\tDMC-12\",\t\"motor_pos\",\t\"rear\",\t\"n_of_wheels\",\t4,\n\"n_of_passengers\",\t2,\t\"weight\",\t1.230,\t\...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(t): n, m = map(int, sys.stdin.readline().split()) q = deque(map(int, sys.stdin.readline().split())) count = 0 while q: highest = max(q) doc = q.popleft() m -= 1 if doc...
flexible
{ "blob_id": "a571abd88184c8d8bb05245e9c3ce2e4dabb4c09", "index": 615, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(t):\n n, m = map(int, sys.stdin.readline().split())\n q = deque(map(int, sys.stdin.readline().split()))\n count = 0\n while q:\n highest = max(q)\n ...
[ 0, 1, 2, 3 ]
import datetime import numpy as np import tensorflow as tf from alphai_time_series.performance_trials.performance import Metrics import alphai_cromulon_oracle.cromulon.evaluate as crocubot_eval import alphai_cromulon_oracle.cromulon.train as crocubot_train from alphai_cromulon_oracle.cromulon.helpers import Tensorfl...
normal
{ "blob_id": "bef16443f77b2c1e09db9950a4617703085d9f71", "index": 7807, "step-1": "<mask token>\n\n\ndef run_timed_benchmark_time_series(series_name, tf_flags, do_training=True):\n topology = load_default_topology(series_name, tf_flags)\n n_train_samples = np.minimum(tf_flags.n_training_samples_benchmark, 1...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render from PIL import Image from django.views.decorators import csrf import numpy as np import re import sys import os from .utils import * from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt import base64 sys.path.append(os.path.abspath("./models")) O...
normal
{ "blob_id": "b84b3206e87176feee2c39fc0866ada994c9ac7a", "index": 8655, "step-1": "<mask token>\n\n\ndef convertImage(imgData):\n getI420FromBase64(imgData)\n\n\n<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.abspath('./models'))\n<mask token>\n\n\ndef getI420FromBase64(codec):\n base64...
[ 1, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.plot(point_p1_s, point_p1_h, 'bs-') plt.plot(point_p2_s, point_p2_h, 'bs-') plt.plot(point_is_s, point_is_h, 'ys-') plt.plot(point_hp_s, point_hp_h, 'rs-', label='Expansion Line') <|reserved_special_token_0|> plt.legend(loc='b...
flexible
{ "blob_id": "ebe546794131eddea396bd6b82fbb41aeead4661", "index": 572, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.plot(point_p1_s, point_p1_h, 'bs-')\nplt.plot(point_p2_s, point_p2_h, 'bs-')\nplt.plot(point_is_s, point_is_h, 'ys-')\nplt.plot(point_hp_s, point_hp_h, 'rs-', label='Expansion Line')\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.fixture async def http_client(hass, hass_client_no_auth): """Initialize a Home Assistant Server for testing this module.""" await async_setup_component(hass, webhook.DOMAIN, {}) return await hass_client_no_au...
flexible
{ "blob_id": "a55024f0e5edec22125ce53ef54ee364be185cb8", "index": 1099, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture\nasync def http_client(hass, hass_client_no_auth):\n \"\"\"Initialize a Home Assistant Server for testing this module.\"\"\"\n await async_setup_component(hass, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> window.show() sys.exit(app.exec_()) <|reserved_special_token_1|> <|reserved_special_token_0|> app = QtGui.QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_()) <|reserved_special_token_1|> from PyQ...
flexible
{ "blob_id": "9e2af13a15a98702981e9ee369c3a132f61eac86", "index": 5174, "step-1": "<mask token>\n", "step-2": "<mask token>\nwindow.show()\nsys.exit(app.exec_())\n", "step-3": "<mask token>\napp = QtGui.QApplication(sys.argv)\nwindow = MainWindow()\nwindow.show()\nsys.exit(app.exec_())\n", "step-4": "from P...
[ 0, 1, 2, 3, 4 ]
from ROOT import * import os import sys from optparse import Option, OptionValueError, OptionParser Box = ["RawKLMnodeID","rawKLMlaneFlag","rawKLMtExtraRPC","rawKLMqExtraRPC","rawKLMtExtraScint","rawKLMqExtraScint","rawKLMsizeMultihit","rawKLM00channelMultiplicity","rawKLM00channelMultiplicityFine","rawKLM10channelMul...
normal
{ "blob_id": "19cf34e7c38045a183c75703ec56c17f96ee2ac4", "index": 9629, "step-1": "from ROOT import *\nimport os\nimport sys\nfrom optparse import Option, OptionValueError, OptionParser\n\nBox = [\"RawKLMnodeID\",\"rawKLMlaneFlag\",\"rawKLMtExtraRPC\",\"rawKLMqExtraRPC\",\"rawKLMtExtraScint\",\"rawKLMqExtraScint\...
[ 0 ]
<|reserved_special_token_0|> class DatabaseHands(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class DatabaseProbability(object): def __init__(self, database): self.conn = sql...
flexible
{ "blob_id": "f8c85f34fb55ee1c3b3020bcec87b60ae80e4ed2", "index": 3126, "step-1": "<mask token>\n\n\nclass DatabaseHands(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DatabaseProbability(object):\n\n def __init__(self, database):\n self.con...
[ 13, 16, 17, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def lambda_handler(event, context): for record in event['Records']: bucket = record['s3']['bucket']['name'] key = record['s3']['object']['key'] output_key = '{}.html'.format(key[:key.rfind('.md')]) ...
flexible
{ "blob_id": "3df57059539e5e3579c6dbee6be288e04b5f93b5", "index": 3400, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lambda_handler(event, context):\n for record in event['Records']:\n bucket = record['s3']['bucket']['name']\n key = record['s3']['object']['key']\n output_...
[ 0, 1, 2, 3, 4 ]