code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Pepito') print('Cumpleaños: 22 de enero') <|reserved_special_token_0|> print('Tengo', edad, 'años') <|reserved_special_token_0|> print('Me gusta la música de', cantante) print('Me gusta cenar', comida) print('Vivo en', ciudad) <|reserved_special_toke...
flexible
{ "blob_id": "f26c624e8ae9711eb835e223407256e60dfc6d6e", "index": 8945, "step-1": "<mask token>\n", "step-2": "print('Pepito')\nprint('Cumpleaños: 22 de enero')\n<mask token>\nprint('Tengo', edad, 'años')\n<mask token>\nprint('Me gusta la música de', cantante)\nprint('Me gusta cenar', comida)\nprint('Vivo en', ...
[ 0, 1, 2, 3 ]
#/usr/bin/env python3 """Demonstrates how to do deterministic task generation using l2l""" import random def fixed_random(func): """Create the data""" def _func(self, i): state = random.getstate() if self.deterministic or self.seed is not None: random.seed(self.seed + i) ...
normal
{ "blob_id": "7ee5779625d53ff1e18f73b20ba5849666f89b55", "index": 2111, "step-1": "<mask token>\n\n\nclass RandomTest:\n\n def __init__(self, seed=42, deterministic=False):\n self.seed = seed\n self.deterministic = deterministic\n\n @fixed_random\n def test_function(self, i):\n retur...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> def _build_url(**kargs): query = {'function': 'TIME_SERIES_DAILY', 'symbol': 'SPY', 'outputsize': 'full', 'datatype': 'json', 'apikey': 'JPIO2GNGBMFRLGMN'} query.update(kargs) query_str = '&'.join([f'{key}={val}' for key, val in query.items()]) return f'{url_base}?...
flexible
{ "blob_id": "e99d3ae82d8eea38d29d6c4f09fdb3858e36ca50", "index": 6518, "step-1": "<mask token>\n\n\ndef _build_url(**kargs):\n query = {'function': 'TIME_SERIES_DAILY', 'symbol': 'SPY', 'outputsize':\n 'full', 'datatype': 'json', 'apikey': 'JPIO2GNGBMFRLGMN'}\n query.update(kargs)\n query_str = '...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- from __future__ import print_function """phy main CLI tool. Usage: phy --help """ #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import sys import os.path as op im...
normal
{ "blob_id": "539523f177e2c3c0e1fb0226d1fcd65463b68a0e", "index": 6576, "step-1": "<mask token>\n\n\nclass Parser(argparse.ArgumentParser):\n\n def error(self, message):\n sys.stderr.write(message + '\\n\\n')\n self.print_help()\n sys.exit(2)\n\n\n<mask token>\n\n\nclass ParserCreator(obje...
[ 17, 18, 29, 30, 32 ]
import random import datetime import os import time import json # l_target_path = "E:/code/PYTHON_TRAINING/Training/Apr2020/BillingSystem/bills/" while True: l_store_id = random.randint(1, 4) now = datetime.datetime.now() l_bill_id = now.strftime("%Y%m%d%H%M%S") # Generate Random Date start_da...
normal
{ "blob_id": "fad2ad89e4d0f04fad61e27048397a5702870ca9", "index": 6177, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n l_store_id = random.randint(1, 4)\n now = datetime.datetime.now()\n l_bill_id = now.strftime('%Y%m%d%H%M%S')\n start_date = datetime.date(2000, 1, 1)\n end_da...
[ 0, 1, 2, 3, 4 ]
from __future__ import annotations from typing import TYPE_CHECKING import abc import tcod.event if TYPE_CHECKING: from tcodplus.canvas import Canvas from tcodplus.event import CanvasDispatcher class IDrawable(abc.ABC): @property @abc.abstractmethod def force_redraw(self) -> bool: pass ...
normal
{ "blob_id": "e37f958191c9481c6664e90c17f43419a0b5b606", "index": 8131, "step-1": "<mask token>\n\n\nclass IDrawable(abc.ABC):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass IFocusable(abc.ABC):\n\n @property\n @abc.abstractmethod\n def focus_dispatcher(self) ->CanvasD...
[ 14, 15, 17, 18, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> bw2_schema = Schema(name=TEXT(stored=True, sortable=True), comment=TEXT( stored=True), product=TEXT(stored=True, sortable=True), categories=TEXT (stored=True), location=TEXT(stored=True, sortable=True), database=TEXT (...
flexible
{ "blob_id": "07aafcb3db9c57ad09a29a827d72744ef0d22247", "index": 3319, "step-1": "<mask token>\n", "step-2": "<mask token>\nbw2_schema = Schema(name=TEXT(stored=True, sortable=True), comment=TEXT(\n stored=True), product=TEXT(stored=True, sortable=True), categories=TEXT\n (stored=True), location=TEXT(sto...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python t = int(raw_input()) for i in xrange(1, t+1): N = raw_input() N1 = N track = set() if N == '0': print "Case #%s: " % i + "INSOMNIA" continue count = 2 while len(track) !=10: temp = set(x for x in N1) track = temp | track N1 = str(co...
normal
{ "blob_id": "8c6b7032c85354740d59aa91108ad8b5279e1d45", "index": 2570, "step-1": "#! /usr/bin/env python\n\nt = int(raw_input())\nfor i in xrange(1, t+1):\n N = raw_input()\n N1 = N\n track = set()\n if N == '0':\n print \"Case #%s: \" % i + \"INSOMNIA\"\n continue\n count = 2\n w...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if minutos > 800: total = minutos * 0.08 elif minutos > 400 and minutos <= 800: total = minutos * 0.15 elif minutos < 200: total = minutos * 0.2 else: total = minutos * 0.18 print('Valor da conta: R$ %.2f' % total)...
flexible
{ "blob_id": "1b3e64be988495454535ca96c7a1b6c20aa27076", "index": 2648, "step-1": "<mask token>\n", "step-2": "<mask token>\nif minutos > 800:\n total = minutos * 0.08\nelif minutos > 400 and minutos <= 800:\n total = minutos * 0.15\nelif minutos < 200:\n total = minutos * 0.2\nelse:\n total = minut...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def find_and_display_patter_in_series(*, series, pattern): """I used that function when i don't remeber full name of a given column""" res = series.loc[series.str.contains(pattern)] return res <|reserved_special_token_0|> def find_patter_in_series(*, s, pat, tolist=True): ...
flexible
{ "blob_id": "5f50b20bd044471ebb8e1350d1a75a250b255d8f", "index": 8854, "step-1": "<mask token>\n\n\ndef find_and_display_patter_in_series(*, series, pattern):\n \"\"\"I used that function when i don't remeber full name of a given column\"\"\"\n res = series.loc[series.str.contains(pattern)]\n return res...
[ 4, 5, 7, 8, 10 ]
botName = "firstBot" username = "mrthemafia" password = "oblivion" client_id = "Y3LQwponbEp07w" client_secret = "R4oyCEj6hSTJWHfWMwb-DGUOBm8"
normal
{ "blob_id": "3031f695d57492cf3b29694fecd0a41c469a3e00", "index": 7481, "step-1": "<mask token>\n", "step-2": "botName = 'firstBot'\nusername = 'mrthemafia'\npassword = 'oblivion'\nclient_id = 'Y3LQwponbEp07w'\nclient_secret = 'R4oyCEj6hSTJWHfWMwb-DGUOBm8'\n", "step-3": "botName = \"firstBot\"\nusername = \"m...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Net(torch.nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Net, self).__init__() self.hidden = torch.nn.Linear(n_feature, n_hidden) self.predict = torch.nn.Linear(n_hidden, n_output) def forward(self, x): h1 = F.relu(self...
flexible
{ "blob_id": "e221553f866de8b3e175197a40982506bf8c1ef9", "index": 205, "step-1": "<mask token>\n\n\nclass Net(torch.nn.Module):\n\n def __init__(self, n_feature, n_hidden, n_output):\n super(Net, self).__init__()\n self.hidden = torch.nn.Linear(n_feature, n_hidden)\n self.predict = torch.n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class GameManager: def __init__(self): self.screen = pygame.display.set_mode((1280, 720), flags=pygame. FULLSCREEN | pygame.HWSURFACE | pygame.DOUBLEBUF) self.running = True self.delta_time = 1 self.active_scene = None self.load_sce...
flexible
{ "blob_id": "91806afea92587476ac743346b88098b197a033c", "index": 9706, "step-1": "<mask token>\n\n\nclass GameManager:\n\n def __init__(self):\n self.screen = pygame.display.set_mode((1280, 720), flags=pygame.\n FULLSCREEN | pygame.HWSURFACE | pygame.DOUBLEBUF)\n self.running = True\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Autorization: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class AutorizationClient(Autorization): """ Manejo de autorizaciones de clientes, se listan los clientes, en orden de pendiente, aprobado y ...
flexible
{ "blob_id": "b78ad3a55eb27fd91f89c22db07fadca297640ab", "index": 2892, "step-1": "<mask token>\n\n\nclass Autorization:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AutorizationClient(Autorization):\n \"\"\"\n Manejo de autorizaciones de clientes,\n se listan los clientes, en...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_even(a): check_integer(a) if a % 2 == 0: print('true') return True else: print('false') return False <|reserved_special_token_0|> <|reserved_special_token_1|> def check_int...
flexible
{ "blob_id": "92391f17380b2e09cc9b3913f15ce35189d9893d", "index": 8241, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_even(a):\n check_integer(a)\n if a % 2 == 0:\n print('true')\n return True\n else:\n print('false')\n return False\n\n\n<mask token>\n", ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(100): numero = int(input('Digite um valor:')) if numero % 2 == 0: contador_pares += 1 else: contador_impares += 1 print('A quantidade de números pares é igual a:', contador_pares) print('...
flexible
{ "blob_id": "03aa33861def30a46de85c5b309878a1180a760f", "index": 5211, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(100):\n numero = int(input('Digite um valor:'))\n if numero % 2 == 0:\n contador_pares += 1\n else:\n contador_impares += 1\nprint('A quantidade de n...
[ 0, 1, 2 ]
import torch import numpy as np # source: https://github.com/krasserm/bayesian-machine-learning/blob/master/gaussian_processes.ipynb def kernel(X1, X2, l=1.0, sigma_f=1.0): ''' Isotropic squared exponential kernel. Computes a covariance matrix from points in X1 and X2. Args: X1: Array of m points (m x d). X2: Arr...
normal
{ "blob_id": "82c3bde5746d04c126a93851844f775e7ce65f4b", "index": 9442, "step-1": "<mask token>\n\n\nclass CNP(torch.nn.Module):\n <mask token>\n <mask token>\n\n\nclass ANP(torch.nn.Module):\n\n def __init__(self, in_dim, hidden_dim, query_dim, out_dim, en_layer,\n dec_layer, nhead):\n sup...
[ 7, 8, 9, 10, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GetInTouchForm(forms.ModelForm): class Meta: model = GetInTouch fields = '__all__' <|reserved_special_token_1|> from django import forms from .models import GetInTouch class GetInTouchForm(forms....
flexible
{ "blob_id": "c8dc143c09aa7f677167a4942ae1c4a0fbf75128", "index": 3219, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GetInTouchForm(forms.ModelForm):\n\n\n class Meta:\n model = GetInTouch\n fields = '__all__'\n", "step-3": "from django import forms\nfrom .models import GetI...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def md5_hexdigest(data): return hashlib.md5(data.encode('utf-8')).hexdigest() def sha1_hexdigest(data): return hashlib.sha1(data.encode('utf-8')).hexdigest() def sha224_hexdigest(data): return hashlib.sha224(data.encode('utf-8')).hexdigest() <|reserved_special_token_0|> ...
flexible
{ "blob_id": "35a95c49c2dc09b528329433a157cf313cf59667", "index": 8955, "step-1": "<mask token>\n\n\ndef md5_hexdigest(data):\n return hashlib.md5(data.encode('utf-8')).hexdigest()\n\n\ndef sha1_hexdigest(data):\n return hashlib.sha1(data.encode('utf-8')).hexdigest()\n\n\ndef sha224_hexdigest(data):\n re...
[ 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def reorderAssetsByTypes(nodePath, colorNode=True, alignNode=True): node = hou.pwd() def getNaskCasting(): path = 'E:/WIP/Work/casting-nask.csv' file = open(path, 'r') fileText = file.readlines() file.close() f...
flexible
{ "blob_id": "3073850890eb7a61fb5200c5ab87c802cafe50bb", "index": 7229, "step-1": "<mask token>\n", "step-2": "def reorderAssetsByTypes(nodePath, colorNode=True, alignNode=True):\n node = hou.pwd()\n\n def getNaskCasting():\n path = 'E:/WIP/Work/casting-nask.csv'\n file = open(path, 'r')\n ...
[ 0, 1, 2, 3 ]
#! /usr/bin/python from bs4 import BeautifulSoup import requests import sys def exit(err): print err sys.exit(0) def get_text(node, lower = True): if lower: return (''.join(node.findAll(text = True))).strip().lower() return (''.join(node.findAll(text = True))).strip() def get_method_signatu...
normal
{ "blob_id": "e3119979028d3dd4e1061563db4ec20607e744d1", "index": 3749, "step-1": "#! /usr/bin/python\n\nfrom bs4 import BeautifulSoup\n\nimport requests\nimport sys\n\ndef exit(err):\n print err\n sys.exit(0)\n\ndef get_text(node, lower = True):\n if lower:\n return (''.join(node.findAll(text = T...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Config(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|re...
flexible
{ "blob_id": "c27c2df1830f066ca4f973c46967722869090d05", "index": 1373, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Config(object):\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>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution: def maxArea(self, h: int, w: int, horizontalCuts: List[int], verticalCuts: List[int]) ->int: horizontalCuts.sort() verticalCuts.sort() horizontalCuts.append(h) verticalCuts.append(w) hbreadth = 0 prev = 0 ...
flexible
{ "blob_id": "8fb559810fbf79f0849ed98e51d3f2ad1ccc4b8b", "index": 8296, "step-1": "<mask token>\n\n\nclass Solution:\n\n def maxArea(self, h: int, w: int, horizontalCuts: List[int],\n verticalCuts: List[int]) ->int:\n horizontalCuts.sort()\n verticalCuts.sort()\n horizontalCuts.appe...
[ 2, 3, 4, 5, 6 ]
from web3 import Web3, HTTPProvider, IPCProvider from tcmb.tcmb_parser import TCMB_Processor from ecb.ecb_parser import ECB_Processor from web3.contract import ConciseContract from web3.middleware import geth_poa_middleware import json import time tcmb_currencies = ["TRY", "USD", "AUD", "DKK", "EUR", "GBP", "CHF", "SE...
normal
{ "blob_id": "ecd5097d9d497b62b89217ee3c46506f21fc15d2", "index": 5065, "step-1": "<mask token>\n\n\ndef epoch_day(epoch_time):\n epoch_time = int(epoch_time)\n return epoch_time - epoch_time % 86400\n\n\n<mask token>\n\n\ndef add_ecb():\n unix_time = Web3.toInt(epoch_day(time.time()))\n ECB = ECB_Pro...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def countVowels(string): count = 0 vowels = ['a', 'e', 'i', 'o', 'u', 'y'] for vowel in vowels: count += string.count(vowel) return count <|reserved_special_token_0|> def isPalindrome(string): return reverse(string) == string def main(): count = 5 ...
flexible
{ "blob_id": "d60690892eddda656c11470aacd1fdc9d07a721a", "index": 3563, "step-1": "<mask token>\n\n\ndef countVowels(string):\n count = 0\n vowels = ['a', 'e', 'i', 'o', 'u', 'y']\n for vowel in vowels:\n count += string.count(vowel)\n return count\n\n\n<mask token>\n\n\ndef isPalindrome(string...
[ 3, 4, 5, 6, 7 ]
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) import files import genetics def main(argv): S = files.read_lines(argv[0]) S_rc = [genetics.dna_complement(s) for s in S] S_u = set(S + S_rc) B_k = [] for s in S_u: B_k.append((s[:-1], s[1:]))...
normal
{ "blob_id": "b616b907eb67fff97d57ee2b0d3ab8e01d154956", "index": 2038, "step-1": "import os\nimport sys\nsys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))\n\nimport files\nimport genetics\n\n\ndef main(argv):\n S = files.read_lines(argv[0])\n S_rc = [genetics.dna_complement(s) for s i...
[ 0 ]
# -*- coding: utf-8 -*- # # File: PatrimonyCertificate.py # # Copyright (c) 2015 by CommunesPlone # Generator: ArchGenXML Version 2.7 # http://plone.org/products/archgenxml # # GNU General Public License (GPL) # __author__ = """Gauthier BASTIEN <gbastien@commune.sambreville.be>, Stephan GEULETTE <stephan.ge...
normal
{ "blob_id": "6c0b2fa8166bb21a514dc188858e1de285ad9b0a", "index": 166, "step-1": "<mask token>\n\n\nclass PatrimonyCertificate(BaseFolder, GenericLicence, Inquiry,\n BrowserDefaultMixin):\n <mask token>\n security = ClassSecurityInfo()\n implements(interfaces.IPatrimonyCertificate)\n meta_type = 'P...
[ 6, 8, 9, 10, 12 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import base64 import json import os import re import subprocess import time import traceback import zipfile from datetime import datetime import requests from flask import request, current_app from library.oss import oss_upload_monkey_package_picture from public_config import...
normal
{ "blob_id": "bf45349a9fdfcef7392c477e089c5e3916cb4c8e", "index": 8502, "step-1": "<mask token>\n\n\nclass ToolBusiness(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ToolBusiness(object):\n\n @classmethod\n def get_tool_ip(cls):\n ip = request.args.get('ip')\n ...
[ 1, 2, 3, 4, 5 ]
import inspect import re import openquake.hazardlib.source as oqsrc # List of valid attributes for an area source AREAS_ATTRIBUTES = set(['source_id', 'name', 'tectonic_region_type', 'mfd', 'rupture_mesh_spacing', 'magnitude_scaling_relationship', ...
normal
{ "blob_id": "8adf8cfc72d5af955bf7509d3573a9bcc7c0845e", "index": 7537, "step-1": "<mask token>\n\n\nclass OQtSource(object):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n if len(args):\n self.source_id = args[0]\n if len(args) > 1:\n self.source_type ...
[ 2, 4, 5, 7, 8 ]
from collections import Counter, defaultdict from random import randrange from copy import deepcopy import sys def election(votes, message=True, force_forward=False): votes = deepcopy(votes) N = len(votes) for i in range(N): obtained = Counter([v[-1] for v in votes if len(v)]).most_common() ...
normal
{ "blob_id": "05764d1cfd9573616fcd6b125280fddf2e5ce7ad", "index": 3712, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef election(votes, message=True, force_forward=False):\n votes = deepcopy(votes)\n N = len(votes)\n for i in range(N):\n obtained = Counter([v[-1] for v in votes if l...
[ 0, 1, 2, 3, 4 ]
import flask import flask_sqlalchemy app = flask.Flask(__name__) app.config.from_pyfile('settings.py') db = flask_sqlalchemy.SQLAlchemy(app)
normal
{ "blob_id": "2ed0ae48e8fec2c92effcbb3e495a1a9f4636c27", "index": 6777, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_pyfile('settings.py')\n<mask token>\n", "step-3": "<mask token>\napp = flask.Flask(__name__)\napp.config.from_pyfile('settings.py')\ndb = flask_sqlalchemy.SQLAlchemy(app...
[ 0, 1, 2, 3 ]
{ 'variables': { 'node_shared_openssl%': 'true' }, 'targets': [ { 'target_name': 'keypair', 'sources': [ 'secp256k1/keypair.cc' ], 'conditions': [ # For Windows, require either a 32-bit or 64-bit # separately-compiled OpenSSL library. # Currently set up to ...
normal
{ "blob_id": "e7b30353fd25beb9d5cdeee688e4ffa6955d4221", "index": 8437, "step-1": "<mask token>\n", "step-2": "{'variables': {'node_shared_openssl%': 'true'}, 'targets': [{'target_name':\n 'keypair', 'sources': ['secp256k1/keypair.cc'], 'conditions': [[\n 'OS==\"win\"', {'conditions': [['target_arch==\"x6...
[ 0, 1, 2 ]
#case1 print("My name is Jia-Chi. \nI have an older sister. \nI prefer Coke.\nMy favorite song is \"Amazing Grace\"") #case2 print('''Liang, Jia-Chi 1 Coke Amazing Grace''')
normal
{ "blob_id": "55986f6c2dafe650704660142cf85640e763b26d", "index": 3291, "step-1": "<mask token>\n", "step-2": "print(\n \"\"\"My name is Jia-Chi. \nI have an older sister. \nI prefer Coke.\nMy favorite song is \"Amazing Grace\\\"\"\"\"\n )\nprint(\"\"\"Liang, Jia-Chi\n1\nCoke\nAmazing Grace\"\"\")\n", "...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def write(output_filename, content): with open(output_filename, 'w') as outfile: outfile.write(content) def main(argv): """ WebPerf Core Carbon Percentiles Usage: * run webperf-core test on all websites you want to use for your percentiles (with json as out...
flexible
{ "blob_id": "a801ca6ae90556d41fd278032af4e58a63709cec", "index": 7977, "step-1": "<mask token>\n\n\ndef write(output_filename, content):\n with open(output_filename, 'w') as outfile:\n outfile.write(content)\n\n\ndef main(argv):\n \"\"\"\n WebPerf Core Carbon Percentiles\n\n\n Usage:\n * ru...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Seu número é {} seu antecessor é {} e seu sucessor é {}'.format(n, m, o) ) <|reserved_special_token_1|> n = int(input('Digite um número')) m = n - 1 o = n + 1 print('Seu número é {} seu antecessor é {} e seu sucessor...
flexible
{ "blob_id": "47d72379b894826dad335f098649702ade195f78", "index": 7337, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Seu número é {} seu antecessor é {} e seu sucessor é {}'.format(n, m, o)\n )\n", "step-3": "n = int(input('Digite um número'))\nm = n - 1\no = n + 1\nprint('Seu número é {} se...
[ 0, 1, 2, 3 ]
# vim: expandtab # -*- coding: utf-8 -*- from poleno.utils.template import Library from chcemvediet.apps.obligees.models import Obligee register = Library() @register.simple_tag def gender(gender, masculine, feminine, neuter, plurale): if gender == Obligee.GENDERS.MASCULINE: return masculine elif gen...
normal
{ "blob_id": "c9d12f14fa0e46e4590746d45862fe255b415a1d", "index": 396, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@register.simple_tag\ndef gender(gender, masculine, feminine, neuter, plurale):\n if gender == Obligee.GENDERS.MASCULINE:\n return masculine\n elif gender == Obligee.GENDE...
[ 0, 1, 2, 3, 4 ]
import asyncio import logging from datetime import datetime from discord.ext import commands from discord.ext.commands import Bot, Context from humanize import precisedelta from sqlalchemy.exc import SQLAlchemyError from sqlalchemy_utils import ScalarListException from config import CONFIG from models import Reminder...
normal
{ "blob_id": "0f54853901a26b66fe35106593ded6c92785b8db", "index": 2682, "step-1": "<mask token>\n\n\nclass Reminders(commands.Cog):\n\n def __init__(self, bot: Bot):\n self.bot = bot\n self.bot.loop.create_task(reminder_check(self.bot))\n\n @commands.group(help=LONG_HELP_TEXT, brief=SHORT_HELP...
[ 3, 4, 5, 6, 7 ]
""" Main CLI endpoint for GeoCube """ import importlib.metadata import click from click import group import geocube.cli.commands as cmd_modules from geocube import show_versions CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], "token_normalize_func": lambda x: x.replace("-", "_"), } def check_ve...
normal
{ "blob_id": "0964121d88fad2906311de7532eac52ff784fff6", "index": 8306, "step-1": "<mask token>\n\n\ndef check_version(ctx, _, value):\n \"\"\"\n Print current version, and check for latest version.\n\n Called via 'geocube --version'\n\n :param ctx: Application context object (click.Context)\n :par...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- """Digital Forensics Virtual File System (dfVFS). dfVFS, or Digital Forensics Virtual File System, is a Python module that provides read-only access to file-system objects from various storage media types and file formats. """
normal
{ "blob_id": "f7d3096d669946e13186a893ffc53067e0fd0a0a", "index": 1065, "step-1": "<mask token>\n", "step-2": "# -*- coding: utf-8 -*-\n\"\"\"Digital Forensics Virtual File System (dfVFS).\n\ndfVFS, or Digital Forensics Virtual File System, is a Python module\nthat provides read-only access to file-system objec...
[ 0, 1 ]
import sys minus = "-" plus = "+" divis = "/" multi = "*" power = "^" unary = "-" br_op = "(" br_cl = ")" operations = [power, divis, multi, minus, plus] digits = ['1','2','3','4','5','6','7','8','9','0','.'] def find_close_pos(the_string): open_count = 0 close_count = 0 for i in range(len(the_string)): if the...
normal
{ "blob_id": "c0c8f40e43f1c27f8efa47cfc366c6076b77b9c9", "index": 9337, "step-1": "import sys\n\nminus = \"-\"\nplus = \"+\"\ndivis = \"/\"\nmulti = \"*\"\npower = \"^\"\nunary = \"-\"\nbr_op = \"(\"\nbr_cl = \")\"\n\noperations = [power, divis, multi, minus, plus]\ndigits = ['1','2','3','4','5','6','7','8','9',...
[ 0 ]
class Node: <|reserved_special_token_0|> class Solution(object): def postorder(self, root): """ :type root: Node :rtype: List[int] """ if not root: return [] if not root.children: return [root.val] result = [] for child i...
flexible
{ "blob_id": "93ec15a37bd5f022e8f6e226e3bf0e91cc0457c6", "index": 2178, "step-1": "class Node:\n <mask token>\n\n\nclass Solution(object):\n\n def postorder(self, root):\n \"\"\"\n :type root: Node\n :rtype: List[int]\n \"\"\"\n if not root:\n return []\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def get_paths(debug, dataset): if debug and dataset == 'OASIS': project_wd = os.getcwd() project_data = os.path.join(project_wd, 'data') project_sink = os.path.join(project_data, 'output') elif debug and dataset == 'BANC': project_wd = os.getcwd() ...
flexible
{ "blob_id": "2e9d71b8055e1bab107cedae69ca3bc4219e7d38", "index": 7460, "step-1": "<mask token>\n\n\ndef get_paths(debug, dataset):\n if debug and dataset == 'OASIS':\n project_wd = os.getcwd()\n project_data = os.path.join(project_wd, 'data')\n project_sink = os.path.join(project_data, 'o...
[ 16, 17, 18, 21, 23 ]
<|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": "2c1ea45d3c7ee822ec58c2fadaf7fc182acc4422", "index": 9264, "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 = [('api', '0001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ROUTE_LIST = [webapp2.Route('/api/history<name:/(?:[a-zA-Z0-9_-]+/?)*>', handler=handlers.HistoryApi, name='historyApi'), webapp2.Route( '/api<name:/(?:[a-zA-Z0-9_-]+/?)*>', handler=handlers.PageApi, name= 'pageApi'), ...
flexible
{ "blob_id": "a61bc654eecb4e44dce3e62df752f80559a2d055", "index": 9184, "step-1": "<mask token>\n", "step-2": "<mask token>\nROUTE_LIST = [webapp2.Route('/api/history<name:/(?:[a-zA-Z0-9_-]+/?)*>',\n handler=handlers.HistoryApi, name='historyApi'), webapp2.Route(\n '/api<name:/(?:[a-zA-Z0-9_-]+/?)*>', han...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def cameras_get_info(): """ cameras_get_info - reads the camera info from the XML file and puts it into a python data structure and returns it. """ status = 0 xmldoc = minidom.parse(CAMERA_XML_FILE) i...
flexible
{ "blob_id": "510d411d79d5df8658703241f161b3e2a9ec5932", "index": 4110, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cameras_get_info():\n \"\"\"\n cameras_get_info - reads the camera info from the XML file and\n puts it into a python data structure and returns it.\n \"\"\"\n stat...
[ 0, 1, 2, 3, 4 ]
# Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ if len(s)...
normal
{ "blob_id": "7c39b3927bc0702818c54875785b4657c20c441e", "index": 2272, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def longestPalindrome(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def ConfigObject(config_path): """read a configuration file to retrieve access token""" configDict = {} with open(config_path, 'r') as config: for line in config.readlines(): try: configDict[line.split('=')[0]] = line.split('=')[1].rstrip() ...
flexible
{ "blob_id": "e76ebbe8dab2e5169ef40b559f783c49ba4de825", "index": 1750, "step-1": "<mask token>\n\n\ndef ConfigObject(config_path):\n \"\"\"read a configuration file to retrieve access token\"\"\"\n configDict = {}\n with open(config_path, 'r') as config:\n for line in config.readlines():\n ...
[ 3, 4, 5, 6, 7 ]
from django import template from ..models import Article # 得到django 负责管理标签和过滤器的类 register = template.Library() @register.simple_tag def getlatestarticle(): latearticle = Article.objects.all().order_by("-atime") return latearticle
normal
{ "blob_id": "804c75b3ab0b115e5187d44e4d139cfb553269a9", "index": 6791, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@register.simple_tag\ndef getlatestarticle():\n latearticle = Article.objects.all().order_by('-atime')\n return latearticle\n", "step-3": "<mask token>\nregister = template.Li...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def prep_folder(args): """ Append to slash to filepath if needed, and generate folder if it doesn't exist""" if args.save_folder[-1] != '/': args.save_folder += '/' if not os.path.isdir(args.save_folder): ...
flexible
{ "blob_id": "18be97061c65185fcebf10c628e0e51bb08522cf", "index": 3609, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef prep_folder(args):\n \"\"\" Append to slash to filepath if needed, and generate folder if it doesn't exist\"\"\"\n if args.save_folder[-1] != '/':\n args.save_folder ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: o = sys.stdin.read(byte) if qlty > qlty * n % 1: oo = o sys.stdout.write(o) else: sys.stdout.write(oo) if not o: break n = n + 1 <|reserved_special_token_1|> <|res...
flexible
{ "blob_id": "70845ab4aab80d988a5c01d0b4fb76e63b800527", "index": 6484, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n o = sys.stdin.read(byte)\n if qlty > qlty * n % 1:\n oo = o\n sys.stdout.write(o)\n else:\n sys.stdout.write(oo)\n if not o:\n break\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def process_frame(img): global vid_data img = cv2.resize(img, (w, h)) cv2.imshow('Frame', img) cv2.waitKey(1) vid_data = np.append(vid_data, img, axis=0) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def process_frame(img...
flexible
{ "blob_id": "eb81b0e41743e1785b82e88f6a618dc91eba73e5", "index": 1389, "step-1": "<mask token>\n\n\ndef process_frame(img):\n global vid_data\n img = cv2.resize(img, (w, h))\n cv2.imshow('Frame', img)\n cv2.waitKey(1)\n vid_data = np.append(vid_data, img, axis=0)\n\n\n<mask token>\n", "step-2": ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class AuthorizationError(ValueError): pass class BearerTokenValidator: def __init__(self, access_token, app_context: AppContext): self.access_token = access_token user_service = app_context.user_service self.blacklist_token_repo = app_context.blacklist_t...
flexible
{ "blob_id": "97d4387c7bfd141b5a7019b221adb550105d4351", "index": 604, "step-1": "<mask token>\n\n\nclass AuthorizationError(ValueError):\n pass\n\n\nclass BearerTokenValidator:\n\n def __init__(self, access_token, app_context: AppContext):\n self.access_token = access_token\n user_service = a...
[ 10, 12, 17, 19, 21 ]
import csv with open('./csvs/users.csv', encoding='utf-8', newline='') as users_csv: reader = csv.reader(users_csv) d = {} for row in reader: userId, profileName = row if profileName == 'A Customer': continue value = d.get(profileName) if not value: d...
normal
{ "blob_id": "3b77f7ea5137174e6723368502659390ea064c5a", "index": 8968, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('./csvs/users.csv', encoding='utf-8', newline='') as users_csv:\n reader = csv.reader(users_csv)\n d = {}\n for row in reader:\n userId, profileName = row\n ...
[ 0, 1, 2, 3 ]
# coding: utf-8 import logging def __gen_logger(): result = logging.getLogger('superslick') return result logger = __gen_logger()
normal
{ "blob_id": "cee9deeeabfec46ee5c132704e8fd653e55987f3", "index": 3430, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef __gen_logger():\n result = logging.getLogger('superslick')\n return result\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef __gen_logger():\n result = logging.get...
[ 0, 1, 2, 3, 4 ]
""" stanCode Breakout Project Adapted from Eric Roberts's Breakout by Sonja Johnson-Yu, Kylie Jue, Nick Bowman, and Jerry Liao YOUR DESCRIPTION HERE """ from campy.gui.events.timer import pause from breakoutgraphics import BreakoutGraphics FRAME_RATE = 1000 / 120 # 120 frames per second. NUM_LIVES = 3 def main(): ...
normal
{ "blob_id": "b218f5e401510f844006cb6079737b54aa86827b", "index": 2194, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n graphics = BreakoutGraphics()\n lives = NUM_LIVES\n graphics.window.add(graphics.scoreboard, 0, graphics.window_height)\n while True:\n pause(FRAME_RA...
[ 0, 2, 3, 4, 5 ]
from ..core.helpers import itemize from ..core.files import backendRep, expandDir, prefixSlash, normpath from .helpers import splitModRef from .repo import checkoutRepo from .links import provenanceLink # GET DATA FOR MAIN SOURCE AND ALL MODULES class AppData: def __init__( self, app, backend, moduleRef...
normal
{ "blob_id": "7be54b2bd99680beed3e8e9cb14225756a71a4ea", "index": 1135, "step-1": "<mask token>\n\n\nclass AppData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass AppData:\n\n def __init__(se...
[ 1, 5, 8, 9, 10 ]
import matplotlib.pyplot as plt import numpy as np import scipy.io as scio import estimateGaussian as eg import multivariateGaussian as mvg import visualizeFit as vf import selectThreshold as st plt.ion() # np.set_printoptions(formatter={'float': '{: 0.6f}'.format}) '''第1部分 加载示例数据集''' #先通过一个小数据集进行异常检测 便于可视化 # 数据集...
normal
{ "blob_id": "de6b9961e0572338c87802314e7ae3cded5168b4", "index": 487, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.ion()\n<mask token>\nprint('Visualizing example dataset for outlier detection.')\n<mask token>\nplt.figure()\nplt.scatter(X[:, 0], X[:, 1], c='b', marker='x', s=15, linewidth=1)\nplt.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.config.from_pyfile('config.py', silent=True) <|reserved_special_token_0|> app.register_blueprint(static_blueprint) app.register_blueprint(admin_blueprint) app.register_blueprint(cart_blueprint) app.register_blueprint(product_b...
flexible
{ "blob_id": "5d97a2afed26ec4826c8bce30c84863d21f86001", "index": 9370, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_pyfile('config.py', silent=True)\n<mask token>\napp.register_blueprint(static_blueprint)\napp.register_blueprint(admin_blueprint)\napp.register_blueprint(cart_blueprint)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: i = float(input('Enter the score : ')) if i > 1 or i < 0: print("Entered score isn't valid.") elif i < 0.6: print('Grade: F') elif i < 0.7: print('Grade: D') elif i < 0.8: print('Grade: C') elif i <...
flexible
{ "blob_id": "6f253da5dc1caa504a3a8aadae7bce6537b5c8c6", "index": 6237, "step-1": "<mask token>\n", "step-2": "try:\n i = float(input('Enter the score : '))\n if i > 1 or i < 0:\n print(\"Entered score isn't valid.\")\n elif i < 0.6:\n print('Grade: F')\n elif i < 0.7:\n print('...
[ 0, 1, 2 ]
import tty import sys import termios def init(): orig_settings = termios.tcgetattr(sys.stdin) tty.setcbreak(sys.stdin) return orig_settings def get_input(): return sys.stdin.read(1) def exit(orig_settings): termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings) if __name__ == "__main...
normal
{ "blob_id": "c64e41609a19a20f59446399a2e864ff8834c3f0", "index": 4322, "step-1": "<mask token>\n\n\ndef get_input():\n return sys.stdin.read(1)\n\n\ndef exit(orig_settings):\n termios.tcsetattr(sys.stdin, termios.TCSADRAIN, orig_settings)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef init():\n ...
[ 2, 3, 4, 5, 6 ]
""" purpose :Take an string as input and construct an algorithm to input a string of characters and check whether it is a palindrome. @Author : Reshma Y. Kale """ from com.bridgelabz.utility.Data_structure_utility import * if __name__=="__main__": dq = Deque() dq.palindrom()
normal
{ "blob_id": "d4d47f7abc5c8224188430546a65bfb8f358802f", "index": 1472, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n dq = Deque()\n dq.palindrom()\n", "step-3": "<mask token>\nfrom com.bridgelabz.utility.Data_structure_utility import *\nif __name__ == '__main__':\n ...
[ 0, 1, 2, 3 ]
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from prettytable import PrettyTable from time import sleep from customization import * import urllib.request,json chrome_options=webdriver.ChromeOptions() chrome_options.add_argument("--headless") chrome_options.add_argument("--inco...
normal
{ "blob_id": "e1c902ef340a0a5538b41a03cc93686e0dd31672", "index": 8788, "step-1": "<mask token>\n\n\ndef bio_shortener(bio):\n lines = []\n x = len(bio) / 30\n y = 0\n Status = True\n while Status:\n y = y + 1\n lines.append(bio[0:30])\n lines.append('\\n')\n bio = bio[3...
[ 3, 4, 5, 6, 7 ]
from flask import request from flask_restful import abort from sqlalchemy.exc import SQLAlchemyError from gm.main.models.model import db, Metric, QuantModelMetricSchema, \ MlModelMetricSchema, Frequency, QuantModelMetric, MlModelMetric, \ ThresholdType from gm.main.resources import success, get_metric_b...
normal
{ "blob_id": "1431a0049c05a99e0b68052f56bf8e2e3c48e1aa", "index": 622, "step-1": "<mask token>\n\n\nclass QuantModelMetricsResource(MetricsResource):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MlModelMetricsResource(MetricsResource):\n \"\"\"\n This resource handles the HTTP requests c...
[ 16, 19, 23, 25, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> PULPNNInstallPath = cwd = os.getcwd() + '/../' PULPNNSrcDirs = {'script': PULPNNInstallPath + 'scripts/'} PULPNNInstallPath32bit = cwd = os.getcwd() + '/../32bit/' PULPNNInstallPath64bit = cwd = os.getcwd() + '/../64bit/' PULPNNTe...
flexible
{ "blob_id": "d8d0c181fcfc9e0692369cc7a65259c43a68e931", "index": 5688, "step-1": "<mask token>\n", "step-2": "<mask token>\nPULPNNInstallPath = cwd = os.getcwd() + '/../'\nPULPNNSrcDirs = {'script': PULPNNInstallPath + 'scripts/'}\nPULPNNInstallPath32bit = cwd = os.getcwd() + '/../32bit/'\nPULPNNInstallPath64b...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class OfferApi(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def find_eligible_items_with_http_info(self, x_ebay_c_marketplace_id, **kwargs): """find_eligible_items # noqa: E501 This method evalua...
flexible
{ "blob_id": "a93818440410bde004f0203f18112fa1b666959c", "index": 9615, "step-1": "<mask token>\n\n\nclass OfferApi(object):\n <mask token>\n <mask token>\n <mask token>\n\n def find_eligible_items_with_http_info(self, x_ebay_c_marketplace_id,\n **kwargs):\n \"\"\"find_eligible_items # ...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('test_9feats.csv', 'w') as f: df = pd.DataFrame(file, columns=['dst_host_srv_serror_rate', 'dst_host_serror_rate', 'serror_rate', 'srv_serror_rate', 'count', 'flag', 'same_srv_rate', 'dst_host_srv_cou...
flexible
{ "blob_id": "ce28330db66dcdfad63bdac698ce9d285964d288", "index": 5124, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('test_9feats.csv', 'w') as f:\n df = pd.DataFrame(file, columns=['dst_host_srv_serror_rate',\n 'dst_host_serror_rate', 'serror_rate', 'srv_serror_rate', 'count',\n ...
[ 0, 1, 2, 3, 4 ]
import pandas as pd from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score # from sklearn import tree # import joblib music_data = pd.read_csv(r"C:\Users\junha\PythonProjects\predict_music_preferences\music.csv") # print(music_dat...
normal
{ "blob_id": "8dbcd7bba09f8acff860890d8201e016b587796d", "index": 6149, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.fit(X_train, y_train)\n<mask token>\nprint(predictions)\n<mask token>\nprint(score)\n", "step-3": "<mask token>\nmusic_data = pd.read_csv(\n 'C:\\\\Users\\\\junha\\\\PythonProj...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "4e04e748a97c59a26a394b049c15d96476b98517", "index": 9382, "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 = [('trades', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ui_Window(QDialog): def __init__(self): super(Ui_Window, self).__init__() self.ui = Ui_Dialog() self.ui.setupUi(self) regex = QRegExp('\\w+') validator = QRegExpValidator(regex) self.ui.usernameLineEdit.setValidator(validator) ...
flexible
{ "blob_id": "8cabacb64f3b193b957c61d6e1ca21f2046e52d1", "index": 8199, "step-1": "<mask token>\n\n\nclass Ui_Window(QDialog):\n\n def __init__(self):\n super(Ui_Window, self).__init__()\n self.ui = Ui_Dialog()\n self.ui.setupUi(self)\n regex = QRegExp('\\\\w+')\n validator =...
[ 9, 11, 12, 13, 14 ]
import dtw import stats import glob import argparse import matplotlib.pyplot as plt GRAPH = False PERCENTAGE = False VERBOSE = False def buildExpectations(queryPath, searchPatternPath): """ Based on SpeechCommand_v0.02 directory structure. """ expectations = [] currentDirectory = "" queryFile...
normal
{ "blob_id": "03fb1cf0aac0c37858dd8163562a7139ed4e1179", "index": 776, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef buildExpectations(queryPath, searchPatternPath):\n \"\"\"\n Based on SpeechCommand_v0.02 directory structure.\n \"\"\"\n expectations = []\n currentDirectory = ''\n ...
[ 0, 2, 3, 4, 5 ]
''' 文件读写的步骤 1.打开文件 2.处理数据 3.关闭文件 1.open函数: fileobj = open(filename, mode) fileobj是open()函数返回的文件对象 mode第一个字母指明文件类型和操作的字符串,第二个字母是文件类型: t(可省略)文本类型,b二进制类型。 文件打开模式:r只读(默认),w覆盖写(不存在则新创建) a追加模式(不存在则创建) 2.read(size):从文件读取长度为size的字符串,若未给定或为负则读取所有内容 3.readline():读取整行返回字符串 4.readline...
normal
{ "blob_id": "25f3c9f48b779d2aec260d529529156ff3c508ca", "index": 7719, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in fileobj3.readlines():\n print(line)\nfileobj3.close()\n", "step-3": "<mask token>\nfileobj3 = open('lines.txt', 'r')\nfor line in fileobj3.readlines():\n print(line)\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class AFB_L1(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> class AFB_L2(nn.Module): def __init__(self, channels, n_l1=4, act=nn.ReLU(True)): super(AFB_L2, self).__init__() self.n = n_l1 self.convs_ = nn.ModuleList() fo...
flexible
{ "blob_id": "b2c0ef4a0af12b267a54a7ae3fed9edeab2fb879", "index": 6570, "step-1": "<mask token>\n\n\nclass AFB_L1(nn.Module):\n <mask token>\n <mask token>\n\n\nclass AFB_L2(nn.Module):\n\n def __init__(self, channels, n_l1=4, act=nn.ReLU(True)):\n super(AFB_L2, self).__init__()\n self.n = ...
[ 10, 14, 17, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Order(models.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|> <...
flexible
{ "blob_id": "78ddae64cc576ebaf7f2cfaa4553bddbabe474b7", "index": 6918, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Order(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Order(m...
[ 0, 1, 2, 3, 4 ]
'''Given a range of 2 numbers (i.e) L and R count the number of prime numbers in the range (inclusive of L and R ). Input Size : L <= R <= 100000(complexity O(n) read about Sieve of Eratosthenes) Sample Testcase : INPUT 2 5 OUTPUT 3''' x,y=map(int,input().split()) count=0 for i in range(x,y+1): if i>1: for...
normal
{ "blob_id": "06848ec0e327fed1da00446cec6392c6f42130af", "index": 2158, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(x, y + 1):\n if i > 1:\n for j in range(2, i):\n if i % j == 0:\n break\n else:\n count += 1\nprint(count)\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(word[0]) <|reserved_special_token_0|> print('こんにちわ、私の名前は {} です。'.format(name)) <|reserved_special_token_0|> print('{}/{}/{}'.format(year, month, day)) for i in range(0, 5): print('kamyu'[i]) print('aldous Huxley was born...
flexible
{ "blob_id": "0e05eed2d6bc723fd8379e436621a6eba4aa5ab2", "index": 1929, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(word[0])\n<mask token>\nprint('こんにちわ、私の名前は {} です。'.format(name))\n<mask token>\nprint('{}/{}/{}'.format(year, month, day))\nfor i in range(0, 5):\n print('kamyu'[i])\nprint('aldo...
[ 0, 1, 2, 3 ]
a= input("Enter number") a= a.split() b=[] for x in a: b.append(int(x)) print(b) l=len(b) c=0 s=0 for i in range(l): s=len(b[:i]) for j in range(s): if b[s]<b[j]: c=b[s] b.pop(s) b.insert(b.index(b[j]),c) print(b,b[:i],b[s])
normal
{ "blob_id": "24de4f486d4e976850e94a003f8d9cbe3e518402", "index": 33, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in a:\n b.append(int(x))\nprint(b)\n<mask token>\nfor i in range(l):\n s = len(b[:i])\n for j in range(s):\n if b[s] < b[j]:\n c = b[s]\n b.pop(s...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt class Scatter: def __init__(self, values, ylabel, title): self.values = values self.range = list(range(len(values))) self.ylabel = ylabel self.title = title def plot(self): fig = plt.figure() ax = fig.add_axes([0, 0, ...
normal
{ "blob_id": "58385a7713a8f88925ced714d25f1522bc7e39d8", "index": 1181, "step-1": "<mask token>\n\n\nclass Scatter:\n <mask token>\n <mask token>\n\n\nclass Pie:\n\n def __init__(self, values, labels, title):\n self.style = 'fivethirtyeight'\n self.values = values\n self.labels = lab...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Getter(object): <|reserved_special_token_0|> def __call__(self, url, **kwargs): try: return self._inner_call(url, **kwargs) except (Timeout, ConnectionError, RequestException) as ex: message = ex.response.reason if getattr(ex, 'respon...
flexible
{ "blob_id": "603708c830dadb6f1a3e5de00536d558f448b5fb", "index": 1352, "step-1": "<mask token>\n\n\nclass Getter(object):\n <mask token>\n\n def __call__(self, url, **kwargs):\n try:\n return self._inner_call(url, **kwargs)\n except (Timeout, ConnectionError, RequestException) as e...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __author__ = 'simsun'
flexible
{ "blob_id": "2b746d89d34435eb5f3a5b04da61c5cc88178852", "index": 8784, "step-1": "<mask token>\n", "step-2": "__author__ = 'simsun'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
class UrlPath: @staticmethod def combine(*args): result = '' for path in args: result += path if path.endswith('/') else '{}/'.format(path) #result = result[:-1] return result
normal
{ "blob_id": "aa579025cacd11486a101b2dc51b5ba4997bf84a", "index": 95, "step-1": "<mask token>\n", "step-2": "class UrlPath:\n <mask token>\n", "step-3": "class UrlPath:\n\n @staticmethod\n def combine(*args):\n result = ''\n for path in args:\n result += path if path.endswith...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urllib3.disable_warnings() <|reserved_special_token_0|> print(key.decode('ascii')) <|reserved_special_token_1|> <|reserved_special_token_0|> urllib3.disable_warnings() response = requests.get('https://freeaeskey.xyz', verify=Fa...
flexible
{ "blob_id": "368e209f83cc0cade81791c8357e01e7e3f940c8", "index": 97, "step-1": "<mask token>\n", "step-2": "<mask token>\nurllib3.disable_warnings()\n<mask token>\nprint(key.decode('ascii'))\n", "step-3": "<mask token>\nurllib3.disable_warnings()\nresponse = requests.get('https://freeaeskey.xyz', verify=Fals...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render from django.shortcuts import redirect from block.models import Block from .models import Article from .forms import ArticleForm from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required def article_list(request, block_id): block_id = ...
normal
{ "blob_id": "0f94537fa64066bb29c5e9e97836b0a8ac01ac19", "index": 9844, "step-1": "<mask token>\n\n\n@login_required\ndef article_create(request, block_id):\n block_id = int(block_id)\n block = Block.objects.get(id=block_id)\n if request.method == 'GET':\n return render(request, 'article_create.ht...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Song(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __unicode__(self): return self.name <|reserved_special_token_1|> <|reserved_special...
flexible
{ "blob_id": "8ec18e259af1123fad7563aee3a363e095e30e8e", "index": 1064, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Song(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def __unicode__(self):\n return self.name\n", "step-3": "<mask token>\n\n\nclass Song(m...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/python import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) ledPin = 4 pinOn = False GPIO.setup(ledPin, GPIO.OUT) GPIO.output(ledPin, GPIO.LOW) def print_pin_status(pin_number): GPIO.setup(pin_number, GPIO.IN) value = GPIO.input(pin_number) print(f'Current Value of {pin_number} is {value}') G...
normal
{ "blob_id": "492c416becc44deaafef519eae8c9a82ac00cc0e", "index": 8632, "step-1": "<mask token>\n\n\ndef print_pin_status(pin_number):\n GPIO.setup(pin_number, GPIO.IN)\n value = GPIO.input(pin_number)\n print(f'Current Value of {pin_number} is {value}')\n GPIO.setup(pin_number, GPIO.OUT)\n\n\n<mask t...
[ 1, 2, 3, 4, 5 ]
from pyathena import connect from Config import config2 from Config import merchants def get_mapped_sku(sku): try: cursor = connect(aws_access_key_id=config2["aws_access_key_id"], aws_secret_access_key=config2["aws_secret_access_key"], s3_staging_dir=confi...
normal
{ "blob_id": "6add599035573842475c7f9155c5dbbea6c96a8a", "index": 3618, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_mapped_sku(sku):\n try:\n cursor = connect(aws_access_key_id=config2['aws_access_key_id'],\n aws_secret_access_key=config2['aws_secret_access_key'],\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class View(Renderable, ABC): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class View(Renderable, ABC): @abstractmethod def content_size(self, container_size: Size) ->Si...
flexible
{ "blob_id": "913ff9b811d3abbe43bda0554e40a6a2c87053be", "index": 4449, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass View(Renderable, ABC):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass View(Renderable, ABC):\n\n @abstractmethod\n def content_size(self, container_size: Size)...
[ 0, 1, 2, 3 ]
from django import forms from django.contrib.auth.models import User from .models import TblPublish , TblSnippetTopics, TblSnippetData, TblLearnTopics, TblLearnData, TblBlog, TblBlogComments,TblLearnDataComments, TblBlogGvp, TblLearnDataGvp,TblSnippetDataGvp, TblHome, TblAbout, TblQueries from django.contrib.auth.forms...
normal
{ "blob_id": "9e02b1a90d61de6d794dd350b50417a2f7260df6", "index": 5947, "step-1": "<mask token>\n\n\nclass TblBlogForm(forms.ModelForm):\n\n\n class Meta:\n model = TblBlog\n fields = ['blog_title', 'blog_description', 'blog_keyword',\n 'blog_content', 'blog_pics', 'blog_publish', 'blo...
[ 19, 20, 22, 26, 32 ]
from pathlib import Path from build_midi.appenders import * from build_midi.converters import Converter from build_midi.melody_builder import MelodyBuilder from build_midi.sequences import * from build_midi.tracks import * from music_rules.instruments import Instruments from music_rules.music_scale import MusicScale f...
normal
{ "blob_id": "c846c33ef13795d51c6d23ffa5a6b564b66e6a3c", "index": 3438, "step-1": "<mask token>\n\n\nclass WeatherToMusicConverter:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass WeatherToMusicConverter:\n <ma...
[ 1, 4, 5, 6, 7 ]
import xadmin from xadmin import views from .models import EmailVerifyRecord, Banner class BaseMyAdminView(object): ''' enable_themes 启动更改主题 use_bootswatch 启用网上主题 ''' enable_themes = True use_bootswatch = True class GlobalSettings(object): ''' site_title 左上角名称 site_footer 底部名称 ...
normal
{ "blob_id": "d7b830890400203ee45c9ec59611c0b20ab6bfc7", "index": 8496, "step-1": "<mask token>\n\n\nclass BaseMyAdminView(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass GlobalSettings(object):\n \"\"\"\n site_title 左上角名称\n site_footer 底部名称\n menu_style 更改左边样式\n \"\"\"\n ...
[ 8, 10, 11, 12, 13 ]
# Generated by Django 3.2.6 on 2021-08-19 16:17 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('crm', '0040_auto_20210819_1913'), ] operations = [ migrations.RemoveField( model_name='customer', name='full_name', ...
normal
{ "blob_id": "42f021c728a88f34d09f94ea96d91abded8a29fb", "index": 9553, "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 = [('crm', '0040...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class WorkRequestForm(forms.ModelForm): <|reserved_special_token_0|> class Meta: model = HhRequest fields = 'profile', 'sphere', 'experience', 'work_request', 'resume' widgets = {'profile': form...
flexible
{ "blob_id": "3887516e4222504defe439e62bd24b12db3cdd84", "index": 695, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass WorkRequestForm(forms.ModelForm):\n <mask token>\n\n\n class Meta:\n model = HhRequest\n fields = 'profile', 'sphere', 'experience', 'work_request', 'resume'\...
[ 0, 1, 2, 3, 4 ]
#!env/bin/python3 from app import app from config import config as cfg app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)
normal
{ "blob_id": "f97150f60dfb3924cda2c969141d5bfe675725ef", "index": 9150, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)\n", "step-3": "from app import app\nfrom config import config as cfg\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)...
[ 0, 1, 2, 3 ]
<<<<<<< HEAD """Module docstring""" import os import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score ======= #!/usr/bin/python """Module docstring"""...
normal
{ "blob_id": "2bce18354a53c49274f7dd017e1f65c9ff1327b9", "index": 2264, "step-1": "<<<<<<< HEAD\n\"\"\"Module docstring\"\"\"\nimport os\nimport numpy as np\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\nfrom sklearn.model_selection import cross_val_score\nfrom sklearn.model_selection impo...
[ 0 ]
<|reserved_special_token_0|> class IBehaviourBase(Client): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class IBehaviourBase(Client): <|reserved_special_token_0|> def __init__(self, email, pas...
flexible
{ "blob_id": "e67f27eec53901f27ba5a7ee7e2a20bbb1e8f7f9", "index": 2237, "step-1": "<mask token>\n\n\nclass IBehaviourBase(Client):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IBehaviourBase(Client):\n <mask token>\n\n def __init__(self, email, password, kwa...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def tokenize_de(text): return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))] def tokenize_en(text): return [tok.text for tok in spacy_en.tokenizer(url.sub('@URL@', text))] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0...
flexible
{ "blob_id": "4e715ccb4f95e7fe7e495a1181ad5df530f5a53f", "index": 5773, "step-1": "<mask token>\n\n\ndef tokenize_de(text):\n return [tok.text for tok in spacy_de.tokenizer(url.sub('@URL@', text))]\n\n\ndef tokenize_en(text):\n return [tok.text for tok in spacy_en.tokenizer(url.sub('@URL@', text))]\n\n\n<ma...
[ 2, 3, 4, 5 ]
# settings import config # various modules import sys import time import multiprocessing import threading from queue import Queue import time import os import signal import db import time from random import randint # telepot's msg loop & Bot from telepot.loop import MessageLoop from telepot import Bot import asyncio...
normal
{ "blob_id": "315fed1806999fed7cf1366ef0772318a0baa84d", "index": 8789, "step-1": "# settings\nimport config\n\n# various modules\nimport sys\nimport time\nimport multiprocessing\nimport threading\nfrom queue import Queue\nimport time\nimport os\nimport signal\nimport db\nimport time\nfrom random import randint\n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_instance(rest_url, params): url = BASEURL + rest_url print(url) twitter = OAuth1Session(CK, CS, AT, AS) return twitter.get(url, params=params) <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "63bfaa6e191e6090060877e737f4b003bed559cf", "index": 9140, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_instance(rest_url, params):\n url = BASEURL + rest_url\n print(url)\n twitter = OAuth1Session(CK, CS, AT, AS)\n return twitter.get(url, params=params)\n", "step-...
[ 0, 1, 2, 3, 4 ]
K = input() mat = "".join(raw_input() for i in xrange(4)) print ("YES", "NO")[max(mat.count(str(i)) for i in xrange(1, 10)) > K*2]
normal
{ "blob_id": "879f7503f7f427f92109024b4646d1dc7f15d63d", "index": 2153, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('YES', 'NO')[max(mat.count(str(i)) for i in xrange(1, 10)) > K * 2]\n", "step-3": "K = input()\nmat = ''.join(raw_input() for i in xrange(4))\nprint('YES', 'NO')[max(mat.count(str...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NameSearch(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NameSearch(forms.Form): name = forms.CharField(label='Search By Name') <|reserved_special_...
flexible
{ "blob_id": "7620ff333422d0354cc41c2a66444c3e8a0c011f", "index": 1606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NameSearch(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NameSearch(forms.Form):\n name = forms.CharField(label='Search By Name')\n", "step-4": "f...
[ 0, 1, 2, 3 ]
import csv import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit #funktion def func(w,rc): return 1/(np.sqrt(1+w**2*rc**2)) #daten einlesen with open('data/phase.csv' ) as csvfile: reader=csv.reader(csvfile, delimiter=',') header_row=next(reader) f, U, a,...
normal
{ "blob_id": "170d0560c40f3f642f319f6113b68ab8a6bea9ef", "index": 468, "step-1": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\nwith open('data/phase.csv') as...
[ 1, 2, 3, 4, 5 ]