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|> <|reserved_special_token_0|> @dp.message_handler(commands='upload', user_id=ADMINS, state='*') async def upload_profile(command_msg: Message, state: FSMContext): profile_msg = command_msg.reply_to_message admin = command_msg.from_user param = co...
flexible
{ "blob_id": "302accfd5001a27c7bbe6081856d43dbec704168", "index": 339, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dp.message_handler(commands='upload', user_id=ADMINS, state='*')\nasync def upload_profile(command_msg: Message, state: FSMContext):\n profile_msg = command_msg.reply_to_message\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class City(BaseModel): name = models.CharField(max_length=255, db_index=True) def __str__(self): return self.name class Article(BaseModel): created_by = models.ForeignKey(User, related_name='articles', on_delete =models.SET_NULL, null=True) title = model...
flexible
{ "blob_id": "c2260278c8dfb353f55ee9ea3495049b08169447", "index": 4115, "step-1": "<mask token>\n\n\nclass City(BaseModel):\n name = models.CharField(max_length=255, db_index=True)\n\n def __str__(self):\n return self.name\n\n\nclass Article(BaseModel):\n created_by = models.ForeignKey(User, relat...
[ 9, 10, 11, 12, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calc(x): return str(math.log(abs(12 * math.sin(int(x))))) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calc(x): return str(math.log(abs(12 * math.sin(int(x))))) ...
flexible
{ "blob_id": "2a92c47231b75a441660fed80a9bce9a35695af5", "index": 1222, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef calc(x):\n return str(math.log(abs(12 * math.sin(int(x)))))\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef calc(x):\n return str(math.log(abs(12 * math.sin(int(x))...
[ 0, 1, 2, 3, 4 ]
import os import torch from data_loader import FER from torch.utils.data import DataLoader from tqdm import tqdm # from tensorboardX import SummaryWriter import model as md # train_writer = SummaryWriter(log_dir="log_last_last_last/train") # valid_writer = SummaryWriter(log_dir="log_last_last_last/valid")...
normal
{ "blob_id": "c3aee5d822d48c9dc826f8f2f8d4a56e11513b9c", "index": 2882, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.to(device)\n<mask token>\n...\nfor epoch in range(epochs):\n running_loss = 0\n running_acc = 0\n train_loss = 0\n model.train()\n for image, label in tqdm(train_data...
[ 0, 1, 2, 3, 4 ]
#HOW TO BUILD A SIMPLE CALCULATOR #1.ADD #2.SUBTRACT #3.MULTIPLY #4.DIVIDE print("Select an operation to perform: ") print("1.ADD") print("2.SUBTRACT") print("3.MULTIPLY") print("4.DIVIDE") print("5.SQUARE ROOT") operation=input() if operation=="1": a=input("Enter first number: ") b=input("Enter sec...
normal
{ "blob_id": "ea35180daecb8ca4b9bd351a949a4757b97322ec", "index": 2819, "step-1": "<mask token>\n", "step-2": "print('Select an operation to perform: ')\nprint('1.ADD')\nprint('2.SUBTRACT')\nprint('3.MULTIPLY')\nprint('4.DIVIDE')\nprint('5.SQUARE ROOT')\n<mask token>\nif operation == '1':\n a = input('Enter ...
[ 0, 1, 2, 3 ]
#----------- writing our for loop """ number = [1,2,3,4,5] friends = ['ahmet', 'mehmet','ayşe'] # for n in number: # print(n) # for n in friends: # print(n) def my_for_loop(my_iterable): my_iterator = iter(my_iterable) while True: try: print(next(my_iterator)) except StopI...
normal
{ "blob_id": "70325d0e5eb9dcd7a065f83eaf14647bc30bd7f3", "index": 9053, "step-1": "<mask token>\n", "step-2": "\n#----------- writing our for loop\n\"\"\" number = [1,2,3,4,5]\nfriends = ['ahmet', 'mehmet','ayşe']\n\n# for n in number:\n# print(n)\n# for n in friends:\n# print(n)\n\ndef my_for_loop(my_i...
[ 0, 1 ]
#This script reads through a Voyager import log and outputs duplicate bib IDs as well as the IDs of bibs, mfhds, and items created. #import regular expressions and openpyxl import re import openpyxl # prompt for file names fname = input("Enter input file, including extension: ") fout = input("Enter output file, witho...
normal
{ "blob_id": "fc06d8a26a99c16a4b38ad0b4bbb28a1dc522991", "index": 6902, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith fh as f:\n lines = f.readlines()\n n_lines = len(lines)\n for i, line in enumerate(lines):\n line = line.rstrip()\n if line.startswith('\\tBibID & rank') and n...
[ 0, 1, 2, 3, 4 ]
import django.dispatch property_viewed = django.dispatch.Signal(providing_args=["property","user", "request", "response"])
normal
{ "blob_id": "00099cab0c816c76fc0fa94d7905175feb6919cf", "index": 9795, "step-1": "<mask token>\n", "step-2": "<mask token>\nproperty_viewed = django.dispatch.Signal(providing_args=['property', 'user',\n 'request', 'response'])\n", "step-3": "import django.dispatch\nproperty_viewed = django.dispatch.Signal...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def resolve_data(raw_data, derivatives_prefix): derivatives = {} if isinstance(raw_data, dict): for k, v in raw_data.items(): if isinstance(v, dict): derivatives.update(resolve_data(v, derivatives_prefix + k + ...
flexible
{ "blob_id": "31b109d992a1b64816f483e870b00c703643f514", "index": 6577, "step-1": "<mask token>\n", "step-2": "def resolve_data(raw_data, derivatives_prefix):\n derivatives = {}\n if isinstance(raw_data, dict):\n for k, v in raw_data.items():\n if isinstance(v, dict):\n de...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __import__('pkg_resources').require('Django==2.1.dev20180209010235') <|reserved_special_token_0|> exec(compile(open(__file__).read(), __file__, 'exec')) <|reserved_special_token_1|> __requires__ = 'Django==2.1.dev20180209010235...
flexible
{ "blob_id": "4bbf0a0fadc506ad3674912f1885525a94b5b1e9", "index": 2807, "step-1": "<mask token>\n", "step-2": "<mask token>\n__import__('pkg_resources').require('Django==2.1.dev20180209010235')\n<mask token>\nexec(compile(open(__file__).read(), __file__, 'exec'))\n", "step-3": "__requires__ = 'Django==2.1.dev...
[ 0, 1, 2, 3 ]
''' Given an infinite sorted array (or an array with unknown size), find if a given number ‘key’ is present in the array. Write a function to return the index of the ‘key’ if it is present in the array, otherwise return -1. Since it is not possible to define an array with infinite (unknown) size, you will be provided ...
normal
{ "blob_id": "a9efa258c223460b2b79861acdde89161706ad9a", "index": 8770, "step-1": "<mask token>\n\n\nclass ArrayReader:\n\n def __init__(self, arr):\n self.arr = arr\n\n def get(self, index):\n if index > len(self.arr):\n return math.inf\n return self.arr[index]\n\n\n<mask to...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def squirrel_play(temp, is_summer): if is_summer == True: if 60 <= temp <= 100: return True else: return False if is_summer == False: if 60 <= temp <= 90: return True else: ...
flexible
{ "blob_id": "48755cf48c6696259d0c319d382021f33751ac01", "index": 9497, "step-1": "<mask token>\n", "step-2": "def squirrel_play(temp, is_summer):\n if is_summer == True:\n if 60 <= temp <= 100:\n return True\n else:\n return False\n if is_summer == False:\n if 6...
[ 0, 1 ]
import datetime from collections import defaultdict from django.db.models import Prefetch from urnik.models import Termin, Rezervacija, Ucilnica, DNEVI, MIN_URA, MAX_URA, Srecanje, Semester, RezervacijaQuerySet class ProsteUcilniceTermin(Termin): HUE_PRAZEN = 120 # zelena HUE_POLN = 0 # rdeca def __i...
normal
{ "blob_id": "3ce9c0aeb6b4e575fbb3fced52a86a1dcec44706", "index": 4713, "step-1": "<mask token>\n\n\nclass ProsteUcilnice(object):\n <mask token>\n\n def __init__(self, ucilnice):\n self.ucilnice = set(ucilnice)\n self.zasedenost_ucilnic = defaultdict(dict)\n self.rezerviranost_ucilnic ...
[ 20, 22, 26, 27, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def remove(string_input): return string_input.replace(' ', '') <|reserved_special_token_1|> #Function to remove spaces in a string def remove(string_input): return string_input.replace(" ", "")
flexible
{ "blob_id": "f327f408ae2759407ac9f01ad4feff5c6a0845f1", "index": 9524, "step-1": "<mask token>\n", "step-2": "def remove(string_input):\n return string_input.replace(' ', '')\n", "step-3": "#Function to remove spaces in a string\n\ndef remove(string_input):\n return string_input.replace(\" \", \"\")\n"...
[ 0, 1, 2 ]
def test(name, message): print('用户是:', name) print('欢迎消息是:', message) <|reserved_special_token_0|> <|reserved_special_token_1|> def test(name, message): print('用户是:', name) print('欢迎消息是:', message) <|reserved_special_token_0|> def foo(name, *nums): print('name参数:', name) print('nums参数:'...
flexible
{ "blob_id": "64fb006ea5ff0d101000dd4329b3d957a326ed1a", "index": 2387, "step-1": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n", "step-2": "def test(name, message):\n print('用户是:', name)\n print('欢迎消息是:', message)\n\n\n<mask token>\n\n\ndef foo(name,...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'gymapp' urlpatterns = [path('', ClientHomeView.as_view(), name='clienthome'), path( 'about/', ClientAboutView.as_view(), name='clientabout'), path( 'contact/', ClientContactCreateView.as_view(), name='clientcon...
flexible
{ "blob_id": "48a4331e4b26ea81f1c52ae76db1e92a57cb378c", "index": 2654, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'gymapp'\nurlpatterns = [path('', ClientHomeView.as_view(), name='clienthome'), path(\n 'about/', ClientAboutView.as_view(), name='clientabout'), path(\n 'contact/', Clie...
[ 0, 1, 2, 3 ]
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
normal
{ "blob_id": "43e721ac45570e4f9ab9c1970abee3da6db40afa", "index": 156, "step-1": "<mask token>\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass ParallelMigrationStrategy(base.BaseStrategy):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 11, 13, 16, 18, 19 ]
<|reserved_special_token_0|> class Hexapod: <|reserved_special_token_0|> <|reserved_special_token_0|> def get_delta_L(self): """ Расчет геометрии положения точек A_i в каждый момент времени. Отрисовка графиков изменения длин, скорости и ускорения для каждого привода по времени. ...
flexible
{ "blob_id": "9a672c17ee22a05e77491bc1449c1c1678414a8c", "index": 3094, "step-1": "<mask token>\n\n\nclass Hexapod:\n <mask token>\n <mask token>\n\n def get_delta_L(self):\n \"\"\"\n Расчет геометрии положения точек A_i в каждый момент времени.\n Отрисовка графиков изменения длин, с...
[ 6, 9, 10, 11, 13 ]
<|reserved_special_token_0|> def setup(): global pwm_A, pwm_B GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(Motor_B_EN, GPIO.OUT) GPIO.setup(Motor_B_Pin1, GPIO.OUT) GPIO.setup(Motor_B_Pin2, GPIO.OUT) pwm_B = GPIO.PWM(Motor_B_EN, 1000) def motorStop(): GPIO.output(Motor_...
flexible
{ "blob_id": "7369d5a463b0f41c17d5648739d4730256e611f9", "index": 9612, "step-1": "<mask token>\n\n\ndef setup():\n global pwm_A, pwm_B\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(Motor_B_EN, GPIO.OUT)\n GPIO.setup(Motor_B_Pin1, GPIO.OUT)\n GPIO.setup(Motor_B_Pin2, GPIO.OUT...
[ 4, 5, 6, 7, 8 ]
from django.apps import AppConfig class Iapp1Config(AppConfig): name = 'iapp1'
normal
{ "blob_id": "c27ca6a8c38f2b96011e3a09da073ccc0e5a1467", "index": 3386, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n name = 'iapp1'\n", "step-4": "from django.apps import AppConfig...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(rsp.text) <|reserved_special_token_1|> <|reserved_special_token_0|> rsp = requests.get( 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s' % ('wx27c0e6ef6a7f0716', '6e29e232...
flexible
{ "blob_id": "d86fe165e378e56650e3b76bf3d0f72e2a50a023", "index": 5082, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(rsp.text)\n", "step-3": "<mask token>\nrsp = requests.get(\n 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s'\n % ('wx27c0e6ef6a7f0...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DAE(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def fast_training(self, sound): self.core_size = 100 self.batch_size = 1000 self.Epoches = 50 self._main(sound, 100, 1000, 50) def medium_training(self, sound): ...
flexible
{ "blob_id": "6f53702d9265a7fc57d2ec2e47dc35a0bc7a9f87", "index": 9012, "step-1": "<mask token>\n\n\nclass DAE(object):\n <mask token>\n <mask token>\n\n def fast_training(self, sound):\n self.core_size = 100\n self.batch_size = 1000\n self.Epoches = 50\n self._main(sound, 100...
[ 4, 6, 9, 10, 12 ]
class ChartType: Vanilla = "Vanilla" Neopolitan = "Neopolitan"
normal
{ "blob_id": "451a36eb205a269a05e3b3d89541278633d12aaa", "index": 9781, "step-1": "<mask token>\n", "step-2": "class ChartType:\n <mask token>\n <mask token>\n", "step-3": "class ChartType:\n Vanilla = 'Vanilla'\n Neopolitan = 'Neopolitan'\n", "step-4": "\n\nclass ChartType:\n Vanilla = \"Vanil...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(config, resume, infile, outfile, sigma, dur, half): model = get_instance(module_arch, 'arch', config) model.summary() checkpoint = torch.load(resume) state_dict = checkpoint['state_dict'] if config['...
flexible
{ "blob_id": "a2421a8673a524c32539555596711a71a8e00dbf", "index": 439, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(config, resume, infile, outfile, sigma, dur, half):\n model = get_instance(module_arch, 'arch', config)\n model.summary()\n checkpoint = torch.load(resume)\n state...
[ 0, 1, 2, 3, 4 ]
import numpy as np import os import sys file_path = sys.argv[1] triplets = np.loadtxt(os.path.join(file_path, "kaggle_visible_evaluation_triplets.txt"), delimiter="\t", dtype="str") enum_users = np.ndenumerate(np.unique(triplets[:, 0])) print(enum_users) triplets[triplets[:, 0] == user...
normal
{ "blob_id": "f3d9e783491916e684cda659afa73ce5a6a5894a", "index": 4063, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(enum_users)\n<mask token>\nprint(triplets)\n", "step-3": "<mask token>\nfile_path = sys.argv[1]\ntriplets = np.loadtxt(os.path.join(file_path,\n 'kaggle_visible_evaluation_trip...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ConcurrentExecutor: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def run_io_func_sync(self, func, args=(), kwargs=None): """ :param func: callable :param args: free params :param kwargs: named...
flexible
{ "blob_id": "24b1afb18e1cfdc8d5a62f5ee0147b2d73bc10d8", "index": 7492, "step-1": "<mask token>\n\n\nclass ConcurrentExecutor:\n <mask token>\n <mask token>\n <mask token>\n\n def run_io_func_sync(self, func, args=(), kwargs=None):\n \"\"\"\n :param func: callable\n :param args: f...
[ 3, 6, 8, 10, 11 ]
#! /usr/local/bin/python3 # -*- coding: utf-8 -*- from requests_oauthlib import OAuth1Session BASEURL = 'https://api.twitter.com/1.1/' CK = '3rJOl1ODzm9yZy63FACdg' CS = '5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8' AT = '333312023-6dTniMxvwlQG8bATKNYWBXaQkftz9t4ZjRBt7BWk' AS = 'LQ8xXBTTN8F8CHQv9oDAqsGJFeexdnFf2DFzn3E...
normal
{ "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 ]
<|reserved_special_token_0|> def error(msg): __log_internal(ERROR_FILE, msg) def info(msg): __log_internal(LOG_FILE, msg) def __log_internal(filename, msg): now = datetime.datetime.now() f = open(filename, 'a+') f.write('{} : {}\n'.format(now.strftime('%Y-%m-%d %H:%M:%S'), msg)) f.close() ...
flexible
{ "blob_id": "0475c6cab353f0d23a4c4b7f78c1b47ecc5f8d3b", "index": 4819, "step-1": "<mask token>\n\n\ndef error(msg):\n __log_internal(ERROR_FILE, msg)\n\n\ndef info(msg):\n __log_internal(LOG_FILE, msg)\n\n\ndef __log_internal(filename, msg):\n now = datetime.datetime.now()\n f = open(filename, 'a+')\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @api_view(['GET']) def artifact_save_recommend(request, pageNo): artifact_url = ( f'http://www.emuseum.go.kr/openapi/relic/list?serviceKey={service_key}&numOfRows=100&pageNo={pageNo}' ) response = request...
flexible
{ "blob_id": "707e3e60d6d9a3db5b9bc733e912b34e2cec5974", "index": 8585, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET'])\ndef artifact_save_recommend(request, pageNo):\n artifact_url = (\n f'http://www.emuseum.go.kr/openapi/relic/list?serviceKey={service_key}&numOfRows=100&p...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @app.route('/') def showMachineList(): return render_template('list.html') @app.route('/insert_records', methods=['POST']) def insert_records(): json_data = request.json['info'] nome = json_data['nome'] email = json_data['email'] telefone = json_data['telefone'] ...
flexible
{ "blob_id": "05ca16303d0eb962249793164ac91795c45cc3c2", "index": 9974, "step-1": "<mask token>\n\n\n@app.route('/')\ndef showMachineList():\n return render_template('list.html')\n\n\n@app.route('/insert_records', methods=['POST'])\ndef insert_records():\n json_data = request.json['info']\n nome = json_d...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def makeMnistModel(): mnist = tf.keras.datasets.mnist (X_train, y_train), (_, _) = mnist.load_data() X_train = X_train / 255.0 model = tf.keras.models.Sequential([tf.keras.layers.Flatten(input_shape =(28,...
flexible
{ "blob_id": "1555583cd3d8938cbaeeac2d1f74bb9c3858f26d", "index": 4207, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef makeMnistModel():\n mnist = tf.keras.datasets.mnist\n (X_train, y_train), (_, _) = mnist.load_data()\n X_train = X_train / 255.0\n model = tf.keras.models.Sequential([...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> connection.open() print('list of hbase tables {}'.format(connection.tables())) <|reserved_special_token_0|> for key, data in customers.scan(): keys.append(key) data_list.append(data) <|reserved_special_token_0|> print('len...
flexible
{ "blob_id": "7b38c64174656d1c4ec2b0541e6ed8d6680af7d7", "index": 9565, "step-1": "<mask token>\n", "step-2": "<mask token>\nconnection.open()\nprint('list of hbase tables {}'.format(connection.tables()))\n<mask token>\nfor key, data in customers.scan():\n keys.append(key)\n data_list.append(data)\n<mask ...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.0.10 on 2020-12-19 15:07 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ("wagtailadmin", "0001_create_admin_access_permissions"), ] operations = [ migrations.CreateModel( name="Admi...
normal
{ "blob_id": "52a4213a1729e25f96faebc5fd4f299017446c5a", "index": 6370, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ModelInterface(ProtoSerializable): def reset(self): raise NotImplementedError() pass def run(self): raise NotImplementedError() def stop(self): raise NotImplementedError() @property def abstract_timestamp(self): raise N...
flexible
{ "blob_id": "501b8a9307a1fd65a5f36029f4df59bbe11d881a", "index": 6591, "step-1": "<mask token>\n\n\nclass ModelInterface(ProtoSerializable):\n\n def reset(self):\n raise NotImplementedError()\n pass\n\n def run(self):\n raise NotImplementedError()\n\n def stop(self):\n raise ...
[ 9, 10, 13, 14, 16 ]
# -*- coding: utf-8 -*- import time import datetime def get_second_long(time_str=None): if time_str is None: return long(time.time()) time_array = time.strptime(time_str, "%Y-%m-%d %H:%M:%S") return long(time.mktime(time_array)) def get_curtime_str(): return datetime.datetime.now() def ge...
normal
{ "blob_id": "e735529eddd3a46ea335e593e5937558b50b142d", "index": 2276, "step-1": "<mask token>\n\n\ndef get_second_long(time_str=None):\n if time_str is None:\n return long(time.time())\n time_array = time.strptime(time_str, '%Y-%m-%d %H:%M:%S')\n return long(time.mktime(time_array))\n\n\n<mask t...
[ 7, 9, 10, 11, 14 ]
containerized: "docker://quay.io/snakemake/containerize-testimage:1.0" rule a: output: "test.out" conda: "env.yaml" shell: "bcftools 2> {output} || true"
normal
{ "blob_id": "6e0d09bd0c9d1d272f727817cec65b81f83d02f5", "index": 6742, "step-1": "containerized: \"docker://quay.io/snakemake/containerize-testimage:1.0\"\n\nrule a:\n output:\n \"test.out\"\n conda:\n \"env.yaml\"\n shell:\n \"bcftools 2> {output} || true\"\n", "step-2": null, ...
[ 0 ]
import random import Manhattan_segmental_dist # Greedy # s: dictionary of points # k: number of medoids # returns # k medoids from sample set s def greedy(s, k): # print("Hello Word!") m_1 = random.choice(list(s.keys())) medoids = {m_1: s[m_1]} dimensions = list(range(len(s[m_1]))) s.pop(m_1...
normal
{ "blob_id": "9a02bd0bc14494db033c032003aa5baea111ea8c", "index": 7185, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef greedy(s, k):\n m_1 = random.choice(list(s.keys()))\n medoids = {m_1: s[m_1]}\n dimensions = list(range(len(s[m_1])))\n s.pop(m_1)\n dist = {}\n for x in s:\n ...
[ 0, 1, 2, 3 ]
import datetime import json import logging import requests from lib.crits.exceptions import CRITsOperationalError from lib.crits.vocabulary.indicators import IndicatorThreatTypes as itt from lib.crits.vocabulary.indicators import IndicatorAttackTypes as iat log = logging.getLogger() class CRITsAPI(): def __init...
normal
{ "blob_id": "a505cc0e382554d65447a3fe3a56fac43c1964f2", "index": 8133, "step-1": "<mask token>\n\n\nclass CRITsAPI:\n <mask token>\n\n def get_object(self, obj_id, obj_type):\n type_trans = self._type_translation(obj_type)\n get_url = '{}/{}/{}/'.format(self.url, type_trans, obj_id)\n ...
[ 6, 7, 8, 9, 11 ]
#!/usr/bin/env python #pylint: skip-file """ HostApi.py Copyright 2016 Cisco Systems 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...
normal
{ "blob_id": "4243c863827f1378c364171ca7d8fdabd42be22f", "index": 3625, "step-1": "<mask token>\n\n\nclass HostApi(object):\n <mask token>\n <mask token>\n <mask token>\n\n def getHostById(self, **kwargs):\n \"\"\"Retrieves host based on id\n\n Args:\n\n id, str: Host Id (requ...
[ 2, 4, 5, 6, 7 ]
for t in range(int(input())): st = list(input()) N, j = len(st), 1 for i in range(N // 2): if st[i] == '*' or st[-i - 1] == '*': break elif st[i] != st[-i - 1]: j = 0 break print('#{} Exist'.format(t + 1)) if j else print('#{} Not exist'.format ...
normal
{ "blob_id": "21d499555b4bc4944996a57ae544a56aa317b00b", "index": 4386, "step-1": "<mask token>\n", "step-2": "for t in range(int(input())):\n st = list(input())\n N, j = len(st), 1\n for i in range(N // 2):\n if st[i] == '*' or st[-i - 1] == '*':\n break\n elif st[i] != st[-i ...
[ 0, 1 ]
<|reserved_special_token_0|> def extract_title(page): return page.find('header').find('h1').contents[0] def extract_colours(page): color_list = page.find('ul') return list(dict.fromkeys(re.findall('#\\w+', str(color_list.contents)))) def get_colours_from_page(browser, baseurl, target_page): respon...
flexible
{ "blob_id": "9fd33089a9dc919ef2fb2698059e60a24a0e05e6", "index": 6118, "step-1": "<mask token>\n\n\ndef extract_title(page):\n return page.find('header').find('h1').contents[0]\n\n\ndef extract_colours(page):\n color_list = page.find('ul')\n return list(dict.fromkeys(re.findall('#\\\\w+', str(color_list...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class PddMallGoodsSpider(scrapy.Spider): <|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 start_re...
flexible
{ "blob_id": "f33190df35a6b0b91c4dd2d6a58291451d06e29a", "index": 3529, "step-1": "<mask token>\n\n\nclass PddMallGoodsSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n mall...
[ 3, 4, 5, 9, 10 ]
import pandas as pd dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [ 7, 8, 9], 'c3': [10, 11, 12], 'c4': [13, 14, 15]} df = pd.DataFrame(dict_data) print(type(df)) print('\n') print(df) # <class 'pandas.core.frame.DataFrame'> # c0 c1 c2 c3 c4 # 0 1 4 7 10 13 # 1 2 5 8 11 14 # 2 ...
normal
{ "blob_id": "22f4ae755e7ea43604db39452ca80f44f540708a", "index": 9503, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(type(df))\nprint('\\n')\nprint(df)\n", "step-3": "<mask token>\ndict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [7, 8, 9], 'c3': [10, \n 11, 12], 'c4': [13, 14, 15]}\ndf =...
[ 0, 1, 2, 3, 4 ]
"""Encoder module of Monodepth2 Code partially borrowed from https://github.com/nianticlabs/monodepth2/blob/master/networks/resnet_encoder.py """ from __future__ import absolute_import, division, print_function import os import numpy as np import mxnet as mx from mxnet.gluon import nn from mxnet.context import cpu fr...
normal
{ "blob_id": "62601eca767800f00b461ef46d72bddc5cf75de0", "index": 1400, "step-1": "<mask token>\n\n\nclass ResnetEncoder(nn.HybridBlock):\n <mask token>\n\n def __init__(self, backbone, pretrained, num_input_images=1, root=os.\n path.join(os.path.expanduser('~'), '.mxnet/models'), ctx=cpu(), **\n ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python from math import factorial F = [factorial(i) for i in range(10)] #F[9] * 8 = 2903040 > this means no 8 digit numbers #F[9] * 7 = 2540160 < this is the maximum that I could think of total = 0 for i in xrange(10, 2540160): if sum([F[int(d)] for d in str(i)]) == i: total = total + i p...
normal
{ "blob_id": "d2e8c95dc144aa83128cc815ad145982f64b1819", "index": 3206, "step-1": "#!/usr/bin/env python\n\nfrom math import factorial\n\nF = [factorial(i) for i in range(10)]\n#F[9] * 8 = 2903040 > this means no 8 digit numbers\n#F[9] * 7 = 2540160 < this is the maximum that I could think of\n\ntotal = 0\nfor i ...
[ 0 ]
#coding=utf-8 ''' find words and count By @liuxingpuu ''' import re fin= open("example","r") fout = open("reuslt.txt","w") str=fin.read() reObj = re.compile("\b?([a-zA-Z]+)\b?") words = reObj.findall(str) word_dict={} for word in words: if(word_dict.has_key(word)): word_dict[word.lower()]=max(word_dict[wor...
normal
{ "blob_id": "addab37cb23abead2d9f77a65336cd6026c52c68", "index": 8559, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in words:\n if word_dict.has_key(word):\n word_dict[word.lower()] = max(word_dict[word.lower()], words.count(\n word.lower()) + words.count(word.upper()) + w...
[ 0, 1, 2, 3, 4 ]
import httplib import sys http_server = "localhost:8000" connection = httplib.HTTPConnection(http_server) # Open test input. test_file_path = "test_input" test_f = open(test_file_path) inputs = test_f.readlines() inputs = [x.strip() for x in inputs] test_f.close() # Open expected input. expected_file_path = "expect...
normal
{ "blob_id": "cd9b04a93d85ba0ee2a38b534386f9aec0ef6895", "index": 5165, "step-1": "<mask token>\n", "step-2": "<mask token>\ntest_f.close()\n<mask token>\nexpected_f.close()\nassert len(inputs) == len(expecteds)\nfor i in range(len(inputs)):\n connection.request('GET', '<start>%s<end>' % inputs[i])\n resp...
[ 0, 1, 2, 3, 4 ]
from __future__ import absolute_import from builtins import str from builtins import object import unittest import sys, os, re import forcebalance import abc import numpy from __init__ import ForceBalanceTestCase class TestImplemented(ForceBalanceTestCase): def test_implemented_targets_derived_from_target(self): ...
normal
{ "blob_id": "f91e1fdc31b2fe1aef15757576d847c617a86201", "index": 1121, "step-1": "<mask token>\n\n\nclass TestBromineObjective(ForceBalanceTestCase, ObjectiveTests):\n\n def setUp(self):\n self.options = forcebalance.parser.gen_opts_defaults.copy()\n self.options.update({'root': os.getcwd() + '/...
[ 2, 11, 12, 15, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> version = 2, 5, 8 version_string = '.'.join(str(v) for v in version) release_date = '2015.12.27' <|reserved_special_token_1|> version = (2, 5, 8) version_string = ".".join(str(v) for v in version) release_date = "2015.12.27"
flexible
{ "blob_id": "28077af0759e062078f7b9d1f7bbbb93c62835cb", "index": 5063, "step-1": "<mask token>\n", "step-2": "version = 2, 5, 8\nversion_string = '.'.join(str(v) for v in version)\nrelease_date = '2015.12.27'\n", "step-3": "version = (2, 5, 8)\nversion_string = \".\".join(str(v) for v in version)\n\nrelease_...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Sort(a): i = 1 n = len(a) while i < len(a): j = i print(i - 1, '\t', i) while a[j - 1] > a[j] and j >= 0: j -= 1 print('Key : ', a[i], ' inserting at: ', j, '\t in ', a...
flexible
{ "blob_id": "3f8b8b8cfbe712f09734d0fb7302073187d65a73", "index": 982, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Sort(a):\n i = 1\n n = len(a)\n while i < len(a):\n j = i\n print(i - 1, '\\t', i)\n while a[j - 1] > a[j] and j >= 0:\n j -= 1\n pr...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def findFirst(arr, l, h, x): if l > h: return -1 mid = (l + h) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return findFirst(arr, l, mid - 1, x) return findFirst(arr, mid + 1, h, x) <|reserved_special_toke...
flexible
{ "blob_id": "b4783540224902b10088edbd038d6d664934a237", "index": 4893, "step-1": "<mask token>\n", "step-2": "def findFirst(arr, l, h, x):\n if l > h:\n return -1\n mid = (l + h) // 2\n if arr[mid] == x:\n return mid\n elif arr[mid] > x:\n return findFirst(arr, l, mid - 1, x)\n...
[ 0, 1, 2, 3 ]
import os import pytest from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver import Firefox from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.comm...
normal
{ "blob_id": "b6e28f29edd0c4659ab992b45861c4c31a57e7fd", "index": 8920, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_gecko_driver():\n home_dir = os.getenv('HOME')\n return Firefox(executable_path=os.path.join(home_dir, 'bin', 'geckodriver')\n )\n\n\n@pytest.fixture\ndef driv...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class UserManager: <|reserved_special_token_0|> def validate_user(self, user_name, password): user = self.find_user(user_name) if not user: raise ClientError() self.validate_password(user, password) return user <|reserved_special_to...
flexible
{ "blob_id": "210199ed217db0d7a05e280f20e33496c0795f06", "index": 9472, "step-1": "<mask token>\n\n\nclass UserManager:\n <mask token>\n\n def validate_user(self, user_name, password):\n user = self.find_user(user_name)\n if not user:\n raise ClientError()\n self.validate_pas...
[ 11, 17, 19, 21, 27 ]
from os.path import basename from .FileInfo import FileInfo class mrk_file(FileInfo): """ .mrk specific file container. """ def __init__(self, id_=None, file=None, parent=None): super(mrk_file, self).__init__(id_, file, parent) self._type = '.mrk' #region class methods def __get...
normal
{ "blob_id": "8e9aec7d3653137a05f94e4041d28f3423122751", "index": 3990, "step-1": "<mask token>\n\n\nclass mrk_file(FileInfo):\n <mask token>\n\n def __init__(self, id_=None, file=None, parent=None):\n super(mrk_file, self).__init__(id_, file, parent)\n self._type = '.mrk'\n <mask token>\n\...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': exit(cli.main(prog_name='htmap')) <|reserved_special_token_1|> from .cli import cli if __name__ == '__main__': exit(cli.main(prog_name='htmap')) <|reserved_special_token_1|> from .cli impor...
flexible
{ "blob_id": "069338b188f3cf16357b2502cbb3130b69918bd9", "index": 286, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n exit(cli.main(prog_name='htmap'))\n", "step-3": "from .cli import cli\nif __name__ == '__main__':\n exit(cli.main(prog_name='htmap'))\n", "step-4": "...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def dfs(i): if temp[i]: return temp[i] = True if i in odd: for j in graph[i]: even.add(j) dfs(j) else: for j in graph[i]: odd.add(j) dfs(j) <|reserved_special_token_0|> <|reserved_special_token_1|>...
flexible
{ "blob_id": "bab6b9a0178da119f753deb6c626dd5c41db2bdd", "index": 2004, "step-1": "<mask token>\n\n\ndef dfs(i):\n if temp[i]:\n return\n temp[i] = True\n if i in odd:\n for j in graph[i]:\n even.add(j)\n dfs(j)\n else:\n for j in graph[i]:\n odd.a...
[ 1, 2, 3, 4, 5 ]
# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8 from django.contrib.auth.decorators import login_required from django.contrib.auth import models as auth_models from django.contrib.auth import forms as auth_forms from django.contrib.auth import authenticate, login from django.core.urlresolvers i...
normal
{ "blob_id": "22da05d9bf6139a0306bfb2d1df96e9e2cf6a0c6", "index": 475, "step-1": "<mask token>\n\n\n@login_required\ndef get_verification_code(request):\n \"\"\"Maybe ajaxify this in the future\n \"\"\"\n if request.user.get_profile().is_verified:\n messages.info(request, 'Olet jo vahvistanut osoi...
[ 1, 2, 3, 4, 5 ]
import tkinter as tk # Import tkinker for GUI creation from PIL import Image, ImageTk # Allow images to be used as backgrounds import socket # Importing sockets for low level implementation of networks import select # Importing select to poll between the user input and received message import sys # Getting inp...
normal
{ "blob_id": "5e17299e6a409e433e384935a815bab6ce178ff5", "index": 3031, "step-1": "<mask token>\n\n\ndef sigint_handler(signum, frame):\n print('\\n Disconnecting from server')\n sys.exit()\n\n\n<mask token>\n\n\ndef sendUsernameToServer(username_entry):\n username = username_entry.encode('utf-8')\n u...
[ 4, 5, 6, 7, 9 ]
# Copyright (C) 2011 Ruckus Wireless, Inc. All rights reserved. # Please make sure the following module docstring is accurate since it will be used in report generation. """ Description: @author: Chris Wang @contact: cwang@ruckuswireless.com @since: Aug-09, 2010 Prerequisite (Assumptions about the sta...
normal
{ "blob_id": "25288a6dd0552d59f8c305bb8edbbbed5d464d5b", "index": 9997, "step-1": "# Copyright (C) 2011 Ruckus Wireless, Inc. All rights reserved.\n# Please make sure the following module docstring is accurate since it will be used in report generation.\n\n\"\"\"\n Description: \n @author: Chris Wang\n @con...
[ 0 ]
<|reserved_special_token_0|> class SideEnum(str, Enum): BUY = 'B' SELL = 'S' class BaseClient: def __init__(self, client: 'StakeClient'): self._client = weakref.proxy(client) <|reserved_special_token_1|> <|reserved_special_token_0|> if TYPE_CHECKING: from stake.client import StakeClient ...
flexible
{ "blob_id": "f13ccbfb27788deca0d4f4b58a4e9e8c7e8e0306", "index": 1644, "step-1": "<mask token>\n\n\nclass SideEnum(str, Enum):\n BUY = 'B'\n SELL = 'S'\n\n\nclass BaseClient:\n\n def __init__(self, client: 'StakeClient'):\n self._client = weakref.proxy(client)\n", "step-2": "<mask token>\nif TY...
[ 4, 5, 6, 7, 8 ]
# # @lc app=leetcode id=67 lang=python3 # # [67] Add Binary # # https://leetcode.com/problems/add-binary/description/ # # algorithms # Easy (46.70%) # Likes: 2566 # Dislikes: 331 # Total Accepted: 572.1K # Total Submissions: 1.2M # Testcase Example: '"11"\n"1"' # # Given two binary strings a and b, return their ...
normal
{ "blob_id": "227a56c970a74d515ab694d2c0924885e2209cfe", "index": 7089, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def addBinary(self, a: str, b: str) ->str:\n if len(a) < len(b):\n a = '0' * (len(b) - len(a)) + a\n e...
[ 0, 1, 2, 3 ]
import csv import Feature_extraction as urlfeature import trainer as tr import warnings warnings.filterwarnings("ignore") def resultwriter(feature, output_dest): flag = True with open(output_dest, 'w') as f: for item in feature: w = csv.DictWriter(f, item[1].keys()) if flag: ...
normal
{ "blob_id": "9d190face528d1a237f4c92bfb94a399f61a5af2", "index": 9317, "step-1": "<mask token>\n\n\ndef resultwriter(feature, output_dest):\n flag = True\n with open(output_dest, 'w') as f:\n for item in feature:\n w = csv.DictWriter(f, item[1].keys())\n if flag:\n ...
[ 4, 5, 6, 7, 8 ]
from trac.db import DatabaseManager def do_upgrade(env, ver, cursor): """Change schema name from taskboard_schema to agiletools_version """ cursor.execute('UPDATE system SET name=%s WHERE name=%s', ("agiletools_version", "taskboard_schema"))
normal
{ "blob_id": "56ed5bb22d77f4d8c061f97d832a60ed9a106549", "index": 5231, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef do_upgrade(env, ver, cursor):\n \"\"\"Change schema name from taskboard_schema to agiletools_version\n \"\"\"\n cursor.execute('UPDATE system SET name=%s WHERE name=%s', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def dir_create(path): """创造新的文件夹。 :param path: 文件夹路径 :return: """ if os.path.exists(path) and os.listdir(path) != []: shutil.rmtree(path) os.makedirs(path) if not os.path.exists(path): os.makedirs(path) def read_dicom(path): """读取一个病例...
flexible
{ "blob_id": "4905b820f33619a80a9915d0603bc39e0d0368d9", "index": 6175, "step-1": "<mask token>\n\n\ndef dir_create(path):\n \"\"\"创造新的文件夹。\n\n :param path: 文件夹路径\n :return:\n \"\"\"\n if os.path.exists(path) and os.listdir(path) != []:\n shutil.rmtree(path)\n os.makedirs(path)\n i...
[ 7, 8, 9, 10, 11 ]
import operator def group_by_owners(files): print(files, type(files)) for k, v in files.items(): # for v in k: print(k, v) # if k[v] == k[v]: # print("same", v) for f in files: print(f[0]) for g in v: print(g) _files = sorted(files.items(...
normal
{ "blob_id": "4843239a41fe1ecff6c8c3a97aceef76a3785647", "index": 7334, "step-1": "<mask token>\n\n\ndef group_by_owners(files):\n print(files, type(files))\n for k, v in files.items():\n print(k, v)\n for f in files:\n print(f[0])\n for g in v:\n print(g)\n _files = so...
[ 1, 2, 3, 4, 5 ]
""" Urls for CAE_Web Audio_Visual app. """ from django.conf.urls import url from . import views app_name = 'cae_web_audio_visual' urlpatterns = [ ]
normal
{ "blob_id": "5debc97e99bbd78b17e545896d718d4b0eac8519", "index": 2430, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'cae_web_audio_visual'\nurlpatterns = []\n", "step-3": "<mask token>\nfrom django.conf.urls import url\nfrom . import views\napp_name = 'cae_web_audio_visual'\nurlpatterns = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.set_printoptions(suppress=True) <|reserved_special_token_0|> for image in path: n1 = cv2.imread(image) n2 = cv2.resize(n1, (244, 244)) images.append(n2) print(image) <|reserved_special_token_0|> if prediction[0]...
flexible
{ "blob_id": "13b69ec61d6b2129f1974ce7cae91c84100b3b58", "index": 449, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.set_printoptions(suppress=True)\n<mask token>\nfor image in path:\n n1 = cv2.imread(image)\n n2 = cv2.resize(n1, (244, 244))\n images.append(n2)\n print(image)\n<mask token>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with alive_bar(100) as bar: for i in range(100): sleep(0.03) bar() with alive_bar(200, bar='bubbles', spinner='notes2') as bar: for i in range(200): sleep(0.03) ...
flexible
{ "blob_id": "06f961c07695d1c312cb943afbfa64508a709c7e", "index": 1076, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith alive_bar(100) as bar:\n for i in range(100):\n sleep(0.03)\n bar()\n with alive_bar(200, bar='bubbles', spinner='notes2') as bar:\n for i in range...
[ 0, 1, 2, 3 ]
# Ejercicio 28 - Hoja VI (5) - Indicar la nota ponderada según el criterio dado # (parte teórica 60%, práctica 40%) de cada uno de un número determinado de alumnos numalumnos=int(input("Introduce el número total de alumnos:\n")) print("Usa el punto '.' para los decimales") for contador in range(1,numalumnos+1): ...
normal
{ "blob_id": "f2056ff46ce6e38c3b6ca553bbdec7f59d60b198", "index": 1417, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"Usa el punto '.' para los decimales\")\nfor contador in range(1, numalumnos + 1):\n print(f'\\nDatos del alumno número {contador} de {numalumnos}:')\n teorica = float(input(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def uppercase_first_letter(string: str) ->str: return string[0:1].upper() + string[1:] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def uppercase_first_letter(string: str) ->s...
flexible
{ "blob_id": "0555c577a8fb746cf2debb929d02b46cd3be4d7b", "index": 1062, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef uppercase_first_letter(string: str) ->str:\n return string[0:1].upper() + string[1:]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef uppercase_first_letter(string: str...
[ 0, 1, 2, 3 ]
from quantopian.algorithm import order_optimal_portfolio from quantopian.algorithm import attach_pipeline, pipeline_output from quantopian.pipeline import Pipeline from quantopian.pipeline.data.builtin import USEquityPricing from quantopian.pipeline.factors import SimpleMovingAverage from quantopian.pipeline.filters im...
normal
{ "blob_id": "c447d1fe38a4af43de39e05d46dacbe88249d427", "index": 3654, "step-1": "<mask token>\n\n\ndef compute_target_weights(context, data):\n \"\"\"\n Compute ordering weights.\n \"\"\"\n weights = {}\n if context.longs:\n long_weight = 0.5 / len(context.longs)\n if context.shorts:\n ...
[ 1, 2, 4, 6, 7 ]
import re IS_WITH_SINGLETON_REGEX = re.compile("(!=|==)\s*(True|False|None)") def check_is_with_singleton(physical_line, line_number): match_obj = IS_WITH_SINGLETON_REGEX.search(physical_line) if match_obj is not None: offset = match_obj.span()[0] return (0, 12, (line_number, offset), "Use eq...
normal
{ "blob_id": "cf6d3a0fbf2a2daf8432622f780e138784ec505d", "index": 8300, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_is_with_singleton(physical_line, line_number):\n match_obj = IS_WITH_SINGLETON_REGEX.search(physical_line)\n if match_obj is not None:\n offset = match_obj.span...
[ 0, 1, 2, 3, 4 ]
from __future__ import print_function from itertools import permutations s, space, k = raw_input().partition(' ') for t in sorted(list(permutations(s, int(k)))): print(*t, sep='')
normal
{ "blob_id": "37580939a0e58bdffb8cfad8252f339a7da4446e", "index": 1130, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor t in sorted(list(permutations(s, int(k)))):\n print(*t, sep='')\n", "step-3": "<mask token>\ns, space, k = raw_input().partition(' ')\nfor t in sorted(list(permutations(s, int(k)...
[ 0, 1, 2, 3 ]
def get_ecgs_by_query(json_data, query): ecgs_ids = [] for case_id in json_data.keys(): print(case_id) if query.is_query_ok(json_data[case_id]): ecgs_ids.append(case_id) return ecgs_ids def save_new_dataset_by_ids(old_json, ecg_ids_to_save, name_new_dataset): """ Saves...
normal
{ "blob_id": "445ae195edfe9fe9ee58c6c5a14ec787719d698c", "index": 7454, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save_new_dataset_by_ids(old_json, ecg_ids_to_save, name_new_dataset):\n \"\"\"\n Saves json only with selected (by id) patients.\n :param old_json: initail dataset dict\n...
[ 0, 1, 2, 3 ]
# Lahman.py # Convert to/from web native JSON and Python/RDB types. import json # Include Flask packages from flask import Flask from flask import request import copy import SimpleBO # The main program that executes. This call creates an instance of a # class and the constructor starts the runtime. app = Flask(__na...
normal
{ "blob_id": "d03a8076b77851ae4df5cf657ff898eb132c49c3", "index": 5616, "step-1": "<mask token>\n\n\ndef parse_and_print_args():\n fields = None\n in_args = None\n if request.args is not None:\n in_args = dict(copy.copy(request.args))\n fields = copy.copy(in_args.get('fields', None))\n ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while x <= 24: if x % 5 == 0: x = x + 1 continue print(x) x = x + 1 <|reserved_special_token_1|> x = 1 while x <= 24: if x % 5 == 0: x = x + 1 continue print(x) x = x + 1
flexible
{ "blob_id": "61cfc583cd87ac0528cb07f4e051392167414920", "index": 1960, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile x <= 24:\n if x % 5 == 0:\n x = x + 1\n continue\n print(x)\n x = x + 1\n", "step-3": "x = 1\nwhile x <= 24:\n if x % 5 == 0:\n x = x + 1\n ...
[ 0, 1, 2 ]
"""A number can be broken into different contiguous sub-subsequence parts. Suppose, a number 3245 can be broken into parts like 3 2 4 5 32 24 45 324 245. And this number is a COLORFUL number, since product of every digit of a contiguous subsequence is different """ def colorful(A): sA = str(A) len_sA = len(s...
normal
{ "blob_id": "41013469e65e45f6c909d66c2a54eaf11dfd474c", "index": 3077, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef colorful(A):\n sA = str(A)\n len_sA = len(sA)\n if len_sA == 1:\n return 1\n dig_list = []\n for i in range(len_sA):\n for j in range(i, len_sA):\n ...
[ 0, 1, 2, 3 ]
run=[] #Creating a empty list no_players=int(input("enter the number of the players in the team :")) for i in range (no_players): run_score=int(input("Enter the runs scored by the player "+str(i+1)+":")) run.append(run_score) #code for the average score of the team def average(run): print("________...
normal
{ "blob_id": "3d7ca468a1f7aa1602bff22167e9550ad515fa79", "index": 4777, "step-1": "<mask token>\n\n\ndef average(run):\n print('____________________________________')\n sum = 0\n for i in range(0, len(run)):\n sum += run[i]\n avg = sum / len(run)\n print('Average score of the team is :',...
[ 4, 5, 6, 7, 8 ]
#Las listas son similares a las tuplas # con la diferencia de que permiten modificar los datos una vez creados miLista = ['cadena', 21, 2.8, 'nuevo dato', 25] print (miLista) miLista[2] = 3.8 #el tercer elemento ahora es 3.8 print(miLista) miLista.append('NuevoDato') print(miLista)
normal
{ "blob_id": "27ec06d084bf819383801be0351c04e7d1fc1752", "index": 5176, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(miLista)\n<mask token>\nprint(miLista)\nmiLista.append('NuevoDato')\nprint(miLista)\n", "step-3": "miLista = ['cadena', 21, 2.8, 'nuevo dato', 25]\nprint(miLista)\nmiLista[2] = 3....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_swap(): cds = np.load('h3o_data/ffinal_h3o.npy') dws = np.load('h3o_data/ffinal_h3o_dw.npy') cds = cds[:10] a = symm.swap_two_atoms(cds, dws, atm_1=1, atm_2=2) b = symm.swap_group(cds, dws, atm_list_...
flexible
{ "blob_id": "4ecd756b94b0cbab47a8072e9bccf26e2dd716d0", "index": 7833, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_swap():\n cds = np.load('h3o_data/ffinal_h3o.npy')\n dws = np.load('h3o_data/ffinal_h3o_dw.npy')\n cds = cds[:10]\n a = symm.swap_two_atoms(cds, dws, atm_1=1, atm...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def getNativeBlockNum(n, k): """Get number of native blocks.""" return k * (n - k) <|reserved_special_token_0|> def getNodeIdList(n, k): """Find the node id for a segment of blocks.""" """Return a list of node id for the blocks.""" nodeidList = [] segmentSize =...
flexible
{ "blob_id": "0ebd19079a16a6e3da34da2ecfda0d159b8580b2", "index": 9527, "step-1": "<mask token>\n\n\ndef getNativeBlockNum(n, k):\n \"\"\"Get number of native blocks.\"\"\"\n return k * (n - k)\n\n\n<mask token>\n\n\ndef getNodeIdList(n, k):\n \"\"\"Find the node id for a segment of blocks.\"\"\"\n \"...
[ 10, 12, 13, 15, 16 ]
<|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": "fa045ccd4e54332f6c05bf64e3318e05b8123a10", "index": 3317, "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 = [('notificatio...
[ 0, 1, 2, 3, 4 ]
""" Auteur:Fayçal Chena Date : 07 avril 2020 Consignes : Écrire une fonction alea_dice(s) qui génère trois nombres (pseudo) aléatoires à l’aide de la fonction randint du module random, représentant trois dés (à six faces avec les valeurs de 1 à 6), et qui renvoie la valeur booléenne True si les dés forment un 421, et l...
normal
{ "blob_id": "ad5a9e353d065eee477381aa6b1f233f975ea0ed", "index": 3374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef foo_6(x, y):\n return y, x\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef foo_6(x, y):\n return y, x\n\n\n<mask token>\nfoo_6(a, b)\nprint(a, b)\n", "step-4": "<...
[ 0, 1, 2, 3, 4 ]
from subprocess import check_output import json import datetime date = datetime.datetime.now() mo = date.month day = date.day year = date.year str = '{0}-{1}-{2}'.format(mo, day, year) instances = json.loads(check_output("aws lightsail get-instances", shell=True)) inst_names = [] inst_dict = {} for instance in instan...
normal
{ "blob_id": "2023e0b749338488e63cbbb475b7a915bccccce0", "index": 7531, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor instance in instances['instances']:\n inst_names.append(instance['name'])\n inst_dict[instance['name']] = []\nprint(inst_names)\n<mask token>\nfor snapshot in snapshots['instanc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class GlibConan(ConanFile): <|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 build(self): ...
flexible
{ "blob_id": "e49c5c6475a1210a9657d7bbd0490c8d20863718", "index": 2285, "step-1": "<mask token>\n\n\nclass GlibConan(ConanFile):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build(self):\n args = ['--disable-static'...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def executeUpgrade(): shell.executeCommand('pkg upgrade') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def executeUpgrade(): shell.executeCommand('pkg upgrade') <|reserved_special_token_0|> def executeFindByName(name): shell...
flexible
{ "blob_id": "db55a603615c7d896569ada84f3110dd6c0ce45f", "index": 1250, "step-1": "<mask token>\n\n\ndef executeUpgrade():\n shell.executeCommand('pkg upgrade')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef executeUpgrade():\n shell.executeCommand('pkg upgrade')\n\n\n<mask token>\n\n\ndef execute...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(D.cumsum()) print(D.rolling(2).sum()) <|reserved_special_token_1|> <|reserved_special_token_0|> D = pd.Series(range(0, 20)) print(D.cumsum()) print(D.rolling(2).sum()) <|reserved_special_token_1|> import pandas as pd D...
flexible
{ "blob_id": "7639b80c9e6e1b2e1e55a47a862c433b64168cf6", "index": 7475, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(D.cumsum())\nprint(D.rolling(2).sum())\n", "step-3": "<mask token>\nD = pd.Series(range(0, 20))\nprint(D.cumsum())\nprint(D.rolling(2).sum())\n", "step-4": "import pandas as pd\...
[ 0, 1, 2, 3, 4 ]
class subset: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class subset: def __init__(self, weight, itemSet, size, setNum): self.weight = weight self.itemSet = itemSet self.size = size self.setNum = setNum def findCover(base, arr)...
flexible
{ "blob_id": "b865c37623f405f67592d1eabc620d11ff87827e", "index": 3378, "step-1": "class subset:\n <mask token>\n\n\n<mask token>\n", "step-2": "class subset:\n\n def __init__(self, weight, itemSet, size, setNum):\n self.weight = weight\n self.itemSet = itemSet\n self.size = size\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Detector(object): <|reserved_special_token_0|> def __init__(self, prototxt, caffemodel, gpu_id, dataset='coco', scale= 600, max_size=1000, transpose=(2, 0, 1), mean=[102.9801, 115.9465, 122.7717]): if gpu_id < 0: caffe.set_mode_cpu() ...
flexible
{ "blob_id": "de12c6d78c0144978ffc651829364de16930b173", "index": 2078, "step-1": "<mask token>\n\n\nclass Detector(object):\n <mask token>\n\n def __init__(self, prototxt, caffemodel, gpu_id, dataset='coco', scale=\n 600, max_size=1000, transpose=(2, 0, 1), mean=[102.9801, 115.9465, \n 122.77...
[ 6, 7, 8, 9, 10 ]
""" Code for Alexa skill to check PB tracking """ from __future__ import print_function import traceback import requests import os import json # --------------- Helpers that build all of the responses ---------------------- def build_speechlet_response(title, output, reprompt_text, should_end_session): return {...
normal
{ "blob_id": "a5ef2adbf85b5ab80c59697340f94bc57d60952e", "index": 4463, "step-1": "<mask token>\n\n\ndef build_response(session_attributes, speechlet_response):\n return {'version': '1.0', 'sessionAttributes': session_attributes,\n 'response': speechlet_response}\n\n\ndef get_welcome_response():\n \"...
[ 9, 10, 12, 13, 14 ]
# -*- coding: utf-8 -*- import base64 import logging from decimal import Decimal import requests from django import forms from django.conf import settings from django.utils.translation import ugettext_lazy as _ from currencies.currencies import decimal_round from payments.systems import base from payments.systems.ban...
normal
{ "blob_id": "15c1db535beb115c45aeba433a946255f70fa86e", "index": 7845, "step-1": "<mask token>\n\n\nclass DepositForm(base.DepositForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def is_automatic(cls, instance):\n r...
[ 9, 10, 11, 13, 17 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # ================================================== # @Author : Copyright@Ryuchen # ================================================== from .version import VERSION __all__ = [ "VERSION" ]
normal
{ "blob_id": "d815c6e233d81dfb144442a83e6006aa4e29bfce", "index": 100, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['VERSION']\n", "step-3": "from .version import VERSION\n__all__ = ['VERSION']\n", "step-4": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# ==============================...
[ 0, 1, 2, 3 ]
from fastapi import APIRouter, Depends, status, Response from typing import List import schemas, database from sqlalchemy.orm import Session import repository.blog as blog from .oauth2 import get_current_user router = APIRouter( prefix="/blog", tags=['Blog']) @router.get('/', status_code=statu...
normal
{ "blob_id": "7fd5e83d28e919e7b94cea290c6b4db3378938b6", "index": 4600, "step-1": "<mask token>\n\n\n@router.get('/', status_code=status.HTTP_200_OK, response_model=List[\n schemas.ShowBlog])\ndef all_blog(db: Session=Depends(database.get_db), current_user: schemas.\n User=Depends(get_current_user)):\n r...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class EUDataCenter(DataCenter): <|reserved_special_token_0|> @classmethod def PRODUCTION(cls): """ This method represents the Zoho CRM Production environment in EU domain :return: An instance of Environments """ return DataCenter.Enviro...
flexible
{ "blob_id": "27c364ccf4a6703f74c95ebb386f8ced38b1eafd", "index": 4960, "step-1": "<mask token>\n\n\nclass EUDataCenter(DataCenter):\n <mask token>\n\n @classmethod\n def PRODUCTION(cls):\n \"\"\"\n This method represents the Zoho CRM Production environment in EU domain\n :return: An...
[ 4, 5, 7, 8, 9 ]
import pygame import time from menus import MainMenu from scenes import TestWorldGen from scenes import TestAnimation from scenes import TestLevel2 from scenes import MainGame import random class GameManager: def __init__(self): self.screen = pygame.display.set_mode((1280, 720), ...
normal
{ "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|> def lambda_handler(event, context): current_date = datetime.now(pytz.timezone('US/Central')) yesterday_date = current_date - timedleta(days=1) yesterday_date_string = yesterday_date.strftime('%Y-%m-%dT') dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('App...
flexible
{ "blob_id": "64d955d568a6bfec50aad36c9c4f1e36998e4d74", "index": 7467, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n current_date = datetime.now(pytz.timezone('US/Central'))\n yesterday_date = current_date - timedleta(days=1)\n yesterday_date_string = yesterday_date.strftime('%Y-%m-...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def split(string): """ Function takes input of a string and returns an array of strings the original string should be comma separated with a space after the comma in order for this function to be accurate. """ names = [] index = 0 last = 0 for letter in...
flexible
{ "blob_id": "f57490c8f4a5ba76824c3b41eb18905eb2213c23", "index": 5107, "step-1": "<mask token>\n\n\ndef split(string):\n \"\"\"\n Function takes input of a string and returns an array of strings\n the original string should be comma separated with a space after\n the comma in order for this function ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Blog) <|reserved_special_token_1|> from django.contrib import admin from pages.blog.models import Blog admin.site.register(Blog)
flexible
{ "blob_id": "534aaf8371707089522af014a93f3ff6c4f913ff", "index": 8510, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Blog)\n", "step-3": "from django.contrib import admin\nfrom pages.blog.models import Blog\nadmin.site.register(Blog)\n", "step-4": null, "step-5": null, "step-...
[ 0, 1, 2 ]
# Midterm Review Class! ''' This is a Multi line comment: ''' # Break and Continue # for i in range(10): # if i == 5: # continue # print(i) # Prints 0-4, 6-9 # # Structure # Some MCQ # Some T/F # Some short answer # # Lists # Append # remove # del # ...
normal
{ "blob_id": "3d3b77630d275f830daf9f6e0d50a77ef624521e", "index": 7139, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, 100, 10):\n print(i + 10)\n", "step-3": "# Midterm Review Class!\n\n'''\nThis is a Multi line comment:\n'''\n\n# Break and Continue\n # for i in range(10):\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def test_json_float(): assert_equals(json(1.234), '1.234') def test_json_array(): data = [1, 2, 3] assert_equals(json(data), '[1,2,3]') def test_json_array02(): data = ['bla', 1, 1.2] assert_equals(json(data), '["bla",1,1.2]') def test_json_dict(): data = {'f...
flexible
{ "blob_id": "09ce2aeccfd1f3f4f130fd79001db47485cc95c2", "index": 9891, "step-1": "<mask token>\n\n\ndef test_json_float():\n assert_equals(json(1.234), '1.234')\n\n\ndef test_json_array():\n data = [1, 2, 3]\n assert_equals(json(data), '[1,2,3]')\n\n\ndef test_json_array02():\n data = ['bla', 1, 1.2]...
[ 12, 13, 19, 22, 24 ]