code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
"""This module provides the definition of the exceptions that can be raised from the database module.""" class DatabaseError(Exception): """Raised when the requested database operation can not be completed.""" pass class InvalidDictError(Exception): """Raised when the object can not be created from the pr...
normal
{ "blob_id": "94130b4962ecff2ea087ab34cf50a084254bf980", "index": 8948, "step-1": "<mask token>\n\n\nclass InvalidDictError(Exception):\n <mask token>\n pass\n", "step-2": "<mask token>\n\n\nclass InvalidDictError(Exception):\n \"\"\"Raised when the object can not be created from the provided dict.\"\"...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ObjectCenter(object): def __init__(self, args): """Initialize variables.""" self.args = args def load_classes(self, path): with open(path, 'r') as names_file: names = names_file.read().split('\n') return list(filter(None, names))...
flexible
{ "blob_id": "8f14bbab8b2a4bc0758c6b48feb20f8b0e3e348b", "index": 5460, "step-1": "<mask token>\n\n\nclass ObjectCenter(object):\n\n def __init__(self, args):\n \"\"\"Initialize variables.\"\"\"\n self.args = args\n\n def load_classes(self, path):\n with open(path, 'r') as names_file:\n...
[ 4, 5, 6, 8, 9 ]
def five_x_cubed_plus_1(x): return 5 * x ** 3 + 1 <|reserved_special_token_0|> <|reserved_special_token_1|> def five_x_cubed_plus_1(x): return 5 * x ** 3 + 1 def pair_off(ary): result = [] for i in range(0, int(len(ary) / 2 * 2), 2): result.append([ary[i], ary[i + 1]]) if int(len(ary)...
flexible
{ "blob_id": "681788ffe7672458e8d334316aa87936746352b1", "index": 4054, "step-1": "def five_x_cubed_plus_1(x):\n return 5 * x ** 3 + 1\n\n\n<mask token>\n", "step-2": "def five_x_cubed_plus_1(x):\n return 5 * x ** 3 + 1\n\n\ndef pair_off(ary):\n result = []\n for i in range(0, int(len(ary) / 2 * 2),...
[ 1, 2, 3, 4, 5 ]
from collections import deque from etaprogress.eta import ETA def test_linear_slope_1(): eta = ETA(100) eta._timing_data = deque([(10, 10), (20, 20), (30, 30), (40, 40)]) getattr(eta, '_calculate')() assert 100 == eta.eta_epoch assert 1.0 == eta.rate assert 1.0 == eta.rate_unstable def test_...
normal
{ "blob_id": "810017cd5814fc20ebcdbdf26a32ea1bcfc88625", "index": 2164, "step-1": "<mask token>\n\n\ndef test_linear_slope_2():\n eta = ETA(100)\n eta._timing_data = deque([(10, 20), (20, 40), (30, 60), (40, 80)])\n getattr(eta, '_calculate')()\n assert 50 == eta.eta_epoch\n assert 2.0 == eta.rate\...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Substr(ConvertAbstract): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Substr(ConvertAbstract): def __init__(self, **kwargs): super().__init__(**kwarg...
flexible
{ "blob_id": "f704742b9e023a1c3386fed293032fd8196b875e", "index": 7344, "step-1": "<mask token>\n\n\nclass Substr(ConvertAbstract):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Substr(ConvertAbstract):\n\n def __init__(self, **kwargs):\n super().__init__...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from utils.gradient_strategy.dct_generator import DCTGenerator from utils.gradient_strategy.random_generator import RandomGenerator from utils.gradient_strategy.upsample_generator import UpSampleGenerator from utils.gradient_strategy.centerconv_generator impo...
flexible
{ "blob_id": "399097ef7cfdc061b307c3cc29615c9f50b1e6bf", "index": 5511, "step-1": "<mask token>\n", "step-2": "from utils.gradient_strategy.dct_generator import DCTGenerator\nfrom utils.gradient_strategy.random_generator import RandomGenerator\nfrom utils.gradient_strategy.upsample_generator import UpSampleGene...
[ 0, 1 ]
from flask import Flask, render_template app = Flask(__name__) @app.route('/',methods=["GET","POST"]) def inicio(): nombre = "jose" return render_template("inicio.html",nombre=nombre) app.run(debug=True)
normal
{ "blob_id": "caa28bd64141c8d2f3212b5e4e77129d81d24c71", "index": 2290, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef inicio():\n nombre = 'jose'\n return render_template('inicio.html', nombre=nombre)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=[...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> final.to_csv('../../Downloads/final_con_final.tsv', sep='\t', index=False) <|reserved_special_token_1|> <|reserved_special_token_0|> df1 = pd.read_csv('../final/your_no.tsv', '\t') df2 = pd.read_csv('../../Downloads/me.csv', '\...
flexible
{ "blob_id": "cd5945631a9dd505bf67089bab8c5a37ad375129", "index": 410, "step-1": "<mask token>\n", "step-2": "<mask token>\nfinal.to_csv('../../Downloads/final_con_final.tsv', sep='\\t', index=False)\n", "step-3": "<mask token>\ndf1 = pd.read_csv('../final/your_no.tsv', '\\t')\ndf2 = pd.read_csv('../../Downlo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Choose from the following options: ') <|reserved_special_token_0|> print(one, '\n', two, '\n', three, '\n', four, '\n', five) <|reserved_special_token_0|> if value == 1: modem_on = input('\nIs your modem on? (Enter Y or N): ') if modem_on == 'Y...
flexible
{ "blob_id": "736b84bbcf1d5954b491068be4060edeade2c1c5", "index": 2205, "step-1": "<mask token>\n", "step-2": "print('Choose from the following options: ')\n<mask token>\nprint(one, '\\n', two, '\\n', three, '\\n', four, '\\n', five)\n<mask token>\nif value == 1:\n modem_on = input('\\nIs your modem on? (Ent...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Node: <|reserved_special_token_0|> def __getName(self): return self.__name def __getTotalCores(self): return self.__totalCores def __setTotalCores(self, total): assert total >= 0 and total >= self.__usedCores self.__totalCores = tot...
flexible
{ "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 ]
# encoding: utf-8 from SpiderTools.tool import platform_system from SpidersLog.file_handler import SafeFileHandler from Env.parse_yaml import FileConfigParser from Env import log_variable as lv from staticparm import root_path from SpiderTools.tool import get_username import logging import logging.handlers import trace...
normal
{ "blob_id": "63001128d9cb934d6f9d57db668a43ba58f4ece3", "index": 1679, "step-1": "<mask token>\n\n\nclass ICrawlerLog:\n <mask token>\n\n def __init__(self, name, logger=None):\n self.logger = logger\n self.name = name\n\n @property\n def save(self, *args, **kwargs):\n \"\"\"\n ...
[ 3, 4, 5, 6, 7 ]
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ n1 = len(s) n2 = len(t) if n1 != n2: return False else: map1 = {} map2 = {} for i in range(n1)...
normal
{ "blob_id": "7fdddf98fc7b588e9b8816ffa22bc24f715d7efe", "index": 5210, "step-1": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution(object):\n\n def isIsomorphic(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: bool\n \"...
[ 1, 2, 3, 4 ]
import helpers import os import os.path import json import imp import source.freesprints from pygame.locals import * class PluginLoader: available_plugins = None def __init__(self): self.checkAvailablePlugins() def checkAvailablePlugins(self): print helpers.pluginsPath() ...
normal
{ "blob_id": "639669174435492f43bf51680c2724863017e9d2", "index": 527, "step-1": "import helpers\nimport os\nimport os.path\nimport json\nimport imp\nimport source.freesprints\nfrom pygame.locals import *\n\nclass PluginLoader:\n available_plugins = None\n \n def __init__(self):\n self.checkAvaila...
[ 0 ]
<|reserved_special_token_0|> class ProsteUcilnice(object): <|reserved_special_token_0|> def __init__(self, ucilnice): self.ucilnice = set(ucilnice) self.zasedenost_ucilnic = defaultdict(dict) self.rezerviranost_ucilnic = defaultdict(dict) def dodaj_srecanja_semestra(self, semeste...
flexible
{ "blob_id": "3ce9c0aeb6b4e575fbb3fced52a86a1dcec44706", "index": 4713, "step-1": "<mask token>\n\n\nclass ProsteUcilnice(object):\n <mask token>\n\n def __init__(self, ucilnice):\n self.ucilnice = set(ucilnice)\n self.zasedenost_ucilnic = defaultdict(dict)\n self.rezerviranost_ucilnic ...
[ 20, 22, 26, 27, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Evaluacion) <|reserved_special_token_1|> from django.contrib import admin from Evaluacion.models import Evaluacion admin.site.register(Evaluacion)
flexible
{ "blob_id": "4ef4e302304ccf2dc92cdebe134e104af47aae20", "index": 3795, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Evaluacion)\n", "step-3": "from django.contrib import admin\nfrom Evaluacion.models import Evaluacion\nadmin.site.register(Evaluacion)\n", "step-4": null, "step-...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def multiply(num1, num2): return num1 * num2
flexible
{ "blob_id": "e835e75f444e97ca948ce27504cc9149ea0092f6", "index": 1946, "step-1": "<mask token>\n", "step-2": "def multiply(num1, num2):\n return num1 * num2\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import argparse p = argparse.ArgumentParser() p.add_argument("--foo", action="store_true") args = p.parse_args() print(args.foo)
normal
{ "blob_id": "2cc9f8c476026311456857d3395a14a45e2f4b80", "index": 1460, "step-1": "<mask token>\n", "step-2": "<mask token>\np.add_argument('--foo', action='store_true')\n<mask token>\nprint(args.foo)\n", "step-3": "<mask token>\np = argparse.ArgumentParser()\np.add_argument('--foo', action='store_true')\narg...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def parse_lat(lat: int): lat_str = 'N' if lat >= 0 else 'S' if 10 > lat > -10: lat_str += '0' lat_str += str(abs(lat)) return lat_str <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def download(url: str, dest_folder: s...
flexible
{ "blob_id": "0726a4fa3af196e2ba1592019f09afb0e7bb47d7", "index": 9731, "step-1": "<mask token>\n\n\ndef parse_lat(lat: int):\n lat_str = 'N' if lat >= 0 else 'S'\n if 10 > lat > -10:\n lat_str += '0'\n lat_str += str(abs(lat))\n return lat_str\n\n\n<mask token>\n", "step-2": "<mask token>\n\...
[ 1, 3, 4, 5, 6 ]
# coding: utf-8 """ Picarto.TV API Documentation The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv/chat/chat.pr...
normal
{ "blob_id": "939011fca968d5f9250beb29a0bb700200e637df", "index": 6274, "step-1": "<mask token>\n", "step-2": "<mask token>\nconfiguration = Configuration()\n", "step-3": "<mask token>\nfrom __future__ import absolute_import\nfrom .models.basic_channel_info import BasicChannelInfo\nfrom .models.basic_follower...
[ 0, 1, 2, 3 ]
#Write your function here def over_nine_thousand(lst): sum = 0 for number in lst: sum += number if (sum > 9000): break return sum #Uncomment the line below when your function is done print(over_nine_thousand([8000, 900, 120, 5000])) #9020
normal
{ "blob_id": "c2f39e33030cbe7c5d4827b47fb28d7604bdbc6d", "index": 8135, "step-1": "<mask token>\n", "step-2": "def over_nine_thousand(lst):\n sum = 0\n for number in lst:\n sum += number\n if sum > 9000:\n break\n return sum\n\n\n<mask token>\n", "step-3": "def over_nine_thou...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Author : Seungyeon Jo # e-mail : syjo@seculayer.co.kr # Powered by Seculayer © 2018 AI-Core Team from mlps.core.data.cnvrtr.ConvertAbstract import ConvertAbstract class Substr(ConvertAbstract): def __init__(self, **kwargs): super().__init__(**kwargs) def apply(self,...
normal
{ "blob_id": "f704742b9e023a1c3386fed293032fd8196b875e", "index": 7344, "step-1": "<mask token>\n\n\nclass Substr(ConvertAbstract):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Substr(ConvertAbstract):\n\n def __init__(self, **kwargs):\n super().__init__...
[ 1, 3, 4, 5, 6 ]
import sys INF = sys.maxsize def bellman_ford(graph,start): distance = {} predecessor = {} # 거리 값, 이전 정점 초기화 for node in graph: distance[node] = INF predecessor[node] = None distance[start] = 0 # V-1개마큼 반복 for _ in range(len(graph)-1): for node in graph: ...
normal
{ "blob_id": "8ebf031cb294c69bf744d543b18783d6ac5ef257", "index": 1910, "step-1": "<mask token>\n\n\ndef bellman_ford(graph, start):\n distance = {}\n predecessor = {}\n for node in graph:\n distance[node] = INF\n predecessor[node] = None\n distance[start] = 0\n for _ in range(len(gra...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Category(models.Model): """Категории""" name = models.CharField('Категория', max_length=150) url = models.SlugField(max_length=160, unique=True) def __str__(self): return self.name class Meta: verbose_name = 'Категория' verbose_name_plu...
flexible
{ "blob_id": "a139042d0c6fa4941b7149a33b0a48018e9f511b", "index": 9003, "step-1": "<mask token>\n\n\nclass Category(models.Model):\n \"\"\"Категории\"\"\"\n name = models.CharField('Категория', max_length=150)\n url = models.SlugField(max_length=160, unique=True)\n\n def __str__(self):\n return...
[ 8, 9, 10, 14, 15 ]
<|reserved_special_token_0|> @torch.jit.script def swish_jit_fwd(x): return x * torch.sigmoid(x) * 1.6768 <|reserved_special_token_0|> class SwishJitAutoFn(torch.autograd.Function): @staticmethod def forward(ctx, x): ctx.save_for_backward(x) return swish_jit_fwd(x) @staticmethod ...
flexible
{ "blob_id": "070330f8d343ff65852c5fbb9a3e96fe1bfc55b5", "index": 8816, "step-1": "<mask token>\n\n\n@torch.jit.script\ndef swish_jit_fwd(x):\n return x * torch.sigmoid(x) * 1.6768\n\n\n<mask token>\n\n\nclass SwishJitAutoFn(torch.autograd.Function):\n\n @staticmethod\n def forward(ctx, x):\n ctx....
[ 6, 7, 9, 14, 16 ]
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
normal
{ "blob_id": "d56fa4ea999d8af887e5f68296bfb20ad535e6ad", "index": 6748, "step-1": "<mask token>\n\n\nclass PXEBaseMixin(object):\n\n def get_properties(self):\n \"\"\"Return the properties of the interface.\n\n :returns: dictionary of <property name>:<property description> entries.\n \"\"\...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # Copyright © 2020- Spyder Project Contributors # # Released under the terms of the MIT License # ---------------------------------------------------------------------------- """Tests for the execution of pylint.""" ...
normal
{ "blob_id": "22792937415a8ee4cecff2a9683c435abe54bdab", "index": 5516, "step-1": "<mask token>\n\n\nclass MainWindowMock(QObject):\n sig_editor_focus_changed = Signal(str)\n\n def __init__(self):\n super(MainWindowMock, self).__init__(None)\n self.editor = Mock()\n self.editor.sig_edit...
[ 10, 11, 12, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd ='root', db='test') cur = conn.cursor() cur.execute('SELECT user_id, user_name FROM cap_user') row_count = cur.rowcount for r...
flexible
{ "blob_id": "e5b5874f060bdf93ac4fadaf556aa4182619d077", "index": 2033, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd\n ='root', db='test')\n cur = conn.cursor()\n cur.execute('SELECT user_id, user_name FROM ca...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def postorder(self, node: 'TreeNode', p: 'TreeNode', q: 'TreeN...
flexible
{ "blob_id": "ec9184fa3562ef6015801edf316faa0097d1eb57", "index": 4821, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def postorder(self, node: 'TreeNode', p: 'TreeNode', q: 'TreeNode'\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestBromineObjective(ForceBalanceTestCase, ObjectiveTests): def setUp(self): self.options = forcebalance.parser.gen_opts_defaults.copy() self.options.update({'root': os.getcwd() + '/test/files', 'penalty_additive': 0.01, 'jobtype': 'NEWTON', 'forcefi...
flexible
{ "blob_id": "f91e1fdc31b2fe1aef15757576d847c617a86201", "index": 1121, "step-1": "<mask token>\n\n\nclass TestBromineObjective(ForceBalanceTestCase, ObjectiveTests):\n\n def setUp(self):\n self.options = forcebalance.parser.gen_opts_defaults.copy()\n self.options.update({'root': os.getcwd() + '/...
[ 2, 11, 12, 15, 20 ]
<|reserved_special_token_0|> class BalancedForestTest(unittest.TestCase): def test1(self): expected = 10 c = [1, 1, 1, 18, 10, 11, 5, 6] edges = [[1, 2], [1, 4], [2, 3], [1, 8], [8, 7], [7, 6], [5, 7]] self.assertEqual(balancedForest(c, edges), expected) <|reserved_special_tok...
flexible
{ "blob_id": "e361215c44305f1ecc1cbe9e19345ee08bdd30f5", "index": 2393, "step-1": "<mask token>\n\n\nclass BalancedForestTest(unittest.TestCase):\n\n def test1(self):\n expected = 10\n c = [1, 1, 1, 18, 10, 11, 5, 6]\n edges = [[1, 2], [1, 4], [2, 3], [1, 8], [8, 7], [7, 6], [5, 7]]\n ...
[ 7, 22, 24, 25, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> G = 1000000000 M = 1000000 K = 1000
flexible
{ "blob_id": "f765f54a89a98a5f61c70a37379860f170444c0a", "index": 4069, "step-1": "<mask token>\n", "step-2": "G = 1000000000\nM = 1000000\nK = 1000\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|> mycursor.execute('select * from question') <|reserved_special_token_0|> for user in users: print(user) <|reserved_special_token_1|> <|reserved_special_token_0|> mydb = mysql.connector.connect(user='seyed', password='Sm13481...
flexible
{ "blob_id": "a29a904290cb733ac7b526a75e0c218b952e2266", "index": 4630, "step-1": "<mask token>\n", "step-2": "<mask token>\nmycursor.execute('select * from question')\n<mask token>\nfor user in users:\n print(user)\n", "step-3": "<mask token>\nmydb = mysql.connector.connect(user='seyed', password='Sm13481...
[ 0, 1, 2, 3, 4 ]
''' Created on Nov 20, 2012 @author: shriram ''' import xml.etree.ElementTree as ET from xml.sax.saxutils import escape ''' Annotating only Sparse and Non Sparse Lines ''' class Trainer: def html_escape(self,text): html_escape_table = { '"': "&quot;", "'": "&apos;" } re...
normal
{ "blob_id": "22e24e8dd49367ae57d1980c4addf48d65c5e897", "index": 7851, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Trainer:\n\n def html_escape(self, text):\n html_escape_table = {'\"': '&quot;', \"'\": '&apos;'}\n return escape(text, html_escape_table)\n\n def train(self...
[ 0, 3, 4, 6, 7 ]
class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def searchInsert(self, nums, target: int): n = len(nums) left = 0 right = n - 1 while lef...
flexible
{ "blob_id": "9ec1cca08fac2fd976c1f596f7d340befc4eb339", "index": 2020, "step-1": "class Solution:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution:\n\n def searchInsert(self, nums, target: int):\n n = len(nums)\n left = 0\n right = n ...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/python #coding:utf-8 import glob, os #from collections import OrderedDict aa = os.popen("grep -E 'register|cp' all.log |grep -v 'bohan' | awk '{ print $6 }' > /opt/csvt01/logs/tmp.txt").read().strip() #os.system("grep -E 'register|cp' all.log |grep -v 'bohan' | awk '{ print $6 }' > /opt/csvt01/logs/tmp.t...
normal
{ "blob_id": "fc8f3be408f4d21de2ae18776cd60177c82bea77", "index": 2068, "step-1": "#!/usr/bin/python \n#coding:utf-8 \nimport glob, os\n#from collections import OrderedDict\naa = os.popen(\"grep -E 'register|cp' all.log |grep -v 'bohan' | awk '{ print $6 }' > /opt/csvt01/logs/tmp.txt\").read().strip()\n#os.syste...
[ 0 ]
import pymel.core as pm from alShaders import * class AEalLayerColorTemplate(alShadersTemplate): controls = {} params = {} def setup(self): self.params.clear() self.params["layer1"] = Param("layer1", "Layer 1", "The background layer (will be blended over black if its alpha is not 1.", "rgb", presets=None) sel...
normal
{ "blob_id": "c847e7abe36b62c4518bb535789064e22b5f1db7", "index": 5750, "step-1": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <ma...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def fn1(): print('One') def fn2(): print('Two') def fn3(): print('Three') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fn1(): print('One') def fn2(): print('Two') def fn3(): print('Three') <|reserved_sp...
flexible
{ "blob_id": "dc226a646af32d052c6d51832b95a340d6986e08", "index": 489, "step-1": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')\n\n\ndef fn3():\n print('Three')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')...
[ 3, 4, 5, 6, 8 ]
# -*- coding: GB18030 -*- import inspect import os,sys import subprocess from lib.common.utils import * from lib.common.loger import loger from lib.common import checker from lib.common.logreader import LogReader import shutil from lib.common.XmlHandler import * from lib.common.Dict import * class baseModule(object): ...
normal
{ "blob_id": "a74d27d9e31872100b4f22512abe9de7d9277de7", "index": 2970, "step-1": "# -*- coding: GB18030 -*-\nimport inspect\nimport os,sys\nimport subprocess\nfrom lib.common.utils import *\nfrom lib.common.loger import loger\nfrom lib.common import checker\nfrom lib.common.logreader import LogReader\nimport shu...
[ 0 ]
import tensorflow as tf def build_shared_network(x, add_summaries=False): conv1 = tf.layers.conv2d(x, 16, 8, 4, activation=tf.nn.relu, name="conv1") conv2 = tf.layers.conv2d(conv1, 32, 4, 2, activation=tf.nn.relu, name="conv2") fc1 = tf.layers.dense(tf.layers.flatten(conv2), 256, name="fc1") if add_s...
normal
{ "blob_id": "0fbf8efd39f583581c46fcd3f84c65a7787145cd", "index": 847, "step-1": "<mask token>\n\n\nclass PolicyEstimator:\n <mask token>\n\n\nclass ValueEstimator:\n\n def __init__(self, reuse=False, trainable=True):\n self.states = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.\n uint...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/python # coding:utf-8 # #这个脚本主要是对apache日志文件的处理分析,过滤出需要的信息 #处理后得到的数据是: 主机IP:192.168.14.44 访问流量:814 K #使用说明 python 脚本名 文件名; eg:python python.analysis.apachelog.py access.log # # by wangdd 2016/02/02 # import os import re import sys import shelve #re 模块,利用re模块对apahce日志进行分析 #通过 re.match(……) 和 re.compile(……...
normal
{ "blob_id": "3240a7fb9fbd5cd84165e68f8406e0a146c2b6b6", "index": 1454, "step-1": "#!/usr/bin/python\n# coding:utf-8\n#\n#这个脚本主要是对apache日志文件的处理分析,过滤出需要的信息\n#处理后得到的数据是:\t主机IP:192.168.14.44 访问流量:814 K\n#使用说明 python 脚本名 文件名; eg:python python.analysis.apachelog.py access.log\n#\n#\tby wangdd 2016/02/02\n#\nimpor...
[ 0 ]
<|reserved_special_token_0|> class Element(object): def __init__(self): self.ndof = 0 self.nn = 0 self.ng = 0 self.element_type = 0 self.coord_position = np.array([]) self.setup() <|reserved_special_token_0|> <|reserved_special_token_0|> def shape_func...
flexible
{ "blob_id": "ed2ae166c4881289b27b7e74e212ba2d6164998b", "index": 2981, "step-1": "<mask token>\n\n\nclass Element(object):\n\n def __init__(self):\n self.ndof = 0\n self.nn = 0\n self.ng = 0\n self.element_type = 0\n self.coord_position = np.array([])\n self.setup()\n...
[ 3, 4, 5, 6 ]
import cv2 import numpy as np import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import SeparableConv2D, Conv2D, MaxPooling2D from keras.layers import BatchNormalization, Activation, Dropo...
normal
{ "blob_id": "e47d6b5d46f2dd84569a2341178b2ea5e074603a", "index": 7361, "step-1": "<mask token>\n\n\ndef layer_to_visualize(layer):\n inputs = [K.learning_phase()] + model.inputs\n _convout1_f = K.function(inputs, [layer.output])\n\n def convout1_f(X):\n return _convout1_f([0] + [X])\n convolut...
[ 1, 2, 3, 4, 5 ]
from msl.equipment.connection import Connection from msl.equipment.connection_demo import ConnectionDemo from msl.equipment.record_types import EquipmentRecord from msl.equipment.resources.picotech.picoscope.picoscope import PicoScope from msl.equipment.resources.picotech.picoscope.channel import PicoScopeChannel cla...
normal
{ "blob_id": "82c3419679a93c7640eae48b543aca75f5ff086d", "index": 4880, "step-1": "<mask token>\n\n\nclass MyConnection(Connection):\n <mask token>\n\n def get_none1(self):\n \"\"\"No return type is specified.\"\"\"\n pass\n <mask token>\n <mask token>\n <mask token>\n <mask token>...
[ 19, 20, 21, 37, 39 ]
# Generated by Django 2.1.7 on 2019-05-31 18:45 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('events', '0004_auto_2019...
normal
{ "blob_id": "2ec8d3853ea4a99d4e764c6c24d7b5a3afb64f63", "index": 2830, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
from selenium import webdriver from selenium.common.exceptions import WebDriverException from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By SELENIUM_TIMEOUT = 12 def get_browser_driver(): """获取浏览器服务...
normal
{ "blob_id": "5ab877ef15cdcd52463b1567c28327dc2eeea2de", "index": 1204, "step-1": "<mask token>\n\n\ndef get_browser_driver():\n \"\"\"获取浏览器服务 使用后记得 driver.quit() 否则容易引起状态污染\"\"\"\n try:\n driver = webdriver.PhantomJS(service_args=['--load-images=no'])\n except WebDriverException:\n chrome_...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Cart(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def save(self): self.session[settings.CART_SESSION_ID] = self.cart self.session.modified = True <|reserved_special_token_0|> def __iter__(self): blood_ids = self.car...
flexible
{ "blob_id": "a638504737d0069d4fa40b0fc5026203904563e8", "index": 5537, "step-1": "<mask token>\n\n\nclass Cart(object):\n <mask token>\n <mask token>\n\n def save(self):\n self.session[settings.CART_SESSION_ID] = self.cart\n self.session.modified = True\n <mask token>\n\n def __iter_...
[ 5, 6, 8, 9, 11 ]
STATUS_DISCONNECT = 0 STATUS_CONNECTED = 1 STATUS_OPEN_CH_REQUEST = 2 STATUS_OPENED = 3 STATUS_EXITING = 4 STATUS_EXITTED = 5 CONTENT_TYPE_IMAGE = 0 CONTENT_TYPE_VIDEO = 1 STATUS_OK = 0 STATUS_ERROR = 1 class Point(object): def __init__(self, x = 0, y = 0): self.x = x self.y = y class ObjectDe...
normal
{ "blob_id": "0ceb9eac46e3182821e65a1ae3a69d842db51e62", "index": 7879, "step-1": "<mask token>\n\n\nclass ObjectDetectionResult(object):\n\n def __init__(self, ltx=0, lty=0, rbx=0, rby=0, text=None):\n self.object_class = 0\n self.confidence = 0\n self.lt = Point(ltx, lty)\n self.r...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def remove_element(self, nums: list[int], val: int) ->int: ...
flexible
{ "blob_id": "8be4bf5c1a5a7b841edc915793571686ee0bffe6", "index": 113, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def remove_element(self, nums: list[int], val: int) ->int:\n last_p...
[ 0, 1, 2, 3 ]
# -*- coding:utf-8 -*- import requests import json def fun1(): s_cut = [('72af8ecf3609a546bac3150c20f70455', ['老凤祥', '六福珠宝', '周生生', '亚一珠宝', '亚一金店']), ('3e78397f7dbb88ffbd78ba52d0e925fa', ['老庙', '谢瑞麟', '中国黄金', '明牌珠宝']), # yh ('6bee32b2f0719ea45cc194847efd8917', ['周大福', '潮宏基', '东华美钻', '周...
normal
{ "blob_id": "66f8fa5fc12dc80b8f46684c39781c2e4634de4a", "index": 3479, "step-1": "<mask token>\n\n\ndef fun1():\n s_cut = [('72af8ecf3609a546bac3150c20f70455', ['老凤祥', '六福珠宝', '周生生',\n '亚一珠宝', '亚一金店']), ('3e78397f7dbb88ffbd78ba52d0e925fa', ['老庙', '谢瑞麟',\n '中国黄金', '明牌珠宝']), ('6bee32b2f0719ea45cc1...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @app.route('/', methods=['GET', 'POST']) def inicio(): nombre = 'jose' return render_template('inicio.html', nombre=nombre) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/', methods=['GET', 'POST']) def inicio(): nomb...
flexible
{ "blob_id": "caa28bd64141c8d2f3212b5e4e77129d81d24c71", "index": 2290, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef inicio():\n nombre = 'jose'\n return render_template('inicio.html', nombre=nombre)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=[...
[ 1, 2, 3, 4, 5 ]
class LinearQueue: <|reserved_special_token_0|> def enqueue(self, *args): for i in args: if not self.isFull(): self._tail += 1 self._queue[self._tail] = i else: break def dequeue(self): if self.isEmpty() or self._tail ...
flexible
{ "blob_id": "0efac7d9d1a9180eafa8c9c4e3a42b4c68e718a2", "index": 4597, "step-1": "class LinearQueue:\n <mask token>\n\n def enqueue(self, *args):\n for i in args:\n if not self.isFull():\n self._tail += 1\n self._queue[self._tail] = i\n else:\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> EXP_GROUPS = {} EXP_GROUPS['starter_issam'] = hu.cartesian_exp_group({'batch_size': 32, 'opt': {'name': 'adamW', 'lr': 0.0001, 'wd': 1e-06}, 'model': {'name': 'resnext50_32x4d_ssl'}, 'loss_func': {'name': 'cross_entropy'},...
flexible
{ "blob_id": "dafefc65335a0d7e27057f51b43e52b286f5bc6b", "index": 6067, "step-1": "<mask token>\n", "step-2": "<mask token>\nEXP_GROUPS = {}\nEXP_GROUPS['starter_issam'] = hu.cartesian_exp_group({'batch_size': 32,\n 'opt': {'name': 'adamW', 'lr': 0.0001, 'wd': 1e-06}, 'model': {'name':\n 'resnext50_32x4d_...
[ 0, 1, 2, 3 ]
import scipy.io as sio import glob import numpy as np import matplotlib.pyplot as plt import math import os,sys BIN = os.path.expanduser("../tools/") sys.path.append(BIN) import myfilemanager as mfm import mystyle as ms import propsort as ps from functools import partial from scipy.ndimage import gaussian_filter1d ...
normal
{ "blob_id": "a4f56b1f93f62d80707367eaba0bba7ef4b2caca", "index": 4749, "step-1": "import scipy.io as sio\nimport glob\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport math\n\nimport os,sys\nBIN = os.path.expanduser(\"../tools/\")\nsys.path.append(BIN)\nimport myfilemanager as mfm\nimport mystyle as m...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: a = int(input('Enter a:')) b = int(input('Enter b:')) c = a / b except: print("Can't divide with zero") <|reserved_special_token_1|> try: a = int(input("Enter a:")) b = int(input("Enter b:")) c = a/b except: print("Can'...
flexible
{ "blob_id": "143f6ee38413a0713c18281e9737c09d9947a61a", "index": 2805, "step-1": "<mask token>\n", "step-2": "try:\n a = int(input('Enter a:'))\n b = int(input('Enter b:'))\n c = a / b\nexcept:\n print(\"Can't divide with zero\")\n", "step-3": "try:\n a = int(input(\"Enter a:\"))\n b = int(...
[ 0, 1, 2 ]
from flask import Flask,render_template, redirect, url_for,request, jsonify, abort,request from flask_sqlalchemy import SQLAlchemy from src.flaskbasic import * from src.flaskbasic.form import StudentForm from src.flaskbasic.models import Student import sys import logging # logging.basicConfig(filename='app.log...
normal
{ "blob_id": "18f9e55b62b30ce8c9d4a57cd9c159543a738770", "index": 4709, "step-1": "<mask token>\n\n\n@application.route('/results', methods=['GET', 'POST'])\ndef get_results():\n _logger_getting.warning('retrieving all student results')\n data = Student.query.all()\n _logger_getting.warning('the students...
[ 4, 6, 7, 8, 9 ]
import subprocess from collections import namedtuple from os.path import basename, splitext def hdfs_get_filelist(blob_path, delimiter="_"): """ Lists hdfs dir and returns named tuples with information of file based on its filename. """ def hdfs_listdir(blob_path): command = 'hdfs dfs -ls ' + blob_pa...
normal
{ "blob_id": "6909e70db4f907e26ad604f95c79a405010907bd", "index": 2086, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef hdfs_get_filelist(blob_path, delimiter='_'):\n \"\"\" Lists hdfs dir and returns named tuples with information of file based on its filename. \"\"\"\n\n def hdfs_listdir(blo...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from . import views app_name = 'adverts' urlpatterns = [ path('', views.AdvertListView.as_view(), name="list"), path('create/', views.AdvertFormView.as_view(), name='adverts-create'), path('<str:category>/', views.AdvertListView.as_view(), name="adverts-list-categories"), ]
normal
{ "blob_id": "8c1718f56a73fdd962154abfaedc7c0c3cb0d9ba", "index": 6626, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'adverts'\nurlpatterns = [path('', views.AdvertListView.as_view(), name='list'), path(\n 'create/', views.AdvertFormView.as_view(), name='adverts-create'), path\n ('<str:...
[ 0, 1, 2, 3 ]
import unittest from unflatten import _path_tuples_with_values_to_dict_tree, dot_colon_join, dot_colon_split from unflatten import _recognize_lists from unflatten import _tree_to_path_tuples_with_values from unflatten import brackets_join from unflatten import flatten from unflatten import unflatten class BracketsRe...
normal
{ "blob_id": "5119b1b6817e002c870b4d6a19fe9aee661fff7e", "index": 8425, "step-1": "<mask token>\n\n\nclass RecognizeListsTestCase(unittest.TestCase):\n\n def test_simple(self):\n self.assertListEqual(_recognize_lists({(0): 'a', (1): {'b': -1, 'c':\n {(0): 'd', (1): -2}}}), ['a', {'b': -1, 'c'...
[ 13, 17, 20, 21, 22 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': setLogLevel('info') network = TreeContainerNet(depth=2, fanout=100, switch=OVSSwitch) network.run(CLI, network) <|reserved_special_token_1|> <|reserved_special_token_0|> from mininet.cli i...
flexible
{ "blob_id": "9c3ca2fa43c6a34d7fe06517812a6d0bf5d6dbe1", "index": 4029, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n setLogLevel('info')\n network = TreeContainerNet(depth=2, fanout=100, switch=OVSSwitch)\n network.run(CLI, network)\n", "step-3": "<mask token>\nfr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @app.errorhandler(500) def internal_server_error(e): return render_template('500.html', error=str(e)) <|reserved_special_token_0|> @app.route('/pools', methods=['GET']) def pools(): return render_template('pools.html', pools=Pool.query.all()) @app.route('/pool/<pool>', metho...
flexible
{ "blob_id": "ab27780b19db6854855af51eea063f07d9eb7302", "index": 3553, "step-1": "<mask token>\n\n\n@app.errorhandler(500)\ndef internal_server_error(e):\n return render_template('500.html', error=str(e))\n\n\n<mask token>\n\n\n@app.route('/pools', methods=['GET'])\ndef pools():\n return render_template('p...
[ 5, 8, 9, 11, 13 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys,os,traceback from PIL import Image class ResizeImageBuilder: def __init__(self): # print(self.__class__) pass def setOriginImagePath(self, filePath): try: img = Image.open(filePath) # img = img.convert('R...
normal
{ "blob_id": "47119f46cdbbb7306aef8237d4f56f0f10690ae4", "index": 9245, "step-1": "<mask token>\n\n\nclass ResizeImageBuilder:\n\n def __init__(self):\n pass\n\n def setOriginImagePath(self, filePath):\n try:\n img = Image.open(filePath)\n print('origin image mode:', img....
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calc_points(expr): points = 0 hasil = eval(expr) points -= abs(24 - hasil) for c in expr: points += points_dict.get(c, 0) return points def solve(bil): bil.sort(reverse=True) expr = str(...
flexible
{ "blob_id": "c420fb855fbf5691798eadca476b6eccec4aee57", "index": 7409, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef calc_points(expr):\n points = 0\n hasil = eval(expr)\n points -= abs(24 - hasil)\n for c in expr:\n points += points_dict.get(c, 0)\n return points\n\n\ndef ...
[ 0, 3, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(CarouselImage) admin.site.register(Budget) <|reserved_special_token_1|> from django.contrib import admin from .models import CarouselImage, Budget admin.site.register(CarouselImage) admin.site.register(Budge...
flexible
{ "blob_id": "98fb70e1911522365292c86603481656e7b86d73", "index": 8337, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(CarouselImage)\nadmin.site.register(Budget)\n", "step-3": "from django.contrib import admin\nfrom .models import CarouselImage, Budget\nadmin.site.register(CarouselI...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class BaselineModule(pl.LightningModule): <|reserved_special_token_0|> def _get_hidden_size(self, input_size): self.backbone(torch.randn(1, 3, input_size, input_size)) def forward(self, input_tensor): hidden = self.backbone(input_tensor) return self.c...
flexible
{ "blob_id": "7d43b20ebee2f4cd509bbd896c9e6ae8b2c4b354", "index": 7128, "step-1": "<mask token>\n\n\nclass BaselineModule(pl.LightningModule):\n <mask token>\n\n def _get_hidden_size(self, input_size):\n self.backbone(torch.randn(1, 3, input_size, input_size))\n\n def forward(self, input_tensor):\...
[ 3, 5, 6, 7, 9 ]
from abc import ABC class Parent(ABC): def printing(self): print(self._words) class Parent2(ABC): form = "Parent2 Setup: %s" class Child(Parent, Parent2): def __init__(self, words): self._words = self.form % words super(Child, self).printing() if __name__ == "__main__": Child("hello world")
normal
{ "blob_id": "9ba60270a4afcf242de53692afd8ebff7d9b37a7", "index": 4361, "step-1": "<mask token>\n\n\nclass Parent2(ABC):\n form = 'Parent2 Setup: %s'\n\n\nclass Child(Parent, Parent2):\n\n def __init__(self, words):\n self._words = self.form % words\n super(Child, self).printing()\n\n\n<mask t...
[ 4, 6, 7, 8, 9 ]
<|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": "db920f4aadfb53bb26c5ba1fb182f12b95e14a2f", "index": 7899, "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 = [('main_app', ...
[ 0, 1, 2, 3, 4 ]
from Graph import * from PrioQueue import * from GShortestPath import * from GSpanTree import * from User import * infinity = float("inf") # 这是根据关键字找地点的方法,已经形成了某个依据属性的表后,通过关键词匹配来解决问题 # 最终输出一个yield出的迭代器,将其list化后就可以向末端输出了 def find_by_word(lst, word): # 这个是字符串匹配函数,word是客户输入,lst是循环的东西 # 最好排成优先队列 ...
normal
{ "blob_id": "b5ec6e0fc4239a53a882b455a113eaac4db6cef5", "index": 2331, "step-1": "<mask token>\n\n\nclass web:\n\n def __init__(self, lnum=0, land_list=[], graph_money=GraphAL(),\n graph_time=GraphAL(), graph_line=GraphAL()):\n self.graph_money = graph_money\n self.graph_time = graph_time...
[ 15, 21, 24, 29, 32 ]
from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.views import LoginView from django.shortcuts import render from django.views import View from django.views.generic import CreateView from resume.forms import NewResumeForm from vacancy.forms import NewVacancyForm class MenuView(View): ...
normal
{ "blob_id": "a75691af17f6d1effd469d5c2ded340c71521ee1", "index": 9310, "step-1": "<mask token>\n\n\nclass MyLoginView(LoginView):\n redirect_authenticated_user = True\n template_name = 'login.html'\n\n\nclass HomeView(View):\n\n def get(self, request, *args, **kwargs):\n form = NewVacancyForm() i...
[ 4, 6, 7, 8, 10 ]
# -*- coding: utf-8 -*- import pytest from bravado.client import ResourceDecorator from bravado.client import SwaggerClient def test_resource_exists(petstore_client): assert type(petstore_client.pet) == ResourceDecorator def test_resource_not_found(petstore_client): with pytest.raises(AttributeError) as ex...
normal
{ "blob_id": "5ee1d8ef7ec4b191e0789ceb9c6dd2d58af526a0", "index": 7875, "step-1": "<mask token>\n\n\ndef test_resource_not_found(petstore_client):\n with pytest.raises(AttributeError) as excinfo:\n petstore_client.foo\n assert 'foo not found' in str(excinfo.value)\n\n\n@pytest.fixture\ndef client_tag...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def edit_team(request): def get(): team_id = request.GET['team'] team = Team.objects.get(id=team_id) model = Context({'team': team}) t = loader.get_template('edit_team.html') return HttpResponse(t.render(model)) def post(): new_not...
flexible
{ "blob_id": "f66f82c5c2842fc4fcae2251d4a16a9850230041", "index": 3547, "step-1": "<mask token>\n\n\ndef edit_team(request):\n\n def get():\n team_id = request.GET['team']\n team = Team.objects.get(id=team_id)\n model = Context({'team': team})\n t = loader.get_template('edit_team.ht...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> class ModelBuilder: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def build_user(self, user_data): user = User(name=user_data.nome, federal_tax_number= FederalTaxNumber(user_data.cnpj), state_tax_number= ...
flexible
{ "blob_id": "09284a96467b09c2ad7b65530c015fdb64b198a4", "index": 2638, "step-1": "<mask token>\n\n\nclass ModelBuilder:\n <mask token>\n <mask token>\n <mask token>\n\n def build_user(self, user_data):\n user = User(name=user_data.nome, federal_tax_number=\n FederalTaxNumber(user_da...
[ 29, 30, 33, 37, 42 ]
def sqrt(number): low = 1 high = number - 1 while low <= high: mid = (low + high) /2 if mid * mid == number: return mid elif mid * mid > number: high = mid - 1 else: low = mid + 1 return low - 1 print sqrt(15)
normal
{ "blob_id": "67b060349e986b06a0ee6d8a1afee82d49989c29", "index": 6818, "step-1": "\n\n\ndef sqrt(number):\n\n low = 1\n high = number - 1\n\n while low <= high:\n\n mid = (low + high) /2\n\n if mid * mid == number:\n return mid\n\n elif mid * mid > number:\n ...
[ 0 ]
<|reserved_special_token_0|> class SoapySDRSizeList(_object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def iterator(self): return _SoapySDR.SoapySDRSizeList_iterator(self) def ...
flexible
{ "blob_id": "a6670d0d09f02b674bc31b770f42d4d8a01a4a4e", "index": 9884, "step-1": "<mask token>\n\n\nclass SoapySDRSizeList(_object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def iterator(self):\n return _SoapySDR.SoapySDRSizeList_iterator(self)\n\n ...
[ 177, 316, 400, 419, 427 ]
#!/usr/bin/python import argparse import string import numpy def gen_ft_parser(): ft_parser = argparse.ArgumentParser( description='Generate a Character-Feature Translation Table') ft_parser.add_argument('alphabet_file', metavar='alphabet_file', type=str, help='A file contianing all the char...
normal
{ "blob_id": "f4d4be174bed2704c0ad12eea2f0cd64eaaa0aaa", "index": 1973, "step-1": "<mask token>\n\n\ndef gen_ft_parser():\n ft_parser = argparse.ArgumentParser(description=\n 'Generate a Character-Feature Translation Table')\n ft_parser.add_argument('alphabet_file', metavar='alphabet_file', type=\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if a == b: print(a) else: while True: if i // a > 0 and i % a == 0 and i // b > 0 and i % b == 0: print(i) break else: i += 1 <|reserved_special_token_1|> a = int(inpu...
flexible
{ "blob_id": "af5ebdcd818fdf9c607240733b7b5dbb793cf55e", "index": 7328, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a == b:\n print(a)\nelse:\n while True:\n if i // a > 0 and i % a == 0 and i // b > 0 and i % b == 0:\n print(i)\n break\n else:\n ...
[ 0, 1, 2, 3 ]
class people: def __init__(self, name): self.name = name self.purchase_descrip = [] self.purchase_price_descrip = [] self.purchases = [] self.total_spent = 0 self.debt = 0 self.debt_temp = 0 self.pay = [] self.pay_out = [] self.pay_who...
normal
{ "blob_id": "bdda42665acfefccad45a2b49f5436a186140579", "index": 8576, "step-1": "class people:\n <mask token>\n\n def add_purchase(self, purchase):\n self.purchases.append(purchase)\n\n def add_description(self, description):\n self.purchase_descrip.append(description)\n <mask token>\n...
[ 13, 18, 20, 22, 24 ]
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import re import sys import time import os # directory 현재 경로에 download폴더 생성 dirPath = "download" try: if not (os.path.isdi...
normal
{ "blob_id": "5f022b7f20b8aef1e3538a6b1e69dc302752cdc7", "index": 7640, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n if not os.path.isdir(dirPath):\n os.makedirs(os.path.join(dirPath))\nexcept OSError as e:\n print('{0} Failed to create directory!!!!!'.format(dirPath))\n<mask token>\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Torus(POVRayElement): """""" def render_scene(filename, object_type, color, location, rotation): assert object_type in object_types assert color in colors color = colors[color] size = 2 radius = size / 2 attributes = Texture(Pigment('color', color)), Fi...
flexible
{ "blob_id": "f8972067fa88e7e74e05cdcc7bdec184116dec4a", "index": 7771, "step-1": "<mask token>\n\n\nclass Torus(POVRayElement):\n \"\"\"\"\"\"\n\n\ndef render_scene(filename, object_type, color, location, rotation):\n assert object_type in object_types\n assert color in colors\n color = colors[color]...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> api_key = 'your_key' <|reserved_special_token_1|> api_key = "your_key"
flexible
{ "blob_id": "f024b0736f5fcdebede8d5b0985cf9d7170db8fc", "index": 7401, "step-1": "<mask token>\n", "step-2": "api_key = 'your_key'\n", "step-3": "api_key = \"your_key\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
for name in ["Madan", "Mohan", "Reddy", "Govindu"]: print("My name includes "+name) # Tables # for i in range(1, 11): # for j in range(1, 11): # print("{0} * {1} = {2}".format(i,j, i*j)) # print("\n") for i in range(1, 3): for j in range(4, 7): if j==5: break print...
normal
{ "blob_id": "c0376d94b34ea43e562e68cd65d4e5d2c5b04fb3", "index": 6657, "step-1": "<mask token>\n", "step-2": "for name in ['Madan', 'Mohan', 'Reddy', 'Govindu']:\n print('My name includes ' + name)\nfor i in range(1, 3):\n for j in range(4, 7):\n if j == 5:\n break\n print(j)\n",...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(word_dict) <|reserved_special_token_0|> print(multiple_list) <|reserved_special_token_0|> print(final_list) <|reserved_special_token_1|> <|reserved_special_token_0|> word_list = ['Tree', 'Apple', 'Snake', 'flowers'] word_...
flexible
{ "blob_id": "5ac489a2d30155bb92767184ad546247817e28ea", "index": 1478, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(word_dict)\n<mask token>\nprint(multiple_list)\n<mask token>\nprint(final_list)\n", "step-3": "<mask token>\nword_list = ['Tree', 'Apple', 'Snake', 'flowers']\nword_dict = {word: ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from libtbx.program_template import ProgramTemplate from mmtbx import pdbtools from libtbx import Auto import os import mmtbx.pdbtools from cctbx import uctbx class Program(ProgramTemplate): description = ''' phenix.pdbtools to...
normal
{ "blob_id": "e1228f5e17bae6632f8decd114f72723dbbce944", "index": 6186, "step-1": "<mask token>\n\n\nclass Program(ProgramTemplate):\n <mask token>\n <mask token>\n <mask token>\n\n def validate(self):\n print('Validating inputs', file=self.logger)\n self.data_manager.has_models(raise_so...
[ 3, 5, 6, 7, 8 ]
N = int(input()) A_list = list(map(int, input().split())) B_list = list(map(int, input().split())) C_list = list(map(int, input().split())) ans = 0 for i in range(N): ans += B_list[A_list[i] - 1] if i < N - 1: if A_list[i] + 1 == A_list[i + 1]: ans += C_list[A_list[i] - 1] print(ans)
normal
{ "blob_id": "cc160b1b0478446ba0daec4a0fe9e63453df3d96", "index": 5029, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n ans += B_list[A_list[i] - 1]\n if i < N - 1:\n if A_list[i] + 1 == A_list[i + 1]:\n ans += C_list[A_list[i] - 1]\nprint(ans)\n", "step-3": "...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class wxBitmapWidget(wx.Panel): <|reserved_special_token_0|> def __init__(self, parent): """ Initialize a wxBitmapWidget. Parameters ---------- parent : wx.Window The wx.Window object which serves as the widget parent. ...
flexible
{ "blob_id": "d4198c2c3706e03ba1bce3e31c5139f01248a184", "index": 5161, "step-1": "<mask token>\n\n\nclass wxBitmapWidget(wx.Panel):\n <mask token>\n\n def __init__(self, parent):\n \"\"\" Initialize a wxBitmapWidget.\n\n Parameters\n ----------\n parent : wx.Window\n ...
[ 18, 20, 25, 28, 31 ]
from temp_conversion_script import convert_c_to_f from temp_conversion_script import fever_detection def test_convert_c_to_f(): answer = convert_c_to_f(20.0) expected = 68.0 assert answer == expected def test2(): answer = convert_c_to_f(-40.0) expected = -40.0 assert answer == expected def...
normal
{ "blob_id": "d75187ed435c3d3aeeb31be4a0a4ed1754f8d160", "index": 4436, "step-1": "<mask token>\n\n\ndef test2():\n answer = convert_c_to_f(-40.0)\n expected = -40.0\n assert answer == expected\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_convert_c_to_f():\n answer = convert_c_to_f(20...
[ 1, 2, 3, 4 ]
from django.urls import path from group import views app_name = 'group' urlpatterns = [ path('group/',views.CreateGroup.as_view(), name='group_create'), path('shift/',views.CreateShift.as_view(), name='shift_create'), path('subject/',views.createSubject.as_view(), name='subject_create'), ]
normal
{ "blob_id": "0b7e858eb6d4a5f3cf6aca4fea994dae9f889caa", "index": 4781, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'group'\nurlpatterns = [path('group/', views.CreateGroup.as_view(), name=\n 'group_create'), path('shift/', views.CreateShift.as_view(), name=\n 'shift_create'), path('su...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: det, frame_with_color = camera.read() frame = cv2.cvtColor(frame_with_color, cv2.COLOR_BGR2GRAY) frame_kp, frame_desc = sift.detectAndCompute(frame, None) matches = bf.knnMatch(frame_desc, train_desc, k...
flexible
{ "blob_id": "1a78d9e0807824263fd46547d5b75c61610456d4", "index": 1912, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n det, frame_with_color = camera.read()\n frame = cv2.cvtColor(frame_with_color, cv2.COLOR_BGR2GRAY)\n frame_kp, frame_desc = sift.detectAndCompute(frame, None)\n ...
[ 0, 1, 2, 3, 4 ]
from pymongo import MongoClient from datetime import datetime import sys import requests import urllib import json import xml.etree.ElementTree as ET import xmltodict import pandas from lxml import etree from bson.json_util import dumps bornTables = pandas.read_html("http://statis.moi.gov.tw/micst/stmain.jsp?sys=220&y...
normal
{ "blob_id": "7deaee28674c465694c348c21e87addbcc8ea923", "index": 8237, "step-1": "from pymongo import MongoClient\nfrom datetime import datetime\nimport sys\nimport requests\nimport urllib\nimport json\nimport xml.etree.ElementTree as ET\nimport xmltodict\nimport pandas\nfrom lxml import etree\nfrom bson.json_ut...
[ 0 ]
<|reserved_special_token_0|> class Session: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Session: <|reserved_special_token_0|> def start(self): self.board.draw() session = True while session: ...
flexible
{ "blob_id": "f51a21ed71ede4e7462d9c77cb932a5f05b09e71", "index": 9174, "step-1": "<mask token>\n\n\nclass Session:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Session:\n <mask token>\n\n def start(self):\n self.board.draw()\n session = True\n while sess...
[ 1, 2, 3, 4, 5 ]
<|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": "807b20f4912ab89bf73966961536a4cd4367f851", "index": 6468, "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 = [('page', '000...
[ 0, 1, 2, 3, 4 ]
# Copyright (c) Facebook, Inc. and its affiliates. from .build import build_backbone, BACKBONE_REGISTRY # noqa F401 isort:skip from .backbone import Backbone from .fpn import FPN from .resnet import ResNet, ResNetBlockBase, build_resnet_backbone, make_stage __all__ = [k for k in globals().keys() if not k.star...
normal
{ "blob_id": "502f405f48df92583757ebc9edb4b15910c1f76a", "index": 2305, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = [k for k in globals().keys() if not k.startswith('_')]\n", "step-3": "from .build import build_backbone, BACKBONE_REGISTRY\nfrom .backbone import Backbone\nfrom .fpn import FP...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def test_build_identifier(): assert 'role:server_base' == Node.build_identifier('server_base', 'role') def test_identifier(): node = Node('server_base', 'role', 'irrelevant') assert 'role:server_base' == node.identifier() def test_add_successor(): parent = Node('appser...
flexible
{ "blob_id": "8e22db940124f92d3048055cf72dcaa79564cdc6", "index": 1953, "step-1": "<mask token>\n\n\ndef test_build_identifier():\n assert 'role:server_base' == Node.build_identifier('server_base', 'role')\n\n\ndef test_identifier():\n node = Node('server_base', 'role', 'irrelevant')\n assert 'role:serve...
[ 5, 6, 7, 8, 9 ]
from numba import jit @jit def resolve(): N = int(input()) ans = 0 for n in range(1, N+1): for m in range(n, N+1, n): ans += m print(ans) if __name__ == "__main__": resolve()
normal
{ "blob_id": "8d8df517ca5486e62cc1b5ac23bbcfa65ed9c1ff", "index": 6611, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@jit\ndef resolve():\n N = int(input())\n ans = 0\n for n in range(1, N + 1):\n for m in range(n, N + 1, n):\n ans += m\n print(ans)\n\n\n<mask token>\n"...
[ 0, 1, 2, 3, 4 ]
import scrapy from kingfisher_scrapy.base_spiders import BigFileSpider from kingfisher_scrapy.util import components, handle_http_error class France(BigFileSpider): """ Domain France Swagger API documentation https://doc.data.gouv.fr/api/reference/ """ name = 'france' # SimpleSpi...
normal
{ "blob_id": "369bffa21b5b8c0ca1d93da3aa30a38e2f4c82cc", "index": 9451, "step-1": "<mask token>\n\n\nclass France(BigFileSpider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://www.data.gouv.fr/api/1/datasets/donnees-essentielles-de-la...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(result) <|reserved_special_token_0|> print(result) <|reserved_special_token_0|> print(result) <|reserved_special_token_0|> print(result) <|reserved_special_token_0|> print(result) <|reserved_special_token_0|> print(result) <...
flexible
{ "blob_id": "e0e00688a75021c2f8b608d4c942f5e68f6a6a48", "index": 6282, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Thu Jan 2 22:49:00 2020 @author: Drew ____________________________________________________________________ basic_github_auto_uploader.py - A Basic Automated GitHub Uploader ____________________________________________________________________ 1. Requirements: Version: ...
normal
{ "blob_id": "bcc3d4e9be0de575c97bb3bf11eeb379ab5be458", "index": 5380, "step-1": "<mask token>\n\n\ndef main():\n subs = subdir_maker(os.path.dirname(os.path.realpath(__file__)))\n for i in range(len(subs)):\n daily_github_upload(subs[i])\n print('_' * 40 + '\\n\\n' + 'Uploaded {0} to Github....
[ 1, 2, 3, 4, 5 ]
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def splitListToParts(self, root, k): """ :type root: ListNode :type k: int :rtype: List[ListNode] """ if not root: return [None]*k res...
normal
{ "blob_id": "6a609c91122f8b66f57279cff221ee76e7fadb8c", "index": 7059, "step-1": "# Definition for singly-linked list.\n# class ListNode(object):\n# def __init__(self, x):\n# self.val = x\n# self.next = None\n\nclass Solution(object):\n\tdef splitListToParts(self, root, k):\n\t\t\"\"\"\n\t\t...
[ 0 ]
import numpy as np import cv2 import serial import serial.tools.list_ports import time import random import math #import mcpi.minecraft as minecraft #import mcpi.block as block #from house import House #Arduino Serials ports = list(serial.tools.list_ports.comports()) print (ports) for p in ports: print (p[1]) ...
normal
{ "blob_id": "7c80c98e32f386362003ac3cd729fa9b279b8e8e", "index": 7316, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(ports)\nfor p in ports:\n print(p[1])\n if 'Arduino' in p[1]:\n ser = serial.Serial(port=p[0])\n else:\n print('No Arduino Device was found connected to the c...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from plone import api from plone.dexterity.content import Container from sc.microsite.interfaces import IMicrosite from zope.interface import implementer @implementer(IMicrosite) class Microsite(Container): """A microsite.""" def getLocallyAllowedTypes(self): """ By no...
normal
{ "blob_id": "3d5d88edca5d746b830363cc9451bda94c1d7aa4", "index": 2905, "step-1": "<mask token>\n\n\n@implementer(IMicrosite)\nclass Microsite(Container):\n <mask token>\n\n def getLocallyAllowedTypes(self):\n \"\"\"\n By now we allow all allowed types without constrain.\n TODO: fully i...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # Copyright (c) 2018 Nobody # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test perforance of descendant package (chained transactions)""" import time import copy from test_framework.test_framework import...
normal
{ "blob_id": "661eef8500309191514fd760b7518014dee2bb5f", "index": 9225, "step-1": "<mask token>\n\n\nclass ChainedTest(BitcoinTestFramework):\n\n def set_test_params(self):\n \"\"\" our test network requires a peer node so that getblocktemplate succeeds \"\"\"\n self.num_nodes = 2\n chaine...
[ 7, 8, 9, 10, 13 ]