code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#! /home/joreyna/anaconda2/envs/hla/bin/python import argparse import os import sys import time import numpy as np import copy import subprocess import math project_dir = os.path.join(sys.argv[0], '../../') project_dir = os.path.abspath(project_dir) output_dir = os.path.join(project_dir, 'output/', 'pipeline/', 'sa...
normal
{ "blob_id": "d3f80deb72ca2bd91fc09b49ad644f54d339f962", "index": 5819, "step-1": "<mask token>\n\n\ndef generate_mutation(base):\n \"\"\"\n\tTaking into account the current base, base, return a mutation.\n\t\n\t\"\"\"\n if base in ['A', 'C', 'G', 'T']:\n bases = ['A', 'C', 'G', 'T']\n bases.r...
[ 5, 6, 7, 9, 10 ]
""" You have a number and you need to determine which digit in this number is the biggest. Input: A positive int. Output: An Int (0-9). Example: max_digit(0) == 0 max_digit(52) == 5 max_digit(634) == 6 max_digit(10000) == 1 """ def max_digit(number: int) -> int: return max(int(i) for i in str(number)) print(m...
normal
{ "blob_id": "b25e9374458ead85535495e77a5c64117a8b1808", "index": 5761, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef max_digit(number: int) ->int:\n return max(int(i) for i in str(number))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef max_digit(number: int) ->int:\n return max(i...
[ 0, 1, 2, 3 ]
import requests import json import base64 import re def main(targetsrting): email="" #email key="" #key #targetsrting='ip="202.107.117.5/24"' #搜索关键字 target=base64.b64encode(targetsrting.encode('utf-8')).decode("utf-8") url="https://fofa.so/api/v1/search/all?email={}&key={}&qbase64={}&fields=hos...
normal
{ "blob_id": "5f13866bd5c6d20e8ddc112fb1d1335e3fd46c3e", "index": 1817, "step-1": "<mask token>\n\n\ndef main(targetsrting):\n email = ''\n key = ''\n target = base64.b64encode(targetsrting.encode('utf-8')).decode('utf-8')\n url = (\n 'https://fofa.so/api/v1/search/all?email={}&key={}&qbase64={...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def prime_generator(n): pp = [2, 3] for i in range(3, n): i += 2 count = 0 for ps in pp: if ps > sqrt(i) + 1: break if i % ps == 0: count +=...
flexible
{ "blob_id": "cfa064611a4aa16638bd649c68d64872b9fac1ff", "index": 4647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef prime_generator(n):\n pp = [2, 3]\n for i in range(3, n):\n i += 2\n count = 0\n for ps in pp:\n if ps > sqrt(i) + 1:\n break\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(random.choice(['python', 'c++', 'java'])) print(random.choice((1.1, -5, 6, 4, 7))) <|reserved_special_token_1|> import random print(random.choice(['python', 'c++', 'java'])) print(random.choice((1.1, -5, 6, 4, 7)))
flexible
{ "blob_id": "44f18d7e7713073c27fec38f0b847803eceefbc9", "index": 2687, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(random.choice(['python', 'c++', 'java']))\nprint(random.choice((1.1, -5, 6, 4, 7)))\n", "step-3": "import random\nprint(random.choice(['python', 'c++', 'java']))\nprint(random.cho...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dir_path) for root, directories, filenames in os.walk(str(dir_path)): for file in filenames: path = os.path.join(root, file) if path.find('/.') == -1 and path.find('__pycache__') == -1: files_...
flexible
{ "blob_id": "430dccf1001af43c2a713b08dc05d8f04818aa1f", "index": 5597, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dir_path)\nfor root, directories, filenames in os.walk(str(dir_path)):\n for file in filenames:\n path = os.path.join(root, file)\n if path.find('/.') == -1 and pat...
[ 0, 1, 2, 3, 4 ]
import random x = int(raw_input('Please supply a number: ')) y = int(raw_input('Please supply a second number: ')) z = random.randint(x, y) print(z)
normal
{ "blob_id": "104c49941a79948749b27217a0c728f19435f77a", "index": 643, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(z)\n", "step-3": "<mask token>\nx = int(raw_input('Please supply a number: '))\ny = int(raw_input('Please supply a second number: '))\nz = random.randint(x, y)\nprint(z)\n", "ste...
[ 0, 1, 2, 3 ]
from django.db import models class ProdutoManager(models.Manager): def for_categoria(self, categoria): return self.filter(categoria=categoria)
normal
{ "blob_id": "d698fa1b43387ee0b73687df2764c30e04ee6fd0", "index": 2814, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ProdutoManager(models.Manager):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ProdutoManager(models.Manager):\n\n def for_categoria(self, categoria):\n re...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def positive_volume(f): return f['relative_volume'] * f['positive_percent'] <|reserved_special_token_0|> def normalized_sentiment(f): return (f['average_sentiment'] + 1) / 2 def normalized_square_sentiment(f): return (f['avg_square_sentiment'] + 1) / 2 def weighted_sen...
flexible
{ "blob_id": "d508cb0a8d4291f1c8e76d9d720be352c05ef146", "index": 8651, "step-1": "<mask token>\n\n\ndef positive_volume(f):\n return f['relative_volume'] * f['positive_percent']\n\n\n<mask token>\n\n\ndef normalized_sentiment(f):\n return (f['average_sentiment'] + 1) / 2\n\n\ndef normalized_square_sentimen...
[ 6, 7, 10, 12, 13 ]
import torch import torch.nn as nn import torch.nn.functional as F # Const. low-rank version class xCNNlow(torch.nn.Module): def __init__(self, channels, filters, kernel_size, padding=0, stride=1, groups=1, rank=1, bias=True): super(xCNNlow, self).__init__() self.filters = filters self.time...
normal
{ "blob_id": "f714c7006f50379cc7508a13d710d902d38d2d1f", "index": 425, "step-1": "<mask token>\n\n\nclass xCNNlow(torch.nn.Module):\n\n def __init__(self, channels, filters, kernel_size, padding=0, stride=1,\n groups=1, rank=1, bias=True):\n super(xCNNlow, self).__init__()\n self.filters =...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = get_secret_key DEBUG = True ALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]'] INSTALLED_APPS = ['corsheaders', 'django.contrib.sessions'] MIDDL...
flexible
{ "blob_id": "027a049ffced721f2cd697bc928bfdf718630623", "index": 4692, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nSECRET_KEY = get_secret_key\nDEBUG = True\nALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]']\nINSTALLED_APPS = [...
[ 0, 1, 2, 3 ]
""" Contains derivative computation for BSSN formulation of ET equations. """ # first derivative import cog D = ["alpha", "beta0", "beta1", "beta2", "B0", "B1", "B2", "chi", "Gt0", "Gt1", "Gt2", "K", "gt0", "gt1", "gt2", "gt3", "gt4", "gt5", "At0", "At1", "At2", "At3", "At4", "At5" ] # cust...
normal
{ "blob_id": "20a238826640099e6c69aaa383c5fa7e9b02b13b", "index": 5614, "step-1": "<mask token>\n\n\ndef allocDerivMemory():\n for deriv in FUNC_D_I:\n cog.outl('\\t double* ' + deriv +\n ' = (double*)malloc(sizeof(double)*n);')\n for deriv in FUNC_D_IJ:\n cog.outl('\\t double* ' + ...
[ 3, 4, 5, 6, 7 ]
from custom_layers import custom_word_embedding from custom_layers import Attention from utils import load_emb_weights import torch from torch import nn class classifier(nn.Module): #define all the layers used in model def __init__(self, embedding_dim, hidden_dim, output_dim, n_layers, embed_weights, ...
normal
{ "blob_id": "4692b2d19f64b3b4bd10c5eadd22a4b5a2f2ef37", "index": 3923, "step-1": "<mask token>\n\n\nclass classifier(nn.Module):\n <mask token>\n <mask token>\n\n\nclass AT_LSTM(nn.Module):\n\n def __init__(self, embedding_dim, aspect_embedding_dim, hidden_dim,\n output_dim, n_layers, embed_weigh...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def author(): return '' def student_id(): return '' <|reserved_special_token_0|> def find_words(pattern, words, scoring_f, minlen, maxlen): patternCopy = pattern bestWord = '', 0 bestState = [('', 0), [], []] toConsider = '' possibleWords = [] length ...
flexible
{ "blob_id": "9bd659bb3bf812e48710f625bb65a848d3a8d074", "index": 594, "step-1": "<mask token>\n\n\ndef author():\n return ''\n\n\ndef student_id():\n return ''\n\n\n<mask token>\n\n\ndef find_words(pattern, words, scoring_f, minlen, maxlen):\n patternCopy = pattern\n bestWord = '', 0\n bestState =...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def f(x: float, y: np.ndarray) ->np.ndarray: """ Работает с вектором { y , y'} """ return np.array([y[1], np.sqrt(abs(-np.exp(y[1]) * y[0] + 2.71 * y[0] ** 2 / np.log(x) + 1 / x ** 2))]) def dormand_prince(x_0, Y_0, h, N): """ https://en.wikipedia.org/wik...
flexible
{ "blob_id": "daccc5aafb3e250e7fa7ac9db69a147b7e916736", "index": 193, "step-1": "<mask token>\n\n\ndef f(x: float, y: np.ndarray) ->np.ndarray:\n \"\"\"\n Работает с вектором { y , y'}\n \"\"\"\n return np.array([y[1], np.sqrt(abs(-np.exp(y[1]) * y[0] + 2.71 * y[0] **\n 2 / np.log(x) + 1 / x *...
[ 2, 3, 4, 5, 6 ]
import knn datingDataMat,datingLabels = knn.file2matrix('datingTestSet2.txt') normMat,ranges,minVals = knn.autoNorm(datingDataMat) print normMat print ranges print minVals
normal
{ "blob_id": "f28222625e28939b34b1b5c21d28dbf9c49c6374", "index": 8635, "step-1": "import knn\n\ndatingDataMat,datingLabels = knn.file2matrix('datingTestSet2.txt')\nnormMat,ranges,minVals = knn.autoNorm(datingDataMat)\n\nprint normMat\nprint ranges\nprint minVals", "step-2": null, "step-3": null, "step-4": ...
[ 0 ]
<|reserved_special_token_0|> def get_product(symbol): """ 从合约名中提取产品名 :param symbol: :return: """ pattern = re.compile('(\\D{1,2})(\\d{0,1})(\\d{3})') match = pattern.match(symbol) if match: return match.expand('\\g<1>') else: return symbol def get_exchange(symbol)...
flexible
{ "blob_id": "8bb39149a5b7f4f4b1d3d62a002ab97421905ea1", "index": 551, "step-1": "<mask token>\n\n\ndef get_product(symbol):\n \"\"\"\n 从合约名中提取产品名\n :param symbol:\n :return:\n \"\"\"\n pattern = re.compile('(\\\\D{1,2})(\\\\d{0,1})(\\\\d{3})')\n match = pattern.match(symbol)\n if match:\n...
[ 2, 5, 6, 7, 8 ]
from OTXv2 import OTXv2 from pandas.io.json import json_normalize from datetime import datetime, timedelta import getopt import sys from sendemail import sendemail from main import otx import csv import pandas as pd from pandas import read_csv import os.path def tools(): search = str(input('Please enter search: '...
normal
{ "blob_id": "659f45d2c6c7138f26b4a8d15d1710ae60450b08", "index": 6278, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef tools():\n search = str(input('Please enter search: '))\n search.strip()\n pulsesJSON = otx.search_pulses(search, 40)\n for aPulse in pulsesJSON['results']:\n n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class _ESSAYED(_ESSAY): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class _ESSAYED(_ESSAY): def __init__(self): _ESSAY.__init__(self) self.name = 'ESSAYED'...
flexible
{ "blob_id": "dc2cbbaca3c35f76ac09c93a2e8ad13eb0bdfce6", "index": 4086, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass _ESSAYED(_ESSAY):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass _ESSAYED(_ESSAY):\n\n def __init__(self):\n _ESSAY.__init__(self)\n self.name = 'ES...
[ 0, 1, 2, 3, 4 ]
# -*- encoding: utf-8 -*- # @Version : 1.0 # @Time : 2018/8/29 9:59 # @Author : wanghuodong # @note : 生成一个简单窗口 import sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == '__main__': '''所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行''' app = QApplic...
normal
{ "blob_id": "6ff300bbd7866466d1992445e46c5ee54f73d0d7", "index": 9167, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n \"\"\"所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行\"\"\"\n app = QApplication(sys.argv)\n \"\"\"Qwidget组件是PyQt5中所有用户...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TamLicense(models.Model): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TamLicense(models.Model): license = models.TextField('Inserisci qui il tuo codice licenza....
flexible
{ "blob_id": "1daecce86769e36a17fe2935f89b9266a0197cf0", "index": 3942, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TamLicense(models.Model):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TamLicense(models.Model):\n license = models.TextField('Inserisci qui il tuo codice licen...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> a.index(333) print(a) <|reserved_special_token_1|> a = [66.25, 333, 333, 1, 1234.5] a.index(333) print(a)
flexible
{ "blob_id": "7aba77137b96071101078c38c1c9397bf837d92a", "index": 1378, "step-1": "<mask token>\n", "step-2": "<mask token>\na.index(333)\nprint(a)\n", "step-3": "a = [66.25, 333, 333, 1, 1234.5]\na.index(333)\nprint(a)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': logging.basicConfig(filename='logfile.log', filemode='a', format= '%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO) logging.info('Start of the mortality analysis algorithm'...
flexible
{ "blob_id": "f44a8837056eb77fbf0ff37b9c57891cc3a3d6b2", "index": 6783, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n logging.basicConfig(filename='logfile.log', filemode='a', format=\n '%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)\n logging.in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_git_revision_hash() ->str: """ Retrieve the git hash for the underlying git repository or die trying We need a way to retrieve git revision hash for sentry reports I assume that if we have a git reposito...
flexible
{ "blob_id": "5ed34ada35dfb2f783af4485bf9d31aa42712b9a", "index": 4480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_git_revision_hash() ->str:\n \"\"\"\n Retrieve the git hash for the underlying git repository or die trying\n\n We need a way to retrieve git revision hash for sentry...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.pcolor(df) plt.colorbar() plt.yticks(np.arange(0.5, len(df.index), 1), df.index) plt.xticks(np.arange(0.5, len(df.columns), 1), df.columns) plt.show() <|reserved_special_token_1|> <|reserved_special_token_0|> month = ['Jun'...
flexible
{ "blob_id": "f5c277da2b22debe26327464ae736892360059b4", "index": 781, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.pcolor(df)\nplt.colorbar()\nplt.yticks(np.arange(0.5, len(df.index), 1), df.index)\nplt.xticks(np.arange(0.5, len(df.columns), 1), df.columns)\nplt.show()\n", "step-3": "<mask token>...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .fieldmatrix import *
flexible
{ "blob_id": "fc4fafe4e29a7f116c38be265fce8e4fb6638330", "index": 6848, "step-1": "<mask token>\n", "step-2": "from .fieldmatrix import *\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|> def raiz(numero): casas_decimais = 18 if numero == 0 or numero == 1: return 'O resultado eh: ' + str(numero) elif numero < 0: return 'A raiz nao existe no conjunto real' else: posicao = 0 ...
flexible
{ "blob_id": "5c174dd514d0a7d9aa932fcb436f22d9a44d2327", "index": 1486, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef raiz(numero):\n casas_decimais = 18\n if numero == 0 or numero == 1:\n return 'O resultado eh: ' + str(numero)\n elif numero < 0:\n return 'A raiz nao exist...
[ 0, 1, 2 ]
from source import tools, setup if __name__ == '__main__': game = tools.Game(setup.STATE_DICT, 'menu') game.run()
normal
{ "blob_id": "a7deec1693c411988445528dceb602bf69e47d21", "index": 2532, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n game = tools.Game(setup.STATE_DICT, 'menu')\n game.run()\n", "step-3": "from source import tools, setup\nif __name__ == '__main__':\n game = tools....
[ 0, 1, 2 ]
import urllib.request, urllib.parse, urllib.error import json import ssl # Retrieve json data into Python dictionary url = "http://py4e-data.dr-chuck.net/comments_147422.json" handle = urllib.request.urlopen(url) data = handle.read().decode() data = json.loads(data) # Calculate total sum of counts sum = 0 for item in...
normal
{ "blob_id": "01b9706966007c44aa19d8249fbcaee5b511786a", "index": 1111, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor item in data['comments']:\n sum = sum + int(item['count'])\nprint(sum)\n", "step-3": "<mask token>\nurl = 'http://py4e-data.dr-chuck.net/comments_147422.json'\nhandle = urllib.re...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def compile_code(): if os.path.isdir(mp6pth): shutil.rmtree(mp6pth) url = 'https://water.usgs.gov/ogw/modpath/Modpath_7_1_000.zip' pymake.download_and_unzip(url, pth=dstpth) pth = os.path.join(srcpth, 'utl7u1.f') if os.path.isfile(pth): os.remove(pth) ...
flexible
{ "blob_id": "ddaba7a8b53072da36224dd4618696ebf0e9a4e4", "index": 1015, "step-1": "<mask token>\n\n\ndef compile_code():\n if os.path.isdir(mp6pth):\n shutil.rmtree(mp6pth)\n url = 'https://water.usgs.gov/ogw/modpath/Modpath_7_1_000.zip'\n pymake.download_and_unzip(url, pth=dstpth)\n pth = os.p...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq)) <|reserved_special_token_1|> <|reserved_special_token_0|> duration = 0.2 freq = 550 os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq)) <...
flexible
{ "blob_id": "8397dcdcb9ec2f35dac0c26b8878a23f9149512b", "index": 3113, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))\n", "step-3": "<mask token>\nduration = 0.2\nfreq = 550\nos.system('play -nq -t alsa synth {} sine {}'.format(durat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def recursive(index, sum): global count if index == n: if sum == s: count += 1 return recursive(index + 1, sum + value[index]) recursive(index + 1, sum) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "f1aa12ec4ee2482db8abf1121a3443502544e1a2", "index": 2815, "step-1": "<mask token>\n\n\ndef recursive(index, sum):\n global count\n if index == n:\n if sum == s:\n count += 1\n return\n recursive(index + 1, sum + value[index])\n recursive(index + 1, sum)\n\n\n<mas...
[ 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import os import sys, getopt import paho.mqtt.client as mqtt import random import _thread import time import json HOST = '0.0.0.0' PORT = 9090 # gb_freq = 0 CONFIG_PATH = 'config/config.cfg' ITEMS_PATH = 'config/items.cfg' MILISECOND = 0.001 class Item(object): def __init__(self, string): ...
normal
{ "blob_id": "3375bc94d214b0b1c67986d35b0587714dd63bcd", "index": 7723, "step-1": "<mask token>\n\n\nclass Item(object):\n <mask token>\n\n def convert_string_to_item(self, string):\n tokens = str(string).split(',')\n self._platform_type = tokens[0]\n self._sensor_name = tokens[1]\n ...
[ 13, 17, 18, 19, 20 ]
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved. # # 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 appl...
normal
{ "blob_id": "f82ddc34fde76ddfbbe75116526af45b83c1b102", "index": 7895, "step-1": "<mask token>\n\n\nclass KnowValues(unittest.TestCase):\n\n def test_ls_contributing(self):\n \"\"\" To test the list of contributing centers \"\"\"\n sv = nao(gto=mol)\n pb = prod_basis()\n pb.sv = sv...
[ 2, 3, 4, 5, 6 ]
# 데이터베이스 연동(SQLite) # 테이블 생성 및 삽입 # pkg 폴더안에 db 파일이 있어서 해당 파일 import 하기 위해 ... 다른 방법 없을까 ... import os, sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) # db 정보 import 후 DbConn 메소드를 dbConn으로 사용명 변경 from pkg._DB_INFO import DbConn as dbConn from pkg._DB_INFO import sysDate as nowDate #...
normal
{ "blob_id": "b066ab81eccee538eb3f85b49a3e46c00a947428", "index": 6154, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))\n<mask token>\nprint('Cursor Type : ', type(c))\nc.execute(\n 'CREATE TABLE IF NOT EXISTS users(id INTEGER ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Token: operator = False empty = False def __init__(self, token): self.token = token if token == '+': self.operator = True elif token == '-': self.operator = True elif token == '*': self.operator = True ...
flexible
{ "blob_id": "0d6c1e74a274b3e8ad9c63ecaa125f79976db9b4", "index": 1734, "step-1": "<mask token>\n\n\nclass Token:\n operator = False\n empty = False\n\n def __init__(self, token):\n self.token = token\n if token == '+':\n self.operator = True\n elif token == '-':\n ...
[ 10, 11, 13, 15, 16 ]
from .storage import Storage class ConnectionManager: def __init__(self): self.store = Storage() def handle(self,msg): if msg['type'] in {'register', 'heartbeat'}: self.store.reg_hb(**msg['payload']) elif msg['type'] == 'result': self.store.result(msg['payload']...
normal
{ "blob_id": "03b38e6e2d0097d5d361b0794aba83b8e430323d", "index": 4370, "step-1": "<mask token>\n\n\nclass ConnectionManager:\n <mask token>\n\n def handle(self, msg):\n if msg['type'] in {'register', 'heartbeat'}:\n self.store.reg_hb(**msg['payload'])\n elif msg['type'] == 'result'...
[ 3, 4, 7, 8, 10 ]
<|reserved_special_token_0|> class RUB: rates = list() def __init__(self, r): RUB.rates.append(r) def ls(self): print(f'RUB: {RUB.rates}') class INR: rates = list() def __init__(self, r): INR.rates.append(r) def ls(self): print(f'INR: {INR.rates}') class...
flexible
{ "blob_id": "d56aa0f0b7c420e4021736cf8f80923121856d1c", "index": 1286, "step-1": "<mask token>\n\n\nclass RUB:\n rates = list()\n\n def __init__(self, r):\n RUB.rates.append(r)\n\n def ls(self):\n print(f'RUB: {RUB.rates}')\n\n\nclass INR:\n rates = list()\n\n def __init__(self, r):\...
[ 10, 14, 16, 19, 22 ]
import numpy as np import random from math import inf class Particle: """ Represents a particle of the Particle Swarm Optimization algorithm. """ def __init__(self, lower_bound, upper_bound): """ Creates a particle of the Particle Swarm Optimization algorithm. :param lower_bou...
normal
{ "blob_id": "096df1db4d8673ae7886a1b2022148c92f64a23e", "index": 1725, "step-1": "<mask token>\n\n\nclass ParticleSwarmOptimization:\n <mask token>\n\n def __init__(self, hyperparams, lower_bound, upper_bound):\n self.lower_bound = lower_bound\n self.upper_bound = upper_bound\n self.nu...
[ 5, 7, 9, 12, 13 ]
<|reserved_special_token_0|> class Sprite(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class CompositeSprite(Sprite): """ A sprite that is composed of multiples sprites layered on top of each other. The first spr...
flexible
{ "blob_id": "080aa8b99cdded7a947880a1c3399f68b28ae44d", "index": 6318, "step-1": "<mask token>\n\n\nclass Sprite(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass CompositeSprite(Sprite):\n \"\"\" A sprite that is composed of multiples sprites layered on top of each\n...
[ 16, 18, 19, 21, 26 ]
<|reserved_special_token_0|> class UnexpectedFormatError(AttributeError): pass <|reserved_special_token_0|> def get_meals(_mensa, date=None): result = requests.get( f'https://osnabrueck.my-mensa.de/essen.php?v=5121119&hyp=1&lang=de&mensa={_mensa}' ) if result.status_code == 200: ...
flexible
{ "blob_id": "9ce406124d36c2baf09cf0d95fceb2ad63948919", "index": 4801, "step-1": "<mask token>\n\n\nclass UnexpectedFormatError(AttributeError):\n pass\n\n\n<mask token>\n\n\ndef get_meals(_mensa, date=None):\n result = requests.get(\n f'https://osnabrueck.my-mensa.de/essen.php?v=5121119&hyp=1&lang=...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def save_predictions(prediction_maps, output_file, dataset_names): """ Saving probability maps to a given output H5 file. If 'average_channels' is set to True average the probability_maps across the the channel axis (useful in case where each channel predicts semantically ...
flexible
{ "blob_id": "6fba773025268d724283e510a03d0592282adb0a", "index": 1780, "step-1": "<mask token>\n\n\ndef save_predictions(prediction_maps, output_file, dataset_names):\n \"\"\"\n Saving probability maps to a given output H5 file. If 'average_channels'\n is set to True average the probability_maps across ...
[ 2, 6, 7, 8, 9 ]
"""Sophie Tan's special AI.""" from typing import Sequence, Tuple from battleships import Player, ShotResult from random import randint class SophiesAI(Player): """Sophie Tan's Random Shot Magic.""" def ship_locations(self) -> Sequence[Tuple[int, int, int, bool]]: return [(2, 0, 0, True)] def d...
normal
{ "blob_id": "127bf47de554dd397d18c6a70616a2a4d93cae80", "index": 3659, "step-1": "<mask token>\n\n\nclass SophiesAI(Player):\n <mask token>\n\n def ship_locations(self) ->Sequence[Tuple[int, int, int, bool]]:\n return [(2, 0, 0, True)]\n <mask token>\n\n def bomb_feedback(self, x: int, y: int,...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> iris_nan.head() <|reserved_special_token_0|> iris_nan.dropna() iris_nan.dropna(axis=1) <|reserved_special_token_0|> iris_nan.fillna(mean_replace) <|reserved_special_token_0|> iris_nan.fillna(median_replace) <|reserved_special_toke...
flexible
{ "blob_id": "00429a16ac009f6f706ef11bc29b0aec77b9ebe6", "index": 9536, "step-1": "<mask token>\n", "step-2": "<mask token>\niris_nan.head()\n<mask token>\niris_nan.dropna()\niris_nan.dropna(axis=1)\n<mask token>\niris_nan.fillna(mean_replace)\n<mask token>\niris_nan.fillna(median_replace)\n<mask token>\niris_n...
[ 0, 1, 2, 3, 4 ]
# 1 use the operators to solve for the following equation: # (a) number = ((30*39) + 300) **10 print(number) # find the value of C. X + Y = C Given: x = 0.0050 y = 0.1000 c = x + y print(c) """ what is the result of the following: (a) take the sentence: the study or use of the systems (especially computers and...
normal
{ "blob_id": "c2f82cf73d095979d1da346b7dd7779bcc675805", "index": 4045, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(number)\n<mask token>\nprint(c)\n<mask token>\nprint(word1, ' ' + word2, ' ' + word3)\n<mask token>\nprint(word[:4])\n", "step-3": "number = (30 * 39 + 300) ** 10\nprint(number)\n...
[ 0, 1, 2, 3 ]
<|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": "3fed8723d215bce3cf391752e07ca85b2d6701a3", "index": 3410, "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 = [('submissions...
[ 0, 1, 2, 3, 4 ]
import numpy as np import cv2 from pixcel import * from scipy import ndimage import math from socket import * from config import * from time import time def find_bounding_boxes(fimage, lables): # initialize boxes array boxes = [] for lable in lables: # iterate all lables # filter out i...
normal
{ "blob_id": "f3895f38be29fb07903237d8846cc9d657b39ea9", "index": 6495, "step-1": "<mask token>\n\n\nclass RBox:\n\n def __init__(self):\n self.x = 0\n self.y = 0\n self.w = 0\n self.h = 0\n\n @staticmethod\n def fromClassicalBoundingBox(box):\n rbox = RBox()\n r...
[ 23, 26, 28, 37, 41 ]
""" Deprecated entry point for a component that has been moved. """ # currently excluded from documentation - see docs/README.md from ldclient.impl.integrations.files.file_data_source import _FileDataSource from ldclient.interfaces import UpdateProcessor class FileDataSource(UpdateProcessor): @classmethod def...
normal
{ "blob_id": "ee68ebe146f948f3497577f40741e59b7421e652", "index": 8186, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FileDataSource(UpdateProcessor):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FileDataSource(UpdateProcessor):\n\n @classmethod\n def factory(cls, **kwargs):...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from django.urls import path from .views import NewsCreateListView, NewsDetailGenericView urlpatterns = [ path('news/', NewsCreateListView.as_view()), path('news_detailed/<int:id>/', NewsDetailGenericView.as_view()), ]
normal
{ "blob_id": "afdb14d60374049753b3c980c717a13456c7ff5c", "index": 9745, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('news/', NewsCreateListView.as_view()), path(\n 'news_detailed/<int:id>/', NewsDetailGenericView.as_view())]\n", "step-3": "from django.contrib import admin\nfrom...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('через 10 лет вам бóдет', vozrast + 10) <|reserved_special_token_1|> vozrast = int(input('сколько вам лет?')) print('через 10 лет вам бóдет', vozrast + 10) <|reserved_special_token_1|> vozrast=int(input("сколько вам ле...
flexible
{ "blob_id": "8e3f23733235d73fab14e80ee0a3706ae351c7a2", "index": 4525, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('через 10 лет вам бóдет', vozrast + 10)\n", "step-3": "vozrast = int(input('сколько вам лет?'))\nprint('через 10 лет вам бóдет', vozrast + 10)\n", "step-4": "vozrast=int(input(\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ema(IStrategy): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "7b047ba110732d1b0a749bcbbaa9b55306ca2071", "index": 6434, "step-1": "<mask token>\n\n\nclass ema(IStrategy):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ProgressBar: <|reserved_special_token_0|> class ProgressBar1: def __init__(self, width=50): self.pointer = 0 self.width = width def __call__(self, x): self.pointer = int(self.width * (x / 100.0)) return '|' ...
flexible
{ "blob_id": "f928eb34155046107c99db8ded11747d5960c767", "index": 2527, "step-1": "<mask token>\n\n\nclass ProgressBar:\n <mask token>\n\n\n class ProgressBar1:\n\n def __init__(self, width=50):\n self.pointer = 0\n self.width = width\n\n def __call__(self, x):\n ...
[ 1, 3, 4, 5, 6 ]
#def pizzaTopping(): message1 = "What Pizza do you want?" message = "What type of Pizza topping do you want?" message += "\n Enter 'quit' to stop entering toppings" pizzas = {} while True: pizza = input(message1) topping = input(message) if topping == "quit": break else: pizzas[pi...
normal
{ "blob_id": "bb3cba9847f2318a5043975e4b659265a7442177", "index": 6309, "step-1": "<mask token>\n", "step-2": "<mask token>\nmessage += \"\"\"\n Enter 'quit' to stop entering toppings\"\"\"\n<mask token>\nwhile True:\n pizza = input(message1)\n topping = input(message)\n if topping == 'quit':\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def radar_factory(num_vars, frame='circle'): theta = np.linspace(0, 2 * np.pi, num_vars, endpoint=False) theta += np.pi / 2 def draw_poly_patch(self): verts = unit_poly_verts(theta) return plt.Polygon(verts, closed=True, edgecolor='k') def draw_circle_pat...
flexible
{ "blob_id": "ddf64ea5ecbd3aa737cd788924035cccb5544fec", "index": 5544, "step-1": "<mask token>\n\n\ndef radar_factory(num_vars, frame='circle'):\n theta = np.linspace(0, 2 * np.pi, num_vars, endpoint=False)\n theta += np.pi / 2\n\n def draw_poly_patch(self):\n verts = unit_poly_verts(theta)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def spam(divide_by): return 42 / divide_by <|reserved_special_token_0|> <|reserved_special_token_1|> def spam(divide_by): return 42 / divide_by try: print(spam(2)) print(spam(12)) print(spam(0)) print(spam(1)) print(spam('do...
flexible
{ "blob_id": "357ee02060cbfa391920b3d45dfbe16e679a6c8d", "index": 7346, "step-1": "<mask token>\n", "step-2": "def spam(divide_by):\n return 42 / divide_by\n\n\n<mask token>\n", "step-3": "def spam(divide_by):\n return 42 / divide_by\n\n\ntry:\n print(spam(2))\n print(spam(12))\n print(spam(0))...
[ 0, 1, 2, 3 ]
def lengthOfLongestSubstring(s): max_len = 0 for i in range(len(s)): storage = set() count = 0 for j in range(i, len(s)): if not s[j] in storage: storage.append(s[j]) count += 1 else: break max_len = max(max_...
normal
{ "blob_id": "7e83d11bb43229eaa199514b4be6a0acf3ab36ce", "index": 4395, "step-1": "<mask token>\n", "step-2": "def lengthOfLongestSubstring(s):\n max_len = 0\n for i in range(len(s)):\n storage = set()\n count = 0\n for j in range(i, len(s)):\n if not s[j] in storage:\n ...
[ 0, 1, 2 ]
import micropython # viper function taking and returning ints @micropython.viper def viper_int(x:int, y:int) -> int: return x + y + 3 print(viper_int(1, 2)) # viper function taking and returning objects @micropython.viper def viper_object(x:object, y:object) -> object: return x + y print(viper_obj...
normal
{ "blob_id": "eec52695e5afcc21e5fed6453e96cc3a58e7c1df", "index": 101, "step-1": "<mask token>\n\n\n@micropython.viper\ndef viper_int(x: int, y: int) ->int:\n return x + y + 3\n\n\n<mask token>\n\n\n@micropython.viper\ndef viper_local(x: int) ->int:\n y = 4\n return x + y\n\n\n<mask token>\n\n\n@micropyt...
[ 9, 10, 12, 14, 15 ]
import datetime from random import SystemRandom import re import string import time from django.db import models from django.utils import timezone from app.translit import translit # Each model extends models.Model class alumni(models.Model): alumnus_id = models.AutoField(primary_key=True) full_name = model...
normal
{ "blob_id": "192e789129a51aa646a925fc4f8c3f8f4e14d478", "index": 7988, "step-1": "<mask token>\n\n\nclass invites(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 13, 16, 18, 22, 24 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def init(): register_xpath_extensions() <|reserved_special_token_1|> from __future__ import absolute_import from talin.quotations import register_xpath_extensions def init(): register_xpath_extensions()
flexible
{ "blob_id": "c218428908c28a8c65bd72e66dcddaf7db1909d7", "index": 4325, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef init():\n register_xpath_extensions()\n", "step-3": "from __future__ import absolute_import\nfrom talin.quotations import register_xpath_extensions\n\n\ndef init():\n regi...
[ 0, 1, 2 ]
import os import json import pathlib from gql import gql, Client from gql.transport.aiohttp import AIOHTTPTransport # Select your transport with a defined url endpoint transport = AIOHTTPTransport(url="https://public-api.nbatopshot.com/graphql") # Create a GraphQL client using the defined transport client = Client(tr...
normal
{ "blob_id": "df518fd719b7eafffd8fee92c926d4d24b65ce18", "index": 7877, "step-1": "<mask token>\n", "step-2": "<mask token>\npathlib.Path(DIR).mkdir(parents=True, exist_ok=True)\nprint('--------Query Topshot GraphQL Endpoint--------')\nfor setsId in setsIdList:\n for setId in setsId:\n count += 1\n ...
[ 0, 1, 2, 3, 4 ]
def spam(divide_by): return 42 / divide_by try: print(spam(2)) print(spam(12)) print(spam(0)) print(spam(1)) print(spam("dog")) except Exception: print("Error: Invalid argument.")
normal
{ "blob_id": "357ee02060cbfa391920b3d45dfbe16e679a6c8d", "index": 7346, "step-1": "<mask token>\n", "step-2": "def spam(divide_by):\n return 42 / divide_by\n\n\n<mask token>\n", "step-3": "def spam(divide_by):\n return 42 / divide_by\n\n\ntry:\n print(spam(2))\n print(spam(12))\n print(spam(0))...
[ 0, 1, 2, 3 ]
#returns true if given date is a leap year, false otherwise def is_leap_year(date): #if divisible by 400, definitely a leap year if date % 400 == 0: return True #if divisible by 100 (and not 400), not a leap year elif date % 100 == 0: return False #divisible by 4 and not by 100? leap year elif date % 4 == 0: r...
normal
{ "blob_id": "496d52a984bb8c0e72948ab0c8db5e6035427a68", "index": 5209, "step-1": "<mask token>\n", "step-2": "def is_leap_year(date):\n if date % 400 == 0:\n return True\n elif date % 100 == 0:\n return False\n elif date % 4 == 0:\n return True\n else:\n return False\n",...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class RegisterViewSet(viewsets.ModelViewSet): queryset = models.Register.objects.all() serializer_class = serializers.RegisterSerializer permission_classes = IsAuthenticatedOrReadOnly, ForumPermissions def get_permissions(self): if self.request.user.is_authenticat...
flexible
{ "blob_id": "4d059d1ca407ef60f1fbf9d8bead1cf45c90c28a", "index": 8227, "step-1": "<mask token>\n\n\nclass RegisterViewSet(viewsets.ModelViewSet):\n queryset = models.Register.objects.all()\n serializer_class = serializers.RegisterSerializer\n permission_classes = IsAuthenticatedOrReadOnly, ForumPermissi...
[ 10, 17, 18, 20, 22 ]
<|reserved_special_token_0|> def get_onnx_kobert_model(cachedir='.cache'): """Get KoBERT ONNX file path after downloading""" onnx_kobert = {'url': 's3://skt-lsl-nlp-model/KoBERT/models/kobert.onnx1.8.0.onnx', 'chksum': '6f6610f2e3b61da6de8dbce'} model_info = onnx_kobert model_path, is_...
flexible
{ "blob_id": "b6e4214ace89165f6cfde9f2b97fcee8be81f2ed", "index": 4301, "step-1": "<mask token>\n\n\ndef get_onnx_kobert_model(cachedir='.cache'):\n \"\"\"Get KoBERT ONNX file path after downloading\"\"\"\n onnx_kobert = {'url':\n 's3://skt-lsl-nlp-model/KoBERT/models/kobert.onnx1.8.0.onnx',\n ...
[ 1, 2, 3, 4, 5 ]
import FWCore.ParameterSet.Config as cms process = cms.Process("GeometryInfo") # minimum of logs process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( enable = cms.untracked.bool(True), thresh...
normal
{ "blob_id": "ac0e301e58ea64465ccd4b2b9aa4ae69283d6d0c", "index": 6052, "step-1": "<mask token>\n", "step-2": "<mask token>\nprocess.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi')\n<mask token>\nprocess.load('CondCore.CondDB.CondDB_cfi')\n<mask token>\n", "step-3": "<mask token>\nprocess = cms...
[ 0, 1, 2, 3, 4 ]
# -*- encoding: utf-8 -*- # # BigBrotherBot(B3) (www.bigbrotherbot.net) # Copyright (C) 2011 Thomas "Courgette" LÉVEIL <courgette@bigbrotherbot.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
normal
{ "blob_id": "903d5913025d7d61ed50285785ec7f683047b49a", "index": 8960, "step-1": "# -*- encoding: utf-8 -*-\n#\n# BigBrotherBot(B3) (www.bigbrotherbot.net)\n# Copyright (C) 2011 Thomas \"Courgette\" LÉVEIL <courgette@bigbrotherbot.net>\n#\n# This program is free software; you can redistribute it and/or modify\n#...
[ 0 ]
import streamlit as st st.write('hi')
normal
{ "blob_id": "62ca95a871c16191fb8f56213646e8173f400630", "index": 8017, "step-1": "<mask token>\n", "step-2": "<mask token>\nst.write('hi')\n", "step-3": "import streamlit as st\nst.write('hi')\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- ## https://atcoder.jp/contests/abs/tasks/abc083_b import sys def gets(input): return input.readline().strip() def run(input): n, a, b = gets(input).split() N, A, B = int(n), int(a), int(b) # total = 0 for i in range(1, N+1): x = sum( int(ch) for ch in str(i) )...
normal
{ "blob_id": "a1ea0f269a20ff608d10ee01804eeee7e7232b1d", "index": 7650, "step-1": "<mask token>\n\n\ndef gets(input):\n return input.readline().strip()\n\n\n<mask token>\n\n\ndef main():\n result = run(sys.stdin)\n print(result)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef gets(input):\n r...
[ 2, 3, 4, 5, 6 ]
from .file_uploader_routes import FILE_UPLOADER_BLUEPRINT
normal
{ "blob_id": "c7dacdb53efb6935314c5e3718a4a2f1d862b07d", "index": 2340, "step-1": "<mask token>\n", "step-2": "from .file_uploader_routes import FILE_UPLOADER_BLUEPRINT\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
''' Import necessary libraries ''' import re import csv import os from urllib.request import urlopen, Request from bs4 import BeautifulSoup as soup ''' Function to request page html from given URL ''' def page_html(requested_url): try: # define headers to be provided for request authenticatio...
normal
{ "blob_id": "5bfb7fc60ddf4f6ad6d89771eb0a8903b04da3d9", "index": 6187, "step-1": "<mask token>\n\n\ndef page_html(requested_url):\n try:\n headers = {'User-Agent':\n 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'\n , 'Acc...
[ 3, 4, 5, 6, 7 ]
import numpy as np count = 0 # счетчик попыток number = np.random.randint(1, 101) # загадали число print("Загадано число от 1 до 100") def game_core_v3(number): '''Сначала устанавливаем любое random число, а потом уменьшаем или увеличиваем его в зависимости от того, больше оно или меньше нужного. Функция...
normal
{ "blob_id": "66474b8cdca9a4aa48b8dc710d161a3a16495aed", "index": 6438, "step-1": "<mask token>\n\n\ndef game_core_v3(number):\n \"\"\"Сначала устанавливаем любое random число, а потом уменьшаем или увеличиваем его в зависимости от того, больше оно или меньше нужного.\n Функция принимает загаданное число...
[ 2, 3, 4, 5, 6 ]
import json from datetime import datetime, timedelta from itertools import product from django.db.models import QuerySet import pytz from model_mommy import mommy from ...views import get_authors, get_featured_challenges, get_term_of_user class TestNonMiscView: """Test for non view functions in ideax.views (...
normal
{ "blob_id": "8d6e4d06e390b4a45e576239189745c2e37217c5", "index": 2699, "step-1": "<mask token>\n\n\nclass TestNonMiscView:\n <mask token>\n <mask token>\n\n def test_get_term_of_user(self, rf, db):\n mommy.make('Use_Term', term='EULA Test', final_date=datetime.now(\n pytz.UTC) + timede...
[ 5, 6, 7, 9, 10 ]
import datetime from django.views.generic import DetailView, ListView from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponseRedirect, Http404 from django.shortcuts import get_list_or_404, render_to_response, get_object_or_404 from django.template import RequestContext from django.co...
normal
{ "blob_id": "3ecc9ce82d9c902958a4da51ce7ee3c39b064b2b", "index": 3591, "step-1": "<mask token>\n\n\nclass MilkingListView(ListView):\n <mask token>\n\n def get_queryset(self, *args, **kwargs):\n try:\n animal = Animal.objects.get(self.kwargs.get('slug', None))\n qs = Milking.ob...
[ 7, 10, 13, 15, 16 ]
import unittest import json from app.tests.base import BaseTestCase from app import db from app.tests.utils import create_room, create_simple_device, create_rgb_device class TestRoomService(BaseTestCase): """Test the room service""" def test_get_room(self): room = create_room() with self.client: response =...
normal
{ "blob_id": "332e2945e34c861b2132f6b42ef59416a38455a5", "index": 2542, "step-1": "<mask token>\n\n\nclass TestRoomService(BaseTestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestDeviceService(BaseTestCase):\n \"\"\"Test the device service\"\"\"\n\n def test_get...
[ 7, 9, 11, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Config(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Config(object): <|reserved_special_token_0|> def get(self, section, name): return self.config_dict[section][name] ...
flexible
{ "blob_id": "9cb4e550a0d19b44ec8357882f353b04748b213b", "index": 2589, "step-1": "<mask token>\n", "step-2": "class Config(object):\n <mask token>\n <mask token>\n", "step-3": "class Config(object):\n <mask token>\n\n def get(self, section, name):\n return self.config_dict[section][name]\n...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- num = input().split() A = float(num[0]) B = float(num[1]) C = float(num[2]) if A == 0: print("Impossivel calcular") else: delta = B**2 - (4*A*C) if delta < 0.0: print("Impossivel calcular") else: raiz = delta ** 0.5 r1 = (-B+raiz)/(2*A) r2 =...
normal
{ "blob_id": "f114a86a3c6bea274b01763ce3e8cd5c8aea44a0", "index": 3115, "step-1": "<mask token>\n", "step-2": "<mask token>\nif A == 0:\n print('Impossivel calcular')\nelse:\n delta = B ** 2 - 4 * A * C\n if delta < 0.0:\n print('Impossivel calcular')\n else:\n raiz = delta ** 0.5\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.config.from_pyfile('settings.py') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app = flask.Flask(__name__) app.config.from_pyfile('settings.py') db = flask_sqlalchemy.SQLAlchemy(app...
flexible
{ "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 ]
import pandas as pd import requests import re from bs4 import BeautifulSoup from datetime import datetime nbaBoxUrl = 'https://www.basketball-reference.com/boxscores/' boxScoreClass = 'stats_table' def getBoxScoreLinks(): page = requests.get(nbaBoxUrl) soup = BeautifulSoup(page.content, 'html.parser') ga...
normal
{ "blob_id": "2b3983fd6a8b31604d6d71dfca1d5b6c2c7105e0", "index": 4818, "step-1": "<mask token>\n\n\ndef getBoxScoreLinks():\n page = requests.get(nbaBoxUrl)\n soup = BeautifulSoup(page.content, 'html.parser')\n gameLinks = []\n data = soup.findAll('td', {'class': 'right gamelink'})\n for div in da...
[ 8, 9, 11, 12, 15 ]
<|reserved_special_token_0|> class TheguardianSpider(scrapy.Spider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def article(self, response): brexit_news = BrexitNewsItem() title = response.xpath('string(//h1[...
flexible
{ "blob_id": "8180dac5d33334d7f16ab6bef41f1fe800879ca7", "index": 2255, "step-1": "<mask token>\n\n\nclass TheguardianSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def article(self, response):\n brexit_news = BrexitNewsItem()\n title = response...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import random from cocos.actions import MoveTo, CallFuncS from cocos.sprite import Sprite import define def kill(spr): spr.unschedule(spr.update) arena = spr.parent.parent if not spr.is_big: arena.batch.add(Dot()) spr.killer.add_score() else: spr.killer...
normal
{ "blob_id": "be06a0ad22f4ae9ab4c0acea6a7c601c14a90fc4", "index": 1995, "step-1": "<mask token>\n\n\nclass Dot(Sprite):\n <mask token>\n\n def update(self, dt):\n arena = self.parent.parent\n snake = arena.snake\n self.check_kill(snake)\n for s in arena.enemies:\n self...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Cart(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|> <|reserved_special_token_0|> def get_total(self): ...
flexible
{ "blob_id": "454d210c1b1a41e4a645ef7ccb24f80ee20a451c", "index": 2224, "step-1": "<mask token>\n\n\nclass Cart(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def get_total(self):\n total = self.item.price ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'Sua frase tem {n_a} letras a') print(f'A letra A aparece pela primeira vez na {f_a}° posição') print(f'A letra A apaerece pela ultima vez na {l_a}° posição') <|reserved_special_token_1|> <|reserved_special_token_0|> fra...
flexible
{ "blob_id": "58f3b8c5470c765c81f27d39d9c28751a8c2b719", "index": 277, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'Sua frase tem {n_a} letras a')\nprint(f'A letra A aparece pela primeira vez na {f_a}° posição')\nprint(f'A letra A apaerece pela ultima vez na {l_a}° posição')\n", "step-3": "<ma...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- ''' :Title Insert Date :Planguage Python :Requires VoodooPad 3.5+ :Description Inserts Date EOD ''' VPScriptSuperMenuTitle = "GTD" VPScriptMenuTitle = "Insert Date" VPShortcutMask = "control" VPShortcutKey = "J" import AppKit import time def main(windowController, *args, **kwargs): te...
normal
{ "blob_id": "e51ca78ca6751f8238a39d3eae55d6cc6ab65128", "index": 5797, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(windowController, *args, **kwargs):\n textView = windowController.textView()\n document = windowController.document()\n if textView != None:\n dateFormat = ti...
[ 0, 1, 2, 3, 4 ]
import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions,SetupOptions from apache_beam.options.pipeline_options import GoogleCloudOptions from apache_beam.options.pipeline_options import StandardOptions dataflow_options = ['--project=lofty-shine-248403', '--job_name=newjob', '--temp_...
normal
{ "blob_id": "93a2385d9ebdbc1a7a88185c0a0d5d1f227e46a3", "index": 8159, "step-1": "<mask token>\n\n\ndef MLmodel(data):\n import pickle\n import numpy as np\n from google.cloud import storage\n storage_client = storage.Client()\n bucket = storage_client.get_bucket('testing-gcp-mandar')\n blob = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(res1) <|reserved_special_token_0|> print(res2) <|reserved_special_token_0|> print(res3) <|reserved_special_token_0|> print(res4) <|reserved_special_token_0|> print(res5) <|reserved_special_token_0|> print(res6) <|reserved_...
flexible
{ "blob_id": "0a38cf6e0518a08895ed7155069aa2257c7b352e", "index": 4662, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(res1)\n<mask token>\nprint(res2)\n<mask token>\nprint(res3)\n<mask token>\nprint(res4)\n<mask token>\nprint(res5)\n<mask token>\nprint(res6)\n", "step-3": "<mask token>\ndf1 = pd....
[ 0, 1, 2, 3, 4 ]
import urllib from django.shortcuts import render, redirect, get_object_or_404 from django.contrib import messages from django.utils.translation import gettext as _ from .forms import CountryForm from .models import Countries from django.utils.timezone import datetime from django.contrib.auth.decorators import login_re...
normal
{ "blob_id": "8640de519ebf7f95588ac40b55662da85ffc926e", "index": 5224, "step-1": "<mask token>\n\n\n@login_required(login_url='user_login')\ndef countries_add(request):\n if request.method == 'POST':\n form = CountryForm(request.POST or None)\n if form.is_valid():\n form.save()\n ...
[ 2, 4, 5, 6, 7 ]
import numpy def CALCB1(NVAC,KGAS,LGAS,ELECEN,ISHELL,L1): # IMPLICIT #real*8(A-H,O-Z) # IMPLICIT #integer*8(I-N) #CHARACTER*6 # SCR=""#(17) # SCR1=""#(17) #COMMON/GENCAS/ global ELEV#[17,79] global NSDEG#(17) global AA#[17] global BB#[17] global SCR,SCR1 #COMMON/MIXC/ global PRSH#(6,3,17,17) global ESH#(6...
normal
{ "blob_id": "09698649510348f92ea3b83f89ffa1c844929b8f", "index": 3332, "step-1": "<mask token>\n\n\ndef CALCB2(NVAC, KGAS, LGAS, ELECEN, ISHELL, L1):\n global ELEV\n global NSDEG\n global AA\n global BB\n global SCR, SCR1\n global PRSH\n global ESH\n global AUG\n global RAD\n global...
[ 3, 4, 5, 6, 7 ]
from django.shortcuts import render, redirect from .models import * from django.contrib.auth import authenticate ,login,logout from django.contrib.auth.models import User from datetime import date # Create your views here. def home(request): if request.method=='GET': daily_users = User.objects.f...
normal
{ "blob_id": "4cb601d7fc4023e145c6d510d27507214ddbd2d3", "index": 809, "step-1": "<mask token>\n\n\ndef register(request):\n if request.method == 'GET':\n return render(request, 'home/home.html')\n else:\n name = request.POST['name']\n username = request.POST['uname']\n email = r...
[ 5, 6, 7, 8, 9 ]
import math def is_prime(n): # Based on the Sieve of Eratosthenes if n == 1: return False if n < 4: # 2 and 3 are prime return True if n % 2 == 0: return False if n < 9: # 5 and 7 are prime (we have already excluded 4, 6 and 8) return True if n %...
normal
{ "blob_id": "3970c7768e892ad217c193b1d967c1203b7e9a25", "index": 6512, "step-1": "<mask token>\n\n\ndef is_prime(n):\n if n == 1:\n return False\n if n < 4:\n return True\n if n % 2 == 0:\n return False\n if n < 9:\n return True\n if n % 3 == 0:\n return False\n ...
[ 1, 2, 3, 4, 5 ]
f=open('poem.txt') for line in f: print line,
normal
{ "blob_id": "76348448a658736627efe8fa6b19c752191966e7", "index": 5409, "step-1": "f=open('poem.txt')\nfor line in f:\n\tprint line,\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': dq = Deque() dq.palindrom() <|reserved_special_token_1|> <|reserved_special_token_0|> from com.bridgelabz.utility.Data_structure_utility import * if __name__ == '__main__': dq = Deque() ...
flexible
{ "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 ]
import sys try: myfile = open("mydata.txt",encoding ="utf-8") except FileNotFoundError as ex: print("file is not found") print(ex.args) else: print("file :",myfile.read()) myfile.close() finally : print("finished working")
normal
{ "blob_id": "8bf75bf3b16296c36c34e8c4c50149259d792af7", "index": 4319, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n myfile = open('mydata.txt', encoding='utf-8')\nexcept FileNotFoundError as ex:\n print('file is not found')\n print(ex.args)\nelse:\n print('file :', myfile.read())\n ...
[ 0, 1, 2, 3 ]
import pickle as pickle import os import pandas as pd import torch import numpy as np import random from sklearn.metrics import accuracy_score from transformers import XLMRobertaTokenizer, XLMRobertaForSequenceClassification, Trainer, TrainingArguments, XLMRobertaConfig, ElectraForSequenceClassification, Electra...
normal
{ "blob_id": "d3b6a105b14d9c3485a71058391a03c2f4aa5c10", "index": 8628, "step-1": "<mask token>\n\n\ndef seed_everything(seed):\n torch.manual_seed(seed)\n torch.cuda.manual_seed(seed)\n torch.cuda.manual_seed_all(seed)\n torch.backends.cudnn.deterministic = True\n torch.backends.cudnn.benchmark = ...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Graph: def __init__(self): self._graph = defaultdict(list) self._odd_vertices = [] def add_vertex(self, v): if not v in self._graph: self._graph[v] = list() <|reserved_special_token_0|> <|reserved_special_token_0|> def check...
flexible
{ "blob_id": "b4d412e8b45722a855a16dd64b7bce9b303d0ffe", "index": 964, "step-1": "<mask token>\n\n\nclass Graph:\n\n def __init__(self):\n self._graph = defaultdict(list)\n self._odd_vertices = []\n\n def add_vertex(self, v):\n if not v in self._graph:\n self._graph[v] = list...
[ 5, 6, 7, 8, 9 ]
""" Given a string s. Return all the words vertically in the same order in which they appear in s. Words are returned as a list of strings, complete with spaces when is necessary. (Trailing spaces are not allowed). Each word would be put on only one column and that in one column there will...
normal
{ "blob_id": "7c2897dcb732e75d7328e8c0484d5bd7f3b56e6f", "index": 9190, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef StringToList(input_string):\n word_list = []\n word = ''\n for i in range(0, len(input_string)):\n if input_string[i] == ' ':\n word_list.append(word)\n...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if year % 4 == 0 and not year % 100 == 0: print('YES') elif year % 400 == 0: print('yes') else: print('NO') <|reserved_special_token_1|> year = int(input('введите год ')) if year % 4 == 0 and not year % 100 == 0: ...
flexible
{ "blob_id": "99e6e734c7d638e3cf4d50d9605c99d5e700e82a", "index": 1699, "step-1": "<mask token>\n", "step-2": "<mask token>\nif year % 4 == 0 and not year % 100 == 0:\n print('YES')\nelif year % 400 == 0:\n print('yes')\nelse:\n print('NO')\n", "step-3": "year = int(input('введите год '))\nif year % ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getAllIndiciesNames(): indicies = set() for index in connect_to_elasticsearch().indices.get_alias('*'): indicies.add(index) print(index) return indicies <|reserved_special_token_1|> from connec...
flexible
{ "blob_id": "23c75840efd9a8fd68ac22d004bfe3b390fbe612", "index": 2314, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getAllIndiciesNames():\n indicies = set()\n for index in connect_to_elasticsearch().indices.get_alias('*'):\n indicies.add(index)\n print(index)\n return in...
[ 0, 1, 2, 3 ]
#!/usr/local/bin/python # -*- coding: utf-8 -*- # importing regular stuff import os import sys import thread import threading import time import datetime from datetime import datetime import random import filecmp import ConfigParser import socket #my stuff will go here import include.action as action import include.l...
normal
{ "blob_id": "a3301180e53da4a6970c082e72d8721b29dcae2e", "index": 1403, "step-1": "#!/usr/local/bin/python\n# -*- coding: utf-8 -*-\n\n# importing regular stuff\nimport os\nimport sys\nimport thread\nimport threading\nimport time\nimport datetime\nfrom datetime import datetime\nimport random\nimport filecmp\nimpo...
[ 0 ]
import myThread def main(): hosts={"127.0.0.1":"carpenter"} myThread.messageListenThread(hosts) if __name__ == '__main__': main()
normal
{ "blob_id": "b0a49f5876bc3837b69a6dc274f9587a37351495", "index": 8370, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n hosts = {'127.0.0.1': 'carpenter'}\n myThread.messageListenThread(hosts)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n hosts = {'127.0.0.1'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def layer_to_visualize(layer): inputs = [K.learning_phase()] + model.inputs _convout1_f = K.function(inputs, [layer.output]) def convout1_f(X): return _convout1_f([0] + [X]) convolutions = convout1_f(img) convolutions = np.squeeze(convolutions) print('Shap...
flexible
{ "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 ]