code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python # -*- coding: utf-8 -*- from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration import os import shutil class LibpopplerConan(ConanFile): name = "poppler" version = "0.73.0" description = "Poppler is a PDF rendering library based on the xpdf-3....
normal
{ "blob_id": "848394e1e23d568f64df8a98527a8e177b937767", "index": 3380, "step-1": "<mask token>\n\n\nclass LibpopplerConan(ConanFile):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 6, 7, 8, 9, 11 ]
#!/usr/bin/env python import os import sys from setuptools import setup from textwrap import dedent NAME = "docker-zabbix-script-sender" GITHUB_ORG_URL = "https://github.com/troptop/" ROOT_DIR = os.path.dirname(__file__) SOURCE_DIR = os.path.join(ROOT_DIR) exec(open('docker_zabbix_script_sender/version.py').read()) ...
normal
{ "blob_id": "0769003c248c099da5bcd75541d35234b01af5de", "index": 2723, "step-1": "<mask token>\n", "step-2": "<mask token>\nexec(open('docker_zabbix_script_sender/version.py').read())\nsetup(name=NAME, version=version, author='Cyril Moreau', author_email=\n 'cyril.moreauu@gmail.com', url=GITHUB_ORG_URL + '/...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import json from flask import jsonify from flask import make_response from MultipleInterfaceManager.settings import STATUS_CODE def _render(resp): response = make_response(jsonify(resp)) # response.headers["Access-Control-Allow-Origin"] = "*" return ...
normal
{ "blob_id": "a87ab07bb1502a75a7e705cd5c92db829ebdd966", "index": 8689, "step-1": "<mask token>\n\n\ndef _render(resp):\n response = make_response(jsonify(resp))\n return response\n\n\n<mask token>\n\n\ndef json_detail_render(code, data=[], message=None):\n if message is None:\n message = STATUS_C...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(app, data): MEDIUM_API_ENDPOINT = 'https://medium.com/{0}/latest?format=json' r = requests.get(MEDIUM_API_ENDPOINT.format(data.get('username'))) response_content = r.content.decode('utf-8') json_data = r...
flexible
{ "blob_id": "96936b7f6553bee06177eb66a2e63064c1bf51a6", "index": 8373, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(app, data):\n MEDIUM_API_ENDPOINT = 'https://medium.com/{0}/latest?format=json'\n r = requests.get(MEDIUM_API_ENDPOINT.format(data.get('username')))\n response_conte...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DBModel(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def get_matcher(self, matcher, nlp): for entity in self.entities: matcher.add(entity.name.upper() + '_TABLE', None, nlp(entity. name.lower())) for ...
flexible
{ "blob_id": "76ebab93441676f9f00b2c2d63435e72c2d5d1ba", "index": 9936, "step-1": "<mask token>\n\n\nclass DBModel(object):\n <mask token>\n <mask token>\n\n def get_matcher(self, matcher, nlp):\n for entity in self.entities:\n matcher.add(entity.name.upper() + '_TABLE', None, nlp(entit...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Book: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Book: <|reserved_special_token_0|> def __init__(self, title, authors, pub_year): self.title = title self.authors = aut...
flexible
{ "blob_id": "14345a8c4e20d84dfc87476d890f59530a8f4d96", "index": 7237, "step-1": "<mask token>\n", "step-2": "class Book:\n <mask token>\n <mask token>\n", "step-3": "class Book:\n <mask token>\n\n def __init__(self, title, authors, pub_year):\n self.title = title\n self.authors = a...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def square(): forward(100) right(90) forward(100) right(90) forward(100) right(90) forward(100) mainloop() def pentagon(): forward(100) right(72) forward(100) right(72) forward(100) right(72) forward(100) right(72) forw...
flexible
{ "blob_id": "92d689e5caa2d8c65f86af0f8b49b009d162a783", "index": 7379, "step-1": "<mask token>\n\n\ndef square():\n forward(100)\n right(90)\n forward(100)\n right(90)\n forward(100)\n right(90)\n forward(100)\n mainloop()\n\n\ndef pentagon():\n forward(100)\n right(72)\n forward...
[ 8, 10, 12, 14, 20 ]
# import os,sys # BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # sys.path.append(BASE_DIR) from lib import common from conf import settings import random import pickle import os import xlrd import time class Base: def save(self): file_path=r'%s/%s' %(self.DB_PATH,self.id) p...
normal
{ "blob_id": "7cd6a8a106c21e8e377666d584e19d30c607b7d2", "index": 9345, "step-1": "<mask token>\n\n\nclass Subject(Base):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def filter_question(cls):\n id_l = os.listdir(settings.QUESTION_PATH)\n r_id_l = random.sample(id_l...
[ 21, 23, 24, 27, 30 ]
# inserting logical unit ids for splitting texts into logical chunks import re import os splitter = "#META#Header#End#" def logical_units(file): ar_ra = re.compile("^[ذ١٢٣٤٥٦٧٨٩٠ّـضصثقفغعهخحجدًٌَُلإإشسيبلاتنمكطٍِلأأـئءؤرلاىةوزظْلآآ]+$") with open(file, "r", encoding="utf8") as f1: book = f1.read() ...
normal
{ "blob_id": "5c001303962315afe2512eb307376f6f7a883cf9", "index": 6831, "step-1": "<mask token>\n\n\ndef process_all(folder):\n exclude = ['OpenITI.github.io', 'Annotation', '_maintenance', 'i.mech']\n for root, dirs, files in os.walk(folder):\n dirs[:] = [d for d in dirs if d not in exclude]\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class CSVExporter: <|reserved_special_token_0|> <|reserved_special_token_0|> def reset(self, *_): """reset all""" @staticmethod async def _run(dlg: SaveFileDialog, mainview, ctrl, doc): paths = await mainview.threadmethod(dlg.save) if paths is...
flexible
{ "blob_id": "d120172e65f329b1137df38b693e5fe7145bc80d", "index": 2840, "step-1": "<mask token>\n\n\nclass CSVExporter:\n <mask token>\n <mask token>\n\n def reset(self, *_):\n \"\"\"reset all\"\"\"\n\n @staticmethod\n async def _run(dlg: SaveFileDialog, mainview, ctrl, doc):\n paths ...
[ 2, 7, 8, 9, 10 ]
from GRAFICA_BRESENHAMS import Bresenhams def main(): x = int(input('INGRESA VALOR PARA X: \n')) y = int(input('INGRESA VALOR PARA Y: \n')) x1 = int(input('INGRESA VALOR PARA X1: \n')) y1 = int(input('INGRESA VALOR PARA Y1: \n')) Bresenhams(x, y, x1, y1) if __name__ == '__main__': main()
normal
{ "blob_id": "e75bee4e014aa369131c3e200ce874a8840b5690", "index": 3573, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n x = int(input('INGRESA VALOR PARA X: \\n'))\n y = int(input('INGRESA VALOR PARA Y: \\n'))\n x1 = int(input('INGRESA VALOR PARA X1: \\n'))\n y1 = int(input('I...
[ 0, 1, 2, 3 ]
from __future__ import print_function import zmq import time import random import numpy as np import msgpack as serializer port = '42000' # let the OS choose the IP and PORT ipc_sub_url = 'tcp://*:*' ipc_push_url = 'tcp://*:*' # starting communication threads zmq_ctx = zmq.Context() pub_socket = zmq_ctx.socket(zmq....
normal
{ "blob_id": "cb469b69bf974d39609f79c4f3be686d8106f971", "index": 1431, "step-1": "<mask token>\n", "step-2": "<mask token>\npub_socket.bind('tcp://*:%s' % port)\nwhile True:\n topic = 'test'\n thisX = np.random.rand()\n thisY = np.random.rand()\n testDict = {'gaze': (thisX, thisY)}\n pub_socket....
[ 0, 1, 2, 3, 4 ]
from enum import Enum # Genie from genie.decorator import managedattribute from genie.conf.base import Base, \ DeviceFeature, \ LinkFeature, \ Interface import genie.conf.base.attributes from genie.libs.conf.base.feature import consoli...
normal
{ "blob_id": "6d2581b83a2839dcbc644ca572b05b158d80b58d", "index": 2479, "step-1": "<mask token>\n\n\nclass Keychains(DeviceFeature):\n <mask token>\n\n\n class DeviceAttributes(genie.conf.base.attributes.DeviceSubAttributes):\n\n\n class KeyChainAttributes(KeyedSubAttributes):\n\n def __in...
[ 4, 6, 7, 8, 9 ]
# getting a sample of data to parse for the keys of the players import requests import xml.etree.ElementTree as ET currentPlayerInfoUrl="http://stats.nba.com/stats/commonallplayers?IsOnlyCurrentSeason=1&LeagueID=00&Season=2015-16" r=requests.get(currentPlayerInfoUrl) if r.status_code == requests.codes.ok: with open(...
normal
{ "blob_id": "68f8b301d86659f9d76de443b0afe93fd7f7e8c2", "index": 6588, "step-1": "<mask token>\n", "step-2": "<mask token>\nif r.status_code == requests.codes.ok:\n with open('currentPlayerDump.json', 'w') as f:\n for line in r.text:\n f.write(line)\n", "step-3": "<mask token>\ncurrentPl...
[ 0, 1, 2, 3, 4 ]
from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from sklearn.datasets import load_iris from sklearn.model_selection import cross_val_score iris_dataset=load_iris() X=iris_dataset['data'] y=iris_dataset['target'] X_tra...
normal
{ "blob_id": "cc46485a3b5c68e4f77a2f9a033fd2ee2859b52b", "index": 978, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(1, 11):\n tree = DecisionTreeClassifier(max_depth=4, random_state=c)\n model.append(tree.fit(X_train, y_train))\n<mask token>\nfor a in model:\n in_sample_accuracy....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('HELLO3') <|reserved_special_token_1|> print("HELLO3")
flexible
{ "blob_id": "74be250df785590ecf45e048b0d6189e2b445889", "index": 2181, "step-1": "<mask token>\n", "step-2": "print('HELLO3')\n", "step-3": "print(\"HELLO3\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Jobs: def __init__(self, name, type, experience, education, keyword, salary, url, start, end): self.name = name self.type = type self.experience = experience self.education = education self.keyword = keyword self.salary = ...
flexible
{ "blob_id": "bcc24d5f97e46433acb8bcfb08fe582f51eb28ce", "index": 2932, "step-1": "<mask token>\n\n\nclass Jobs:\n\n def __init__(self, name, type, experience, education, keyword, salary,\n url, start, end):\n self.name = name\n self.type = type\n self.experience = experience\n ...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> class TestParsers(unittest.TestCase): <|reserved_special_token_0|> def test_part_date_short(self): date = '8/5/13 16:14' self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest. parse_date_short(date)) def test_parse_line(self): ...
flexible
{ "blob_id": "253d37f29e33f61d7e1a5ec2f9a1d6307a2ae108", "index": 6921, "step-1": "<mask token>\n\n\nclass TestParsers(unittest.TestCase):\n <mask token>\n\n def test_part_date_short(self):\n date = '8/5/13 16:14'\n self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.\n ...
[ 3, 4, 5, 6, 7 ]
from pyrogram import Client, filters from pyrogram.errors import MessageNotModified from db.models import * @Client.on_callback_query(filters.regex('^change_lg_')) async def on_change_language(_, callback): settings_id = int(callback.data.split('_')[2]) with db_session: settings = SettingsInstance.g...
normal
{ "blob_id": "dd053da45d2577772414b1373ba324b0bfdc0d94", "index": 6605, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@Client.on_callback_query(filters.regex('^change_lg_'))\nasync def on_change_language(_, callback):\n settings_id = int(callback.data.split('_')[2])\n with db_session:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Solution: def solution(self, rootA, rootB): if rootA == rootB: print('h') return True if rootA is None or rootB is None: return False return rootA.val == rootB.val and self.solution(rootA.left, rootB.left )...
flexible
{ "blob_id": "4a0eca90de3ce7fb0ab6decb0ec6aadb32c1a9fa", "index": 601, "step-1": "<mask token>\n\n\nclass Solution:\n\n def solution(self, rootA, rootB):\n if rootA == rootB:\n print('h')\n return True\n if rootA is None or rootB is None:\n return False\n r...
[ 2, 3, 4, 5, 6 ]
#API End Points by Mitul import urllib.error, urllib.request, urllib.parse import json target = 'http://py4e-data.dr-chuck.net/json?' local = input('Enter location: ') url = target + urllib.parse.urlencode({'address': local, 'key' : 42}) print('Retriving', url) data = urllib.request.urlopen(url).read() print('Retrive...
normal
{ "blob_id": "d34159536e860719094a36cfc30ffb5fcae72a9a", "index": 296, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Retriving', url)\n<mask token>\nprint('Retrived', len(data), 'characters')\n<mask token>\nprint(json.dumps(js, indent=4))\nprint('Place id', js['results'][0]['place_id'])\n<mask tok...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Tue Apr 25 13:34:46 2017 @author: Sven Geboers """ from math import pi,e import numpy as np import matplotlib.pyplot as plt from matplotlib import cm def LevelToIntensity(NoiseLevelIndB): I0 = 10.**(-12) #This is the treshold hearing intensity, matchin...
normal
{ "blob_id": "68a1d5a77abd19aece04bd560df121ceddccea42", "index": 3179, "step-1": "<mask token>\n\n\ndef LevelToIntensity(NoiseLevelIndB):\n I0 = 10.0 ** -12\n NoiseLevel = float(NoiseLevelIndB)\n Intensity = I0 * 10 ** (NoiseLevel / 10)\n return Intensity\n\n\ndef IntensityToLevel(Intensity):\n I0...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^class/([^/]+)/?$', views.puppet_class, name= 'puppet-class'), url('^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'), url('^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='ad...
flexible
{ "blob_id": "add56d52f3c88f814a166d12c3bc5a5906268864", "index": 484, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^class/([^/]+)/?$', views.puppet_class, name=\n 'puppet-class'), url('^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host,\n name='edit-host'), url('^add-host/(?P<fq...
[ 0, 1, 2, 3 ]
# Reference: https://docs.python.org/2/library/unittest.html import unittest import sys sys.path.append('..') from database_utils import DatabaseUtils class Test_DatabaseUtils(unittest.TestCase): def setUp(self): self.db=DatabaseUtils() def dataCount(self): with self.db.connection.cursor()...
normal
{ "blob_id": "ff8e8af72a8eb97a392fcfec5960eed7a2e51f68", "index": 9211, "step-1": "<mask token>\n\n\nclass Test_DatabaseUtils(unittest.TestCase):\n\n def setUp(self):\n self.db = DatabaseUtils()\n <mask token>\n\n def test_getUser(self):\n count = self.dataCount()\n try:\n ...
[ 9, 10, 13, 17, 18 ]
from flask import render_template, url_for, escape, redirect, abort from app import core from database import db @core.route('/post') @core.route('/categorie') @core.route('/tag') def returnToHome(): return redirect(url_for('home'))
normal
{ "blob_id": "c27d6279d1ea84bab3c0abd4ca9a08de202219da", "index": 1748, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@core.route('/post')\n@core.route('/categorie')\n@core.route('/tag')\ndef returnToHome():\n return redirect(url_for('home'))\n", "step-3": "from flask import render_template, url...
[ 0, 1, 2 ]
def assert_number(arg): if not isinstance(arg, (int, float)): raise TypeError(f"Expected number, got {type(arg)}")
normal
{ "blob_id": "2de62c73507acac597d70557adfe8286e2f28a1f", "index": 5569, "step-1": "<mask token>\n", "step-2": "def assert_number(arg):\n if not isinstance(arg, (int, float)):\n raise TypeError(f'Expected number, got {type(arg)}')\n", "step-3": "def assert_number(arg):\n if not isinstance(arg, (in...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def get_char(): global next_c, limit if next_c == limit: next_c = 0 limit = read(0, 100) if limit == 0: return '' if next_c >= len(limit) - 1: return '' ch = chr(limit[next_c]) next_c += 1 return ch <|reserved_special_t...
flexible
{ "blob_id": "67ac5d82bc37b67cfdae73b6667b73b70ed33cfb", "index": 8868, "step-1": "<mask token>\n\n\ndef get_char():\n global next_c, limit\n if next_c == limit:\n next_c = 0\n limit = read(0, 100)\n if limit == 0:\n return ''\n if next_c >= len(limit) - 1:\n return...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('dummyoutput.txt', 'r') as file_object: data = file_object.readlines() for line in data: words = line.split(';') for i in range(1, len(words), 4): if db.get(words[i], 0) != 0: ...
flexible
{ "blob_id": "69eb62ba47a63cf007334c777709b0513d75f396", "index": 1504, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('dummyoutput.txt', 'r') as file_object:\n data = file_object.readlines()\n for line in data:\n words = line.split(';')\n for i in range(1, len(words), 4):\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 21 11:40:26 2020 @author: jlee """ import time start_time = time.time() import numpy as np import glob, os from astropy.io import fits import init_cfg as ic # ----- Making scripts for PSFEx ----- # os.system("psfex -dd > config.psfex") if ic....
normal
{ "blob_id": "c23125018a77508dad6fd2cb86ec6d556fbd1019", "index": 90, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('psfex -dd > config.psfex')\nif ic.use_backsub:\n prefix = 'b'\nelse:\n prefix = ''\n<mask token>\nf.write('\\n')\nf.write('#############################' + '\\n')\nf.write(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CMD(Cmd): def __init__(self): pass <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def do_drawCard(self): pass <|reserved_special_token_0|> def do_fight(self): pass def do_save(self, f...
flexible
{ "blob_id": "03a024140d8d0136bf9838f8942539f6d19bb351", "index": 1866, "step-1": "<mask token>\n\n\nclass CMD(Cmd):\n\n def __init__(self):\n pass\n <mask token>\n <mask token>\n <mask token>\n\n def do_drawCard(self):\n pass\n <mask token>\n\n def do_fight(self):\n pass...
[ 7, 11, 12, 13, 15 ]
from django.http import HttpResponseRedirect from django.shortcuts import render __author__ = 'jhonjairoroa87' from rest_framework.views import APIView from rest_framework.response import Response from rest_framework_jsonp.renderers import JSONPRenderer from django.db import models from .form import NameForm def mu...
normal
{ "blob_id": "4c483636316dfa660f10b1aba900813bc3e95ebe", "index": 9463, "step-1": "<mask token>\n\n\nclass Divide(APIView):\n renderer_classes = JSONPRenderer,\n\n @staticmethod\n def get(request):\n try:\n first_number = int(request.GET.get('a'))\n second_number = int(reques...
[ 3, 6, 9, 10, 11 ]
<|reserved_special_token_0|> class TestExperimentOpen(unittest.TestCase): <|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|> <|reserve...
flexible
{ "blob_id": "dfee0407eaed7b1ab96467874bbfe6463865bcb4", "index": 6238, "step-1": "<mask token>\n\n\nclass TestExperimentOpen(unittest.TestCase):\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\n\nclass TestMalformed...
[ 18, 19, 24, 27, 29 ]
import os def take_shot(filename): os.system("screencapture "+filename+".png")
normal
{ "blob_id": "f4c90a6d6afdcf78ec6742b1924a5c854a5a4ed6", "index": 1825, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef take_shot(filename):\n os.system('screencapture ' + filename + '.png')\n", "step-3": "import os\n\n\ndef take_shot(filename):\n os.system('screencapture ' + filename + '.p...
[ 0, 1, 2, 3 ]
import os from typing import Union, Tuple, List import pandas as pd from flags import FLAGS from helpers import load_from_pickle, decode_class, sort_results_by_metric ROOT = FLAGS.ROOT RESULTS_FOLDER = FLAGS.RESULTS_FOLDER FULL_PATH_TO_CHECKPOINTS = os.path.join(ROOT, RESULTS_FOLDER, "checkpoints") def eval_resul...
normal
{ "blob_id": "5447bd3b08c22913ae50ee66ee81554d2357ef3e", "index": 3991, "step-1": "<mask token>\n\n\ndef eval_results(time_stamps: Union[Tuple, List], excel_file_path=os.path.\n join(FULL_PATH_TO_CHECKPOINTS, f'xVal_results.xlsx')):\n with pd.ExcelWriter(excel_file_path, mode='w') as writer:\n for ts...
[ 1, 2, 3, 4, 5 ]
__author__ = 'Jager' from char import Character class Rouge (Character): def special_attack1(self, opponent, hitdamage_callback, specatt_callback): pass # hook method def special_attack2(self, opponent, hitdamage_callback, specatt_callback): pass # hook method def heal(self, target...
normal
{ "blob_id": "36991c3191ba48b1b9dbd843e279f8fe124f1339", "index": 73, "step-1": "<mask token>\n\n\nclass Rouge(Character):\n\n def special_attack1(self, opponent, hitdamage_callback, specatt_callback):\n pass\n\n def special_attack2(self, opponent, hitdamage_callback, specatt_callback):\n pass...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def parse_mapdata_test(): current_folder = os.path.dirname(os.path.realpath(__file__)) misc_folder = os.path.join(current_folder, 'misc') maplistdata_path = os.path.join(misc_folder, 'MapList.dat') result = copy....
flexible
{ "blob_id": "4dfdbc692858a627248cbe47d19b43c2a27ec70e", "index": 7373, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_mapdata_test():\n current_folder = os.path.dirname(os.path.realpath(__file__))\n misc_folder = os.path.join(current_folder, 'misc')\n maplistdata_path = os.path.joi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: password = ''.join(secrets.choice(alphabets) for i in range(10)) if any(c.islower() for c in password) and any(c.isupper() for c in password ) and sum(c.isdigit() for c in password) >= 3: print(...
flexible
{ "blob_id": "0c283cd31203291da24226a0eae781bd397e84d4", "index": 9526, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n password = ''.join(secrets.choice(alphabets) for i in range(10))\n if any(c.islower() for c in password) and any(c.isupper() for c in password\n ) and sum(c.isd...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('admin/', admin.site.urls), path('', include( 'blog.urls', namespace='blog')), url('^hello/([0-9]{4})/$', view.hello), url('^ifor/', view.ifor)] <|reserved_special_token_0|> <|reserved_special_token_1...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while num > 1: for i in range(2, num + 1): if num % i == 0: a.append(i) num = num // i break print('%d =' % original, end='') for i in range(len(a) - 1): print(a[i], end='*') pri...
flexible
{ "blob_id": "78e72bf3ac73113e2c71caf5aed70b53cafa9c46", "index": 3413, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile num > 1:\n for i in range(2, num + 1):\n if num % i == 0:\n a.append(i)\n num = num // i\n break\nprint('%d =' % original, end='')\nfor i ...
[ 0, 1, 2, 3 ]
from tkinter import* from tkinter import filedialog import sqlite3 class Gui: def __init__(self): global en3 self.scr = Tk() self.scr.geometry("2000x3000") self.scr.title("VIEWING DATABASE") self.connection = sqlite3.connect("student_details.db") ...
normal
{ "blob_id": "4c6b04716f41c3413896f0d59f2cc9b1475d7f64", "index": 5164, "step-1": "<mask token>\n\n\nclass Gui:\n <mask token>\n\n def insert_data(self):\n self.id = e.get()\n self.name1 = e1.get()\n self.fathername = e2.get()\n self.mothername = e3.get()\n self.cont = e4....
[ 9, 12, 17, 18, 20 ]
import random from z3 import * def combine(iter): tmp_list = [i for i in iter] res = tmp_list[0] for i in tmp_list[1:]: res += i return res def co_prime(num1, num2): for num in range(2, min(num1, num2) + 1): if num1 % num == 0 and num2 % num == 0: return False re...
normal
{ "blob_id": "81fce5314a7611de11648e412151112e29271871", "index": 4626, "step-1": "<mask token>\n\n\nclass FormulaTemplate:\n\n def __init__(self, vi, w, k, h, m, timeout=3000000):\n self.k = k\n self.h = h\n self.m = m\n self.w = w\n self.vi = vi\n n = len(vi)\n ...
[ 11, 14, 15, 16, 22 ]
<|reserved_special_token_0|> def test_linearSVC(*data): X_train, X_test, y_train, y_test = data cls = svm.LinearSVC() cls.fit(X_train, y_train) print('Coefficients:%s,Intercept:%s' % (cls.coef_, cls.intercept_)) print('Scors:%.2f' % cls.score(X_test, y_test)) def test_SVC_linear(*data): X_tr...
flexible
{ "blob_id": "49995e60b817e2c5a2ea7e85e4fe96ca95363cb2", "index": 2148, "step-1": "<mask token>\n\n\ndef test_linearSVC(*data):\n X_train, X_test, y_train, y_test = data\n cls = svm.LinearSVC()\n cls.fit(X_train, y_train)\n print('Coefficients:%s,Intercept:%s' % (cls.coef_, cls.intercept_))\n print...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class UniformBall(mc.Gibbs): def __init__(self, stochastic, others, verbose=None): self.others = others self.conjugate = True mc.Gibbs.__init__(self, stochastic, verbose) def propose(self): x_other = [X_i.value for X_i in self.others] max_...
flexible
{ "blob_id": "8283bdab023e22bba3d8a05f8bda0014ee19adee", "index": 4286, "step-1": "<mask token>\n\n\nclass UniformBall(mc.Gibbs):\n\n def __init__(self, stochastic, others, verbose=None):\n self.others = others\n self.conjugate = True\n mc.Gibbs.__init__(self, stochastic, verbose)\n\n d...
[ 3, 6, 7, 8, 11 ]
<|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": "2f7be68f08716d5d04d064d81eecb53eb9b80174", "index": 7635, "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 = [('productores...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MultiSkin_UI(MayaQWidgetDockableMixin, QtWidgets.QDialog): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def widgetsAndLayouts(self): def addLine(): line = QtWidgets.QFrame() line.setFrameShap...
flexible
{ "blob_id": "819607d89035413fc2800e9f16222619a74a5d64", "index": 6429, "step-1": "<mask token>\n\n\nclass MultiSkin_UI(MayaQWidgetDockableMixin, QtWidgets.QDialog):\n <mask token>\n <mask token>\n <mask token>\n\n def widgetsAndLayouts(self):\n\n def addLine():\n line = QtWidgets.QF...
[ 17, 18, 23, 24, 28 ]
<|reserved_special_token_0|> class Event(db.Model): <|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": "f3167d8f1a806c38fb10672605d8e94265d2fc9c", "index": 723, "step-1": "<mask token>\n\n\nclass Event(db.Model):\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 <mask ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def rating_msg(rating): if rating > 80: return 'You should watch this movie right now!\n' elif rating < 50: return 'Avoid this movie at all cost!\n' else: return '' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_...
flexible
{ "blob_id": "7f33effa86fc3a80fce0e5e1ecf97ab4ca80402d", "index": 1833, "step-1": "<mask token>\n\n\ndef rating_msg(rating):\n if rating > 80:\n return 'You should watch this movie right now!\\n'\n elif rating < 50:\n return 'Avoid this movie at all cost!\\n'\n else:\n return ''\n\n\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> config_info = {'n_input': 1, 'num_layers': 1, 'features': 20, 'sequence_length': 1344, 'num_steps': None, 'lstm_size': None, 'batch_size': None, 'init_learning_rate': None, 'learning_rate_decay': None, 'init_epoch': None, 'max_epoch': None, 'dropo...
flexible
{ "blob_id": "8ede786526f4b730173777d9d3b9c7e4554fc887", "index": 2443, "step-1": "<mask token>\n", "step-2": "config_info = {'n_input': 1, 'num_layers': 1, 'features': 20,\n 'sequence_length': 1344, 'num_steps': None, 'lstm_size': None,\n 'batch_size': None, 'init_learning_rate': None, 'learning_rate_dec...
[ 0, 1 ]
from abc import ABC from rest_framework import serializers from shopping_cars.models import Order, ShoppingCart class OrderSerializer(serializers.ModelSerializer): class Meta: model = Order fields = '__all__' class OrderProductSerializer(serializers.ModelSerializer): class Meta: mode...
normal
{ "blob_id": "9c14f024b25c5014567405535dbe5a6c787cfe28", "index": 6529, "step-1": "<mask token>\n\n\nclass OrderProductSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = ShoppingCart\n fields = '__all__'\n\n def validate_quantity(self, value):\n if value <= 0:\n ...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> def register_extensions(app): """Register Flask extensions.""" assets.init_app(app) hashing.init_app(app) cache.init_app(app) db.init_app(app) login_manager.init_app(app) migrate.init_app(app, db) init_mailman(app) init_talisman(app) return None <...
flexible
{ "blob_id": "2257f73a290dfd428a874e963c26e51f1c1f1efa", "index": 927, "step-1": "<mask token>\n\n\ndef register_extensions(app):\n \"\"\"Register Flask extensions.\"\"\"\n assets.init_app(app)\n hashing.init_app(app)\n cache.init_app(app)\n db.init_app(app)\n login_manager.init_app(app)\n mi...
[ 5, 9, 10, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_teacherData(): excelDir = '../data/松勤-教管系统接口测试用例-v1.4.xls' workBook = xlrd.open_workbook(excelDir, formatting_info=True) workSheet = workBook.sheet_by_name('3-老师模块') dataList = [] for cnt in range(1, ...
flexible
{ "blob_id": "d7dee3311e202ae50172077940fc625f1cc6836d", "index": 1429, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_teacherData():\n excelDir = '../data/松勤-教管系统接口测试用例-v1.4.xls'\n workBook = xlrd.open_workbook(excelDir, formatting_info=True)\n workSheet = workBook.sheet_by_name('3-老...
[ 0, 1, 2, 3, 4 ]
from app import db class OrgStaff(db.Model): __tablename__ = 'org_staff' id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id', ondelete="CASCADE")) invited_by = db.Column(db.Integer, db.ForeignKey('users.id', ondelete="CASCADE")) org_id = db.Column(...
normal
{ "blob_id": "b0f92b5e4cc972aca84a29b4568e85836f155273", "index": 3774, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass OrgStaff(db.Model):\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 to...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import h5py class HDF5_Parser(object): # noqa: N801 """ Examples -------- >>> import h5py >>> indata = h5py.File('test.hdf5') >>> dataset = indata.create_dataset("mydataset", (10,), dtype='i') >>> indata.close() >>> with open('test.hdf5') as f: ... da...
normal
{ "blob_id": "0beb5c5c5db9247d66a5a49cfff7282ead52a9b7", "index": 716, "step-1": "<mask token>\n\n\nclass HDF5_Parser(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def read_file(self, file_obj, **kwargs):\n return h5py.File(file_obj.name, mode='r')\n", "step-2": ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test_Proxy: def __init__(self): self.db = RedisClient() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test_Proxy: def __init__(self): self.d...
flexible
{ "blob_id": "2cbdb828ab6e0ad44154f0c5b2a1d807fd0d2520", "index": 8783, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test_Proxy:\n\n def __init__(self):\n self.db = RedisClient()\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test_Proxy:\n\n def __init__(self):\n ...
[ 0, 2, 3, 4, 5 ]
# Generated by Django 3.1.2 on 2020-10-17 15:46 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('story1', '0006_visitor'), ] operations = [ migrations.RenameField( model_name='visitor', old_name='identitiy_n...
normal
{ "blob_id": "1aaace83af0235341d10b8ac3b47d00a944dac37", "index": 1422, "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 = [('story1', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_pixel_image(): pi = PixelImage((1, 3, 128, 128), 0.01) pi() start = torch.randn(3, 128, 128) pi = PixelImage((1, 3, 128, 128), init_img=start) assert start.allclose(pi() + 0.5, atol=1e-07) <|reserved_special_token_0|> def test_parameterized_img(): star...
flexible
{ "blob_id": "73cacc1317c8624b45c017144bc7449bc99bd045", "index": 9542, "step-1": "<mask token>\n\n\ndef test_pixel_image():\n pi = PixelImage((1, 3, 128, 128), 0.01)\n pi()\n start = torch.randn(3, 128, 128)\n pi = PixelImage((1, 3, 128, 128), init_img=start)\n assert start.allclose(pi() + 0.5, at...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def roundMultiple(num, multiple): if num % multiple: return num + (multiple - num % multiple) return num <|reserved_special_token_0|> def incrementStats(msgChannel, statsFile, winner, losers): data = readDB(statsFile) if data == 0: return ERROR_DB_NOT_F...
flexible
{ "blob_id": "5869669f1e3f648c0ddc68683f0b1d2754b40169", "index": 8714, "step-1": "<mask token>\n\n\ndef roundMultiple(num, multiple):\n if num % multiple:\n return num + (multiple - num % multiple)\n return num\n\n\n<mask token>\n\n\ndef incrementStats(msgChannel, statsFile, winner, losers):\n da...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> class LogoutView(APIView): def get(self, request): logout(request) return Response({'response': 'logged out'}, status=status.HTTP_200_OK) <|reserved_special_token_1|> <|reserved_special_token_0|> class RegistrationView(APIView): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "6a5a6bdb0740d51426aa8b36dd3cc317103412b1", "index": 641, "step-1": "<mask token>\n\n\nclass LogoutView(APIView):\n\n def get(self, request):\n logout(request)\n return Response({'response': 'logged out'}, status=status.HTTP_200_OK)\n", "step-2": "<mask token>\n\n\nclass Registrati...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python # set up parameters that we care about PACKAGE = 'jsk_pcl_ros' from dynamic_reconfigure.parameter_generator_catkin import *; from math import pi gen = ParameterGenerator () gen.add("segment_connect_normal_threshold", double_t, 0, "threshold of normal to connect clusters", 0.9, 0.0, 1.0...
normal
{ "blob_id": "7127df5515e93e27b431c57bec1709475fec8388", "index": 5238, "step-1": "<mask token>\n", "step-2": "<mask token>\ngen.add('segment_connect_normal_threshold', double_t, 0,\n 'threshold of normal to connect clusters', 0.9, 0.0, 1.0)\ngen.add('ewma_tau', double_t, 0,\n 'tau parameter of EWMA to co...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def spacePortMenu(player, planet): global turnCounter while True: cleanScreen() print('****W*E*L*C*O*M*E****T*O****T*H*E****S*P*A*C*E*P*O*R*T****') print('Enter 1 to jump to a agri planet (risk 5%)') print('Enter 2 to jump to a tech planet (risk 10...
flexible
{ "blob_id": "97611fef5faafe660c7640e4a5aec8456e52135c", "index": 9960, "step-1": "<mask token>\n\n\ndef spacePortMenu(player, planet):\n global turnCounter\n while True:\n cleanScreen()\n print('****W*E*L*C*O*M*E****T*O****T*H*E****S*P*A*C*E*P*O*R*T****')\n print('Enter 1 to jump to a ...
[ 2, 5, 8, 9, 10 ]
# -*- coding: utf-8 -*- # Project = https://github.com/super-l/search-url.git # Author = superl # Blog = www.superl.org QQ:86717375 # Team = Code Security Team(C.S.T) | 铭剑创鼎 import urllib2 import re import ConfigParser from lib.filter import * from lib.getdata import * from lib.count import * from lib.status...
normal
{ "blob_id": "b724b04c6303cc9021539ad7df5a198000491029", "index": 5436, "step-1": "<mask token>\n\n\nclass Baidu:\n <mask token>\n <mask token>\n\n def __init__(self, count):\n cfg = ConfigParser.ConfigParser()\n cfg.read('config/setting.conf')\n self.baidu_page_size = int(cfg.get('s...
[ 2, 3, 4, 5, 6 ]
import sqlite3 if __name__ == '__main__': conn = sqlite3.connect('donations.sqlite') c = conn.cursor() query = """DROP TABLE IF EXISTS factions;""" c.execute(query) query = """DROP TABLE IF EXISTS members;""" c.execute(query) query = """DROP TABLE IF EXISTS bank;""" c.execute(query) ...
normal
{ "blob_id": "b6b8dfaa9644fa4f4c250358b89f4a30c26c317f", "index": 4788, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n conn = sqlite3.connect('donations.sqlite')\n c = conn.cursor()\n query = 'DROP TABLE IF EXISTS factions;'\n c.execute(query)\n query = 'DROP TA...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def view(): connect = sqlite3.connect('books.db') cursor = connect.cursor() cursor.execute('SELECT * FROM bookstore') books = cursor.fetchall() connect.close() return books <|reserved_special_token_0|> def delete(id): connect = sqlite3.connect('books.db') ...
flexible
{ "blob_id": "d7d23b04f6e73db6a0a8730192398941743f32ce", "index": 6800, "step-1": "<mask token>\n\n\ndef view():\n connect = sqlite3.connect('books.db')\n cursor = connect.cursor()\n cursor.execute('SELECT * FROM bookstore')\n books = cursor.fetchall()\n connect.close()\n return books\n\n\n<mask...
[ 4, 6, 7, 8, 10 ]
import json import time from pytest_influxdb.data_manager import DataManager class SuiteResultDTO: __run = 'UNDEFINED' __project = 'UNDEFINED' __version = 'UNDEFINED' __passed = None __failed = None __skipped = None __error = None __duration_sec = 0 __disabled = 0 __retries = ...
normal
{ "blob_id": "84c3427a994bd6c57d9fa8449e4fc7a3de801170", "index": 9271, "step-1": "<mask token>\n\n\nclass SuiteResultDTO:\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 <mask ...
[ 13, 14, 15, 16, 21 ]
import sys from . import cli def main() ->None: try: command = sys.argv[0] args = sys.argv[1:] cli.main(command, args) except KeyboardInterrupt: pass
normal
{ "blob_id": "9969dcf820a5ff34b483593cd43e4dfba9588ed2", "index": 4348, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main() ->None:\n try:\n command = sys.argv[0]\n args = sys.argv[1:]\n cli.main(command, args)\n except KeyboardInterrupt:\n pass\n", "step-3": ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def replaceNode(nfa, old, new): if DEBUG: print('R_Start(%s, %s) ---' % (old, new), nfa) if old in nfa._deltas: for input in nfa._deltas[old]: nfa.addDelta(new, input, nfa._deltas[old][input]) del nfa._deltas[old] if DEBUG: print('R_...
flexible
{ "blob_id": "2fe20f28fc7bba6b8188f5068e2b3c8b87c15edc", "index": 94, "step-1": "<mask token>\n\n\ndef replaceNode(nfa, old, new):\n if DEBUG:\n print('R_Start(%s, %s) ---' % (old, new), nfa)\n if old in nfa._deltas:\n for input in nfa._deltas[old]:\n nfa.addDelta(new, input, nfa._d...
[ 8, 9, 11, 13, 14 ]
def solution(record): answer = [] arr = dict() history = [] for i in record: tmp = i.split() if tmp[0] == "Enter" : arr[tmp[1]] = tmp[2] history.append([tmp[1], "님이 들어왔습니다."]) elif tmp[0] == "Leave" : history.append([tmp[1], "님이 나갔습니다."]) ...
normal
{ "blob_id": "d9f66cc3ba40292c49da08d7573d4c605a2771ae", "index": 3730, "step-1": "<mask token>\n", "step-2": "def solution(record):\n answer = []\n arr = dict()\n history = []\n for i in record:\n tmp = i.split()\n if tmp[0] == 'Enter':\n arr[tmp[1]] = tmp[2]\n h...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(good_testfile, 'r') as f: print('预测数据集: ' + good_testfile) preicdtlist = [i.strip('\n') for i in f.readlines()[:]] result = a.predict(preicdtlist) print('恶意结果 前10条' + str(result[1][:10])) print('正常结果 ...
flexible
{ "blob_id": "e627bcc6c9a49d46190cc793a77103aa0a760989", "index": 1709, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(good_testfile, 'r') as f:\n print('预测数据集: ' + good_testfile)\n preicdtlist = [i.strip('\\n') for i in f.readlines()[:]]\n result = a.predict(preicdtlist)\n print('恶意...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def paragraph_spacing(): doc = SimpleDocTemplate('paragraph_spacing.pdf', pagesize=letter) styles = getSampleStyleSheet() styles['Normal'].spaceBefore = 10 styles['Normal'].spaceAfter = 10 flowables = [] ...
flexible
{ "blob_id": "d79e65b7aa09066230dec1a472f4535dff4123b5", "index": 4217, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef paragraph_spacing():\n doc = SimpleDocTemplate('paragraph_spacing.pdf', pagesize=letter)\n styles = getSampleStyleSheet()\n styles['Normal'].spaceBefore = 10\n styles[...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import os import re import pycolor import sys pyc = pycolor.pyColor() def decompile(mainapk): print pyc.Info("Decompiling apks...") os.system("bash apktool.sh d -f %s"%mainapk) os.system("bash apktool.sh d -f temp.apk") def inject(mainapk): print pyc.Info("Injecting payload...") mk = "mkd...
normal
{ "blob_id": "fcc73647a5e841bcb5ea4fcd06579cc6912cfe1e", "index": 435, "step-1": "#!/usr/bin/env python\n\nimport os\nimport re\nimport pycolor\nimport sys\n\npyc = pycolor.pyColor()\n\ndef decompile(mainapk):\n\tprint pyc.Info(\"Decompiling apks...\")\n\tos.system(\"bash apktool.sh d -f %s\"%mainapk)\n\tos.syste...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): parser = argparse.ArgumentParser(prog='update_test_files.py') parser.add_argument('--tests', dest='tests_dir', required=True, help= 'The path to the existing RSMTool tests directory') parser.add_a...
flexible
{ "blob_id": "7e20c61fa30ea93e69a2479e70449638eb52b7bb", "index": 2964, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(prog='update_test_files.py')\n parser.add_argument('--tests', dest='tests_dir', required=True, help=\n 'The path to the exi...
[ 0, 1, 2, 3, 4 ]
from django.urls import path, re_path from app.views import UploaderAPIView, TeacherListAPIView, TeacherDetailAPIView app_name = "directory" urlpatterns = [ re_path(r"^directory/uploader/?$", UploaderAPIView.as_view(), name="teacher_uploader"), re_path(r"^directory/teachers/?$", TeacherListAPIView.as_view(), ...
normal
{ "blob_id": "666e839b4d66dc4eede4e7325bfd4f4b801fd47d", "index": 5330, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'directory'\nurlpatterns = [re_path('^directory/uploader/?$', UploaderAPIView.as_view(),\n name='teacher_uploader'), re_path('^directory/teachers/?$',\n TeacherListAPIVie...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while x > 0: print(x), time.sleep(1) x = x - 1 while x == 0: print('MEOW') webbrowser.open('https://www.youtube.com/watch?v=IuysY1BekOE') <|reserved_special_token_1|> <|reserved_special_token_0|> x = 10 while x ...
flexible
{ "blob_id": "4d31357936ce53b2be5f9a952b99df58baffe7ea", "index": 4937, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile x > 0:\n print(x), time.sleep(1)\n x = x - 1\nwhile x == 0:\n print('MEOW')\n webbrowser.open('https://www.youtube.com/watch?v=IuysY1BekOE')\n", "step-3": "<mask token...
[ 0, 1, 2, 3, 4 ]
class FieldDesigner: """ Designs a field for BattleShips, accepts field height and width """ def __init__( self, ): self.field = [] def design_field( self, height, width, ): self.field = [[ '~' for __ ...
normal
{ "blob_id": "c812419e7e024b0bb1207832b2b4a726ef61b272", "index": 9137, "step-1": "class FieldDesigner:\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return '\\n'.join(map(str, self.field))\n", "step-2": "class FieldDesigner:\n <mask token>\n\n def __init__(self)...
[ 2, 3, 4, 5, 6 ]
import numpy as np from nn.feedforward_nn import Feed_Forward class RMSprop(object): def __init__(self,n_in,n_hid,n_out,regularization_coe): self.nn = Feed_Forward(n_in,n_hid,n_out,regularization_coe) def set_param(self,param): if 'learning_rate' in param.keys(): self.learning_rat...
normal
{ "blob_id": "f971302f39149bcdcbe4237cc71219572db600d4", "index": 8720, "step-1": "<mask token>\n\n\nclass RMSprop(object):\n\n def __init__(self, n_in, n_hid, n_out, regularization_coe):\n self.nn = Feed_Forward(n_in, n_hid, n_out, regularization_coe)\n <mask token>\n <mask token>\n <mask toke...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: from setuptools import setup, find_packages except ImportError: import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages setup(name='pip-utils', version='0.0.1', url= 'https://github.com/mattpaletta/pip-ut...
flexible
{ "blob_id": "5fe81a6143642d671686c6623a9ecc93e04a82bf", "index": 5711, "step-1": "<mask token>\n", "step-2": "try:\n from setuptools import setup, find_packages\nexcept ImportError:\n import ez_setup\n ez_setup.use_setuptools()\n from setuptools import setup, find_packages\nsetup(name='pip-utils', ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Ensambler(object): def __init__(self, fileName): self.fileName = fileName self.fileLines = [] self.cl = 0 self.size = 0 self.code = '' self.instruction = '' self.num_ope = 0 self.operands = [] self.TS = {} ...
flexible
{ "blob_id": "3bc009271c7dd34ad09bcef81214387b63dfac59", "index": 2549, "step-1": "<mask token>\n\n\nclass Ensambler(object):\n\n def __init__(self, fileName):\n self.fileName = fileName\n self.fileLines = []\n self.cl = 0\n self.size = 0\n self.code = ''\n self.instru...
[ 7, 8, 9, 10, 12 ]
from django.db import models class crontab(models.Model): name = models.CharField(max_length=20) class converter(models.Model): name = models.CharField(max_length=20) class MainTable(models.Model): rank = models.IntegerField(null=True) coinid = models.CharField(max_length=30,null=True) symbol = ...
normal
{ "blob_id": "0054921928838d9aee63cf58f50a0a01ee12635d", "index": 6049, "step-1": "<mask token>\n\n\nclass Table(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Price(models.Model):\n price = models.FloatField(null=True)\n\n\nclass Marketdata(...
[ 5, 6, 10, 12, 14 ]
from argparse import ArgumentParser, Namespace def parse_arguments() ->Namespace: """ Parse arguments :return: Arguments """ parser = ArgumentParser(description= 'DLP project: Stock Prediction using Transformer') parser.add_argument('-e', '--epochs', default=10, type=int, help= ...
normal
{ "blob_id": "81573b4a57f540733ff2faaf82bab78381b9dd46", "index": 1194, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_arguments() ->Namespace:\n \"\"\"\n Parse arguments\n :return: Arguments\n \"\"\"\n parser = ArgumentParser(description=\n 'DLP project: Stock Predicti...
[ 0, 1, 2 ]
#=============================================================================== # @author: Daniel V. Stankevich # @organization: RMIT, School of Computer Science, 2012 # # # This package contains representations of the following models: # 'Particle' - an atomic element # 'Swarm' - a set of p...
normal
{ "blob_id": "5c06229f8e80a7225620f25941cc5276a9021e53", "index": 5353, "step-1": "<mask token>\n\n\nclass SwarmModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass NeighbourhoodModel:\n _particles = []\n _bestPosition = None\n _bestPositionFitness =...
[ 10, 11, 12, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sim_data(): n_samples = random.randint(500, 5000) n_features = random.randint(5, 25) n_informative = random.randint(5, n_features) noise = random.uniform(0.5, 2) X, y = make_regression(n_samples=n_samples...
flexible
{ "blob_id": "c4aa5869d5f916f13aa924c19dc9792337619b31", "index": 4011, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sim_data():\n n_samples = random.randint(500, 5000)\n n_features = random.randint(5, 25)\n n_informative = random.randint(5, n_features)\n noise = random.uniform(0.5, ...
[ 0, 1, 2, 3 ]
""" Pide una cadena y un carácter por teclado y muestra cuantas veces aparece el carácter en la cadena. Autor: David Galván Fontalba Fecha: 27/10/2019 Algoritmo: Pido un cadena Pido un caracter contador en 0 Hago una variable que empieza siendo 0, i mientras i <= len(cadena) si cadena[i] == caracter ...
normal
{ "blob_id": "65301be73bb56147609a103a932266013c3c0bd6", "index": 1148, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Bienvenido a este programa para que introduzcas una frase y un carácter, y decirte cuántas veces aparece ese carácter en tu frase.'\n )\nprint(\n \"\"\"----------------...
[ 0, 1, 2, 3 ]
""" Image Check / Compress Image""" import re import os from PIL import Image from common.constant import PATH def check_image(file_type): match = re.match("image/*", file_type) return match def compress_image(data): with open(PATH.format(data['name']), 'wb+') as file: file.write(data['binary'...
normal
{ "blob_id": "13fa650557a4a8827c9fb2e514bed178df19a32c", "index": 1295, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_image(file_type):\n match = re.match('image/*', file_type)\n return match\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef check_image(file_type):\n match =...
[ 0, 1, 2, 3, 4 ]
from dai_imports import* from obj_utils import* import utils class my_image_csv_dataset(Dataset): def __init__(self, data_dir, data, transforms_ = None, obj = False, minorities = None, diffs = None, bal_tfms = None): self.data_dir = data_dir self.data = data ...
normal
{ "blob_id": "5b8c95354f8b27eff8226ace52ab9e97f98ae217", "index": 80, "step-1": "<mask token>\n\n\nclass my_image_csv_dataset(Dataset):\n\n def __init__(self, data_dir, data, transforms_=None, obj=False,\n minorities=None, diffs=None, bal_tfms=None):\n self.data_dir = data_dir\n self.data ...
[ 15, 16, 19, 25, 29 ]
""" Tests for parsers.py @author Kevin Wilson <khwilson@gmail.com> """ import crisis.parsers as undertest import datetime import unittest class TestParsers(unittest.TestCase): def test_parse_date(self): date = '8/5/2013 16:14' self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.parse_date(da...
normal
{ "blob_id": "253d37f29e33f61d7e1a5ec2f9a1d6307a2ae108", "index": 6921, "step-1": "<mask token>\n\n\nclass TestParsers(unittest.TestCase):\n <mask token>\n\n def test_part_date_short(self):\n date = '8/5/13 16:14'\n self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.\n ...
[ 3, 4, 5, 6, 7 ]
from setuptools import setup, find_packages from os.path import join, dirname, abspath import io here = abspath(dirname(__file__)) with open(join(here, 'VERSION')) as VERSION_FILE: __versionstr__ = VERSION_FILE.read().strip() with open(join(here, 'requirements.txt')) as REQUIREMENTS: INSTALL_REQUIRES = REQU...
normal
{ "blob_id": "8d5978bc579115eb3065dce1bae08f1790f2d83c", "index": 2832, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(join(here, 'VERSION')) as VERSION_FILE:\n __versionstr__ = VERSION_FILE.read().strip()\nwith open(join(here, 'requirements.txt')) as REQUIREMENTS:\n INSTALL_REQUIRES = REQ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def parse_detail_for_one_course(page, course, no_info_course): print(f"{course['name']} is processing**: {course['url']}") map = {'Locatie': 'location', 'Location': 'location', 'Startdatum': 'effective_start_date', 'Start date': 'effective_sta...
flexible
{ "blob_id": "0f4fa9f8835ae22032af9faa6c7cb10af3facd79", "index": 5389, "step-1": "<mask token>\n", "step-2": "def parse_detail_for_one_course(page, course, no_info_course):\n print(f\"{course['name']} is processing**: {course['url']}\")\n map = {'Locatie': 'location', 'Location': 'location', 'Startdatum'...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @pulumi.input_type class _UserGpgKeyState: <|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_...
flexible
{ "blob_id": "aa79d5cbe656979bf9c228f6a576f2bbf7e405ca", "index": 2950, "step-1": "<mask token>\n\n\n@pulumi.input_type\nclass _UserGpgKeyState:\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\n\ncl...
[ 11, 19, 22, 26, 29 ]
<|reserved_special_token_0|> class TestGetNumber(unittest.TestCase): <|reserved_special_token_0|> def test_fib(self): self.assertEqual(Fib(5), 8) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestGetNumber(unittest.TestCase): def test_ok(self...
flexible
{ "blob_id": "d126efa91b964a3a374d546bb860b39ae26dfa22", "index": 256, "step-1": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):\n <mask token>\n\n def test_fib(self):\n self.assertEqual(Fib(5), 8)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass TestGetNumber(unittest.TestCase):...
[ 2, 3, 4, 5, 6 ]
########################################################################## # # Draw a 2-D plot for student registration number and the marks secured using gnuplot # ########################################################################## import Gnuplot # create lists to store student marks and regno student_reg=[...
normal
{ "blob_id": "dcbbc7098410d771a7151af7c43ac4d0e4d46f18", "index": 9135, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, n):\n reg = int(input('Enter RegNo: '))\n student_reg.append(reg)\n marks = int(input('Enter marks: '))\n student_marks.append(marks)\n<mask token>\ngplt.tit...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if button == True: df = pd.read_csv(upload) st.write(df.head()) fig = plt.figure() my = fig.add_subplot(1, 1, 1) my.scatter(df['sepal.length'], df['petal.length']) my.set_xlabel('sepal.length') my.set_y...
flexible
{ "blob_id": "72f1547ea7de78a5fe4b583523e592fa25c0ee77", "index": 2467, "step-1": "<mask token>\n", "step-2": "<mask token>\nif button == True:\n df = pd.read_csv(upload)\n st.write(df.head())\n fig = plt.figure()\n my = fig.add_subplot(1, 1, 1)\n my.scatter(df['sepal.length'], df['petal.length']...
[ 0, 1, 2, 3, 4 ]
# wilfred.py # Authors # Stuart C. Larsen (SCL) # Daryl W. Bennet (DWB) # Set up three main modules (command, control, reconnaissance), # and then enter main event loop. # # Command: # Gather mission priorities and objectives, such as turn left, turn right # goto GPS 45, 65, land, take off. # # Control: # Fl...
normal
{ "blob_id": "a77fb90cdc6e7f9b70f9feeefc2b7f8e93a2d8c5", "index": 9875, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mainLoop():\n wilfredCommunication = command.Command()\n wilfredCommunication.waitForClient()\n wilfredCommand = command.Command()\n while True:\n if not wilfre...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def document_features(documento): features = {} for palavra in palavras_escolhidas: features['contains(%s)' % (palavra,)] = palavra in documento return features <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sparql.setQuery(...
flexible
{ "blob_id": "c5b50420788ddde7483a46c66aca3922ddb47952", "index": 6199, "step-1": "<mask token>\n\n\ndef document_features(documento):\n features = {}\n for palavra in palavras_escolhidas:\n features['contains(%s)' % (palavra,)] = palavra in documento\n return features\n\n\n<mask token>\n", "ste...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render, redirect from django.utils.crypto import get_random_string def index(request): if not "word" in request.session: request.session["word"] = 'Empty' if not "count" in request.session: request.session["count"] = 0 if request.method == "GET": return...
normal
{ "blob_id": "2ec5e43860a1d248a2f5cd1abc26676342275425", "index": 8589, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef reset(request):\n request.session['count'] = 0\n return redirect('/')\n", "step-3": "<mask token>\n\n\ndef index(request):\n if not 'word' in request.session:\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-05-22 00:19 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('classroom', '0003_remove_anouncements_classroom'), ] ...
normal
{ "blob_id": "e9659555938211d067919ee5e0083efb29d42d7b", "index": 8600, "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 = [('classroom',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_guest_should_see_button_add_to_basket(browser): browser.get(link) btn_add = 'btn.btn-lg.btn-primary.btn-add-to-basket' found_button = WebDriverWait(browser, 5).until(EC. element_to_be_clickable((By.C...
flexible
{ "blob_id": "464be943f4fe34dda826ebada9e128f1d7d671ac", "index": 8485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_guest_should_see_button_add_to_basket(browser):\n browser.get(link)\n btn_add = 'btn.btn-lg.btn-primary.btn-add-to-basket'\n found_button = WebDriverWait(browser, 5)...
[ 0, 1, 2, 3, 4 ]
linha = input().split() a = float(linha[0]) b = float(linha[1]) c = float(linha[2]) t = (a*c)/2 print('TRIANGULO: {:.3f}'.format(t)) pi = 3.14159 print("CIRCULO: {:.3f}".format(pi*c**2)) print('TRAPEZIO: {:.3f}'.format( ((a+b)*c)/2 )) print("QUADRADO: {:.3f}".format(b**2)) print("RETANGULO: {:.3f}".format(a*b))
normal
{ "blob_id": "d44d9003e9b86722a0fc1dfe958de462db9cd5f1", "index": 1670, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('TRIANGULO: {:.3f}'.format(t))\n<mask token>\nprint('CIRCULO: {:.3f}'.format(pi * c ** 2))\nprint('TRAPEZIO: {:.3f}'.format((a + b) * c / 2))\nprint('QUADRADO: {:.3f}'.format(b ** 2...
[ 0, 1, 2, 3 ]
def multiplica(): one = int(input('1º: ')) two = int(input('2º: ')) print('a multiplicação é: ', one * two) def soma(): one = int(input('1º: ')) two = int(input('2º: ')) print('a soma é: ', one + two) <|reserved_special_token_0|> <|reserved_special_token_1|> def multiplica(): one = in...
flexible
{ "blob_id": "414fa4021b21cea0dc49380aebfe67f0204f0574", "index": 5994, "step-1": "def multiplica():\n one = int(input('1º: '))\n two = int(input('2º: '))\n print('a multiplicação é: ', one * two)\n\n\ndef soma():\n one = int(input('1º: '))\n two = int(input('2º: '))\n print('a soma é: ', one + ...
[ 2, 3, 4, 5, 6 ]
''' Useful constants. Inspired by pyatspi: http://live.gnome.org/GAP/PythonATSPI @author: Eitan Isaacson @copyright: Copyright (c) 2008, Eitan Isaacson @license: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the ...
normal
{ "blob_id": "5ec2ac3e0d66026da1b0c957d10c95e95c201f8f", "index": 9032, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _sym, _val in locals().items():\n if _sym.startswith('EVENT_') or _sym.startswith('IA2_EVENT_'):\n winEventIDsToEventNames[_val] = _sym\n", "step-3": "<mask token>\nCHILDI...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd import matplotlib as plt import scipy.linalg from distance_metrics import * import time import random RANDOM_SEED = 42 np.random.seed(RANDOM_SEED) random.seed(RANDOM_SEED) ################################################################ # PCA # ##############################...
normal
{ "blob_id": "c00db6d6fd903236de37ccc029ed30fd46dccdef", "index": 7711, "step-1": "<mask token>\n\n\ndef project(X, U, p=None):\n if p == None:\n p = X.shape[1]\n Z = np.matmul(X, U)\n Z[:, p:] = np.mean(Z[:, p:], axis=0)\n X2 = np.matmul(Z, U.transpose())\n return Z, X2\n\n\n<mask token>\n\...
[ 2, 4, 5, 6, 7 ]