code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
SSMDocumentName ='AWS-RunPowerShellScript' InstanceId = ['i-081a7260c79feb260'] Querytimeoutseconds = 3600 OutputS3BucketName = 'hccake' OutputS3KeyPrefix = 'log_' region_name ='us-east-2' aws_access_key_id ='' aws_secret_access_key ='' workingdirectory =["c:\\"] executiontimeout =["3600"]
normal
{ "blob_id": "e55fe845c18ff70ba12bb7c2db28ceded8ae9129", "index": 1580, "step-1": "<mask token>\n", "step-2": "SSMDocumentName = 'AWS-RunPowerShellScript'\nInstanceId = ['i-081a7260c79feb260']\nQuerytimeoutseconds = 3600\nOutputS3BucketName = 'hccake'\nOutputS3KeyPrefix = 'log_'\nregion_name = 'us-east-2'\naws_...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Pacman(object): <|reserved_special_token_0|> def __init__(self, mapa, neural_net): self.mapa = mapa self.pos_x = 11 self.pos_y = 17 self.vel_x = 1 self.vel_y = 0 self.isAlive = True self.Frame = 0 self.score = ...
flexible
{ "blob_id": "d3b5d87b56421940449fdef48be6da9fa650dd90", "index": 1756, "step-1": "<mask token>\n\n\nclass Pacman(object):\n <mask token>\n\n def __init__(self, mapa, neural_net):\n self.mapa = mapa\n self.pos_x = 11\n self.pos_y = 17\n self.vel_x = 1\n self.vel_y = 0\n ...
[ 7, 8, 10, 11, 12 ]
# %% import os print(os.getcwd()) # %% from TransformerModel.Model import Model from dataset.DatasetLoader import DatasetLoader import pytorch_lightning as pl from pytorch_lightning.callbacks import EarlyStopping import argparse from argparse import ArgumentParser, ArgumentTypeError # %% def run_training(arguments_...
normal
{ "blob_id": "328a03acab2a0550bea0795d22110a152db6c503", "index": 806, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_training(arguments_parser):\n data = DatasetLoader(arguments_parser)\n data.setup()\n arguments_parser.num_training_steps = len(data.train_dataloader()\n ) * ar...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CPU: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def op_ldi(self, operand_a, operand_b): self.reg[operand_a] = operand_b def op_prn(self, operan...
flexible
{ "blob_id": "58d144b2c6c307719cef0b5097945c8206135ccf", "index": 6048, "step-1": "<mask token>\n\n\nclass CPU:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def op_ldi(self, operand_a, operand_b):\n self.reg[operand_a] = operand_b\n\n def op_prn(self, ...
[ 13, 22, 23, 27, 32 ]
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'includes': [ 'ots-common.gypi', ], 'targets': [ { 'target_name': 'ots', 'type'...
normal
{ "blob_id": "7413d4e98f79bf7b389a6305257833293714fc81", "index": 1786, "step-1": "<mask token>\n", "step-2": "{'variables': {'chromium_code': 1}, 'includes': ['ots-common.gypi'],\n 'targets': [{'target_name': 'ots', 'type': '<(library)', 'sources': [\n '<@(ots_sources)'], 'include_dirs': ['<@(ots_include...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Assignment(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return self.name + '-' + self.technology class Assestment(models.Model): name = models.CharField(max_length=250) tec...
flexible
{ "blob_id": "01b14da7d081a67bab6f9921bb1a6a4c3d5ac216", "index": 3003, "step-1": "<mask token>\n\n\nclass Assignment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name + '-' + self.technology\n\n\nclass Assestment(models.Model):\n name = mo...
[ 7, 8, 11, 14, 15 ]
print("n:",end="") n=int(input()) print("a:",end="") a=list(map(int,input().split())) ans=0 for i in range(n): for j in range(i+1,n): for k in range(j+1,n): ai,aj,ak=sorted([a[i],a[j],a[k]]) if(ai+aj>ak and ai+aj+ak>ans): ans=ai+aj+ak print(ans)
normal
{ "blob_id": "130f49028833bf57d7e4f9fbb0764801c3508c3b", "index": 3055, "step-1": "<mask token>\n", "step-2": "print('n:', end='')\n<mask token>\nprint('a:', end='')\n<mask token>\nfor i in range(n):\n for j in range(i + 1, n):\n for k in range(j + 1, n):\n ai, aj, ak = sorted([a[i], a[j], ...
[ 0, 1, 2, 3 ]
from __future__ import print_function, division import os from os.path import exists, join, basename, dirname from os import makedirs import numpy as np import datetime import time import argparse import torch import torch.nn as nn import torch.optim as optim from lib.dataloader import DataLoader from lib.im_pair_dat...
normal
{ "blob_id": "0c97569c77fb3598d83eba607960328bb2134dd2", "index": 333, "step-1": "<mask token>\n", "step-2": "<mask token>\ntorch.manual_seed(1)\nif use_cuda:\n torch.cuda.manual_seed(1)\nnp.random.seed(1)\n<mask token>\nprint('DCCNet training script')\n<mask token>\nparser.add_argument('--checkpoint', type=...
[ 0, 2, 3, 4, 5 ]
from tkinter import * root = Tk() root.title("Calculator") e = Entry(root, width = 50, borderwidth = 5) e.grid(row = 0, column = 0, columnspan = 4, padx = 10, pady = 20) def button_click(number): digit = e.get() e.delete(0, END) e.insert(0, str(digit) + str(number)) def button_add(): global first_...
normal
{ "blob_id": "59a75f78c7a146dcf55d43be90f71abce2bcf753", "index": 4934, "step-1": "<mask token>\n\n\ndef button_add():\n global first_num\n global math\n math = 'addition'\n first_num = e.get()\n e.delete(0, END)\n\n\n<mask token>\n\n\ndef button_sub():\n global first_num\n global math\n m...
[ 4, 5, 6, 7, 11 ]
import msvcrt import random import os def clear(): ''' It clears the screen.''' os.system('cls') def InitMatrix(): ''' It initializes the matrix as a board game.''' m = [[0 for i in range(4)] for j in range(4)] for i in range(2): x = random.randint(0, 3) y = random...
normal
{ "blob_id": "ab69f4d6afb96d86381bcf507d7810980446c6ea", "index": 6407, "step-1": "<mask token>\n\n\ndef MoveUp():\n \"\"\"It computes to the matrix upper side the adjacent elements with the same\n value and moves the other elements to the same side if there are empty cells\n when the up key is pressed.\...
[ 3, 8, 10, 12, 13 ]
#!/bin/python3 def word_ladder(start_word, end_word, dictionary_file='words5.dict'): ''' Returns a list satisfying the following properties: 1. the first element is `start_word` 2. the last element is `end_word` 3. elements at index i and i+1 are `_adjacent` 4. all elements are entries in the...
normal
{ "blob_id": "631323e79f4fb32611d7094af92cff8f923fa996", "index": 303, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef _adjacent(word1, word2):\n \"\"\"\n Returns True if the input words differ by only a single character;\n returns False otherwise.\n\n >>> _adjacent('phone','phony')\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def age_domain(url): try: w = whois.whois(url) if w: for l in w.expiration_date: d1 = datetime.date(l) print(d1) for l1 in w.creation_date: ...
flexible
{ "blob_id": "07d574060ded0d98734b4f184dcba7377b3a5480", "index": 685, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef age_domain(url):\n try:\n w = whois.whois(url)\n if w:\n for l in w.expiration_date:\n d1 = datetime.date(l)\n print(d1)\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def getSyntheticData(n, d, k): mean = np.array([0] * d) alpha = 0.8 cov_diag = [(alpha ** i) for i in range(d)] covariance = np.diag(cov_diag) truth = np.sum(cov_diag[:k]) samples = np.random.multivariate_normal(mean, covariance, n) return [samples, covariance,...
flexible
{ "blob_id": "bf04bf41f657a6ada4777fe5de98d6a68beda9d3", "index": 9769, "step-1": "<mask token>\n\n\ndef getSyntheticData(n, d, k):\n mean = np.array([0] * d)\n alpha = 0.8\n cov_diag = [(alpha ** i) for i in range(d)]\n covariance = np.diag(cov_diag)\n truth = np.sum(cov_diag[:k])\n samples = n...
[ 2, 5, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('-f', '-forward', required=True, help= 'forward sequencing files', nargs='+', action='store', dest='forward_files' ) parser.add_argument('-r', '-reverse', required=True, help= 'reverse sequencing fi...
flexible
{ "blob_id": "9206e4c4eff8ca64266ce53705e88069912b80d8", "index": 1526, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-f', '-forward', required=True, help=\n 'forward sequencing files', nargs='+', action='store', dest='forward_files'\n )\nparser.add_argument('-r', '-reverse', r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def index(): return greetings <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def index(): return greetings @app.route('/play', methods=['POST']) def play(): global text text = request.data.dec...
flexible
{ "blob_id": "956e63bf06255df4a36b5fa97aa62c0ed805c3f3", "index": 9452, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return greetings\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n return greetings\n\n\n@app.route('/play', methods=['POST'])\ndef play():\...
[ 1, 4, 5, 6, 7 ]
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Copyright 2021 Opensource ICT Solutions B.V. # https://oicts.com # #version: 1.0.0 #date: 06-11-2021 import requests import json import sys url = 'http://<URL>/zabbix/api_jsonrpc.php?' token = '<TOKEN>' headers = {'Content-Type': 'application/json'} hostname = sys....
normal
{ "blob_id": "18d7c486b9070a1c607ba2ba5876309246013182", "index": 4651, "step-1": "<mask token>\n\n\ndef main():\n hostid = hostid_get(token)\n itemid_array = itemid_get(hostid, token)\n update(itemid_array, token)\n\n\ndef hostid_get(token):\n payload = {}\n payload['jsonrpc'] = '2.0'\n payload...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def ponger(pipe, response): while True: msg = pipe.recv() print(f'{getpid()} receiving: {msg}') sleep(1) pipe.send(response) <|reserved_special_token_0|> <|reserved_special_token_1|> <|re...
flexible
{ "blob_id": "aac9960dafc9e8d3a5670251fcc54eb8e34d4458", "index": 9282, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ponger(pipe, response):\n while True:\n msg = pipe.recv()\n print(f'{getpid()} receiving: {msg}')\n sleep(1)\n pipe.send(response)\n\n\n<mask token>...
[ 0, 1, 2, 3, 4 ]
import torch.nn as nn class RNN_instruction_encoder(nn.Module): def __init__(self, vocab_size, word_vec_dim, hidden_size, n_layers, input_dropout_p=0, dropout_p=0, bidirectional=True, variable_lengths=True, word2vec=None, fix_embeddings=False, rnn_cell='lstm'): super(RNN_instructi...
normal
{ "blob_id": "16106250548ef60b475b009116cfeb7a25101637", "index": 7727, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RNN_instruction_encoder(nn.Module):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass RNN_instruction_encoder(nn.Module):\n\n def __init__(self, vo...
[ 0, 1, 3, 4 ]
<|reserved_special_token_0|> class Schedule: def __init__(self, start, end, name, other): self.start = self.str_convert(start) self.end = self.str_convert(end) self.name = name self.other = other self.array = self.create_array() <|reserved_special_token_0|> <|reser...
flexible
{ "blob_id": "f56978d5738c2f8cb4ed5ce4f11d3aae6a9689b1", "index": 4604, "step-1": "<mask token>\n\n\nclass Schedule:\n\n def __init__(self, start, end, name, other):\n self.start = self.str_convert(start)\n self.end = self.str_convert(end)\n self.name = name\n self.other = other\n ...
[ 9, 10, 12, 13, 14 ]
import json import logging import numpy as np from python_speech_features import mfcc from format_converters import get_segment from schemas import * from chains.mfcc import Mfcc logger = logging.getLogger() class MfccLocal(Mfcc): """ MfccLocal computes Mfcc features for each phoneme from the sample tha...
normal
{ "blob_id": "44214492dd7283da4b9a77bd2a1fa9d9c0643ff2", "index": 1188, "step-1": "<mask token>\n\n\nclass MfccLocal(Mfcc):\n <mask token>\n abstract_class = False\n\n @staticmethod\n def sample_result_filename(out_sample_path):\n return f'{out_sample_path[:-5]}_mfcc_result.json'\n\n @static...
[ 6, 7, 8, 9, 10 ]
import numpy from scipy.spatial.distance import cosine def similarity_metric(embedding1: numpy.ndarray, embedding2: numpy.ndarray ) ->float: return numpy.nan_to_num(1 - cosine(embedding1, embedding2), 0)
normal
{ "blob_id": "ec9f27b4313f72ae6eb7e8280d47de226aeb6bb1", "index": 2270, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef similarity_metric(embedding1: numpy.ndarray, embedding2: numpy.ndarray\n ) ->float:\n return numpy.nan_to_num(1 - cosine(embedding1, embedding2), 0)\n", "step-3": "import ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Model(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Model(nn.Module): <|reserved_special_token_0|> <|reserve...
flexible
{ "blob_id": "981cfecdb50b5f3ae326bf3103163f6e814ccc95", "index": 6857, "step-1": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 1, 2, 4, 5, 6 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "28854823b1edc7df6cf025175811c1858efd2c42", "index": 862, "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 = Tr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "f76a3fac75e7e2b156f4bff5094f11009b65b599", "index": 8822, "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 = [('restaurante...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import re import subprocess PREFIX = "Enclave/" OBJ_FILES = [ # "Enclave.o", "p_block.o", # "symbols.o", "runtime.o", "primitives.o", "unary_op.o", "unary/isna.o", "unary/mathgen.o", "unary/mathtrig.o", "unary/plusminus.o", "unary/summary.o", "unar...
normal
{ "blob_id": "45d69194e14e8c20161e979d4ff34d0b90df4672", "index": 4750, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor obj_file in OBJ_FILES:\n cond_results[obj_file] = set()\n dump = subprocess.run(['objdump', '-M', 'intel', '-dr', PREFIX +\n obj_file], stdout=subprocess.PIPE, check=True...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TrajectoryRectangle(TrajectoryBase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @property def top_left(self) ->Line: """ Line representing the trajectory of the point on...
flexible
{ "blob_id": "42d2be7544d2afb9580841422ae35e1a5621df52", "index": 6459, "step-1": "<mask token>\n\n\nclass TrajectoryRectangle(TrajectoryBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def top_left(self) ->Line:\n \"\"\"\n Line representing the tr...
[ 46, 51, 75, 76, 83 ]
from django.db import models # Create your models here. from user.models import User class Post(models.Model): class Meta: db_table = 'bl_post' id = models.AutoField(primary_key=True) title = models.CharField(max_length=200, null=False) pubdate = models.DateTimeField(null=False) # 作者 ...
normal
{ "blob_id": "34a523b31e5567d2a8aec95c5820792d1ae80892", "index": 5335, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n\n\n class Meta:\n db_table = 'bl_post'\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Content(models.Mo...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def election(votes, message=True, force_forward=False): votes = deepcopy(votes) N = len(votes) for i in range(N): obtained = Counter([v[-1] for v in votes if len(v)]).most_common() M = len(obtained) ...
flexible
{ "blob_id": "05764d1cfd9573616fcd6b125280fddf2e5ce7ad", "index": 3712, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef election(votes, message=True, force_forward=False):\n votes = deepcopy(votes)\n N = len(votes)\n for i in range(N):\n obtained = Counter([v[-1] for v in votes if l...
[ 0, 1, 2, 3, 4 ]
import pandas as pd def load_covid(): covid = pd.read_csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv") target = 'new_cases' date = 'date' dataset = covid[(covid['location'] == 'World')].copy()[[target, date]] dataset[date] = pd.to_datetime(datase...
normal
{ "blob_id": "e19529dce407da0f1e21f6a3696efcefac9ed040", "index": 8500, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef load_covid():\n covid = pd.read_csv(\n 'https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv'\n )\n target = 'new_cases'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'name': 'Clarico CMS Blocks', 'category': 'Website', 'version': '1.0', 'summary': '13 CMS Building Blocks', 'description': '', 'depends': [ 'snippet_style_1', 'snippet_style_2', 'snippet_style_3', 'snippet_style_4', 'snippet_style_5', 'snippet_st...
flexible
{ "blob_id": "34f98d4a6a15c9a7b42f237cab204b736dc97136", "index": 1372, "step-1": "<mask token>\n", "step-2": "{'name': 'Clarico CMS Blocks', 'category': 'Website', 'version': '1.0',\n 'summary': '13 CMS Building Blocks', 'description': '', 'depends': [\n 'snippet_style_1', 'snippet_style_2', 'snippet_sty...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'movies' urlpatterns = [path('', views.index, name='index'), path('<int:movie_id>', views.detail, name='detail')] <|reserved_special_token_1|> from django.urls import path from . import views app_name = 'movies' ...
flexible
{ "blob_id": "5aaac757b766b0143ca3ea54d8fc4b8936160ec7", "index": 5090, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'movies'\nurlpatterns = [path('', views.index, name='index'), path('<int:movie_id>',\n views.detail, name='detail')]\n", "step-3": "from django.urls import path\nfrom . im...
[ 0, 1, 2, 3 ]
#from skimage import measure #from svmutil import * import cv2 import numpy as np def inside(r, q): rx, ry, rw, rh = r qx, qy, qw, qh = q return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh def draw_detections(img, rects, thickness = 1): for x, y, w, h in rects: # the HOG detector returns ...
normal
{ "blob_id": "f012f862ad064fc168bd5328b97c433164a3a36f", "index": 3742, "step-1": "<mask token>\n\n\ndef draw_detections(img, rects, thickness=1):\n for x, y, w, h in rects:\n pad_w, pad_h = int(0.15 * w), int(0.05 * h)\n cv2.rectangle(img, (x + pad_w, y + pad_h), (x + w - pad_w, y + h -\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def sumInput(text): f = open(text, 'r') sum = 0 count = 1 for line in f: count += 1 line = line.strip() if line[0] == '+': sum += int(line[1:]) else: sum -= int(line[1:]) f.close() return sum <|reserved_spec...
flexible
{ "blob_id": "c0d71d970b2632dbf182a5ee8bad27d3e41578f6", "index": 208, "step-1": "<mask token>\n\n\ndef sumInput(text):\n f = open(text, 'r')\n sum = 0\n count = 1\n for line in f:\n count += 1\n line = line.strip()\n if line[0] == '+':\n sum += int(line[1:])\n e...
[ 1, 2, 3, 4, 5 ]
def sum_numbers(numbers=None): sum = 0 if numbers == None: for number in range(1, 101): sum += number return sum for number in numbers: sum += number return sum
normal
{ "blob_id": "a85d06d72b053b0ef6cb6ec2ba465bfb8975b28e", "index": 3879, "step-1": "<mask token>\n", "step-2": "def sum_numbers(numbers=None):\n sum = 0\n if numbers == None:\n for number in range(1, 101):\n sum += number\n return sum\n for number in numbers:\n sum += num...
[ 0, 1 ]
<|reserved_special_token_0|> def main(): try: tempfile = tempfile_name() get_datafile(tempfile) except: print('Could not retrieve datafile ' + tempfile) exit(-1) et = get_yesterdays_et(tempfile) if et == -1.0: print('No et found for ' + datestr) exit(-1)...
flexible
{ "blob_id": "4d82e68faa3102fc2949fd805588504b7d874589", "index": 5457, "step-1": "<mask token>\n\n\ndef main():\n try:\n tempfile = tempfile_name()\n get_datafile(tempfile)\n except:\n print('Could not retrieve datafile ' + tempfile)\n exit(-1)\n et = get_yesterdays_et(tempfi...
[ 8, 9, 10, 11, 12 ]
# _*_ coding: utf-8 _*_ from service import service_logger from service.TaskService import TaskService class ApiException(Exception): def __init__(self, message, code=400, data=None): Exception.__init__(self, message) self.code = code self.msg = message self.data = data...
normal
{ "blob_id": "0ac14b023c51bfd1cf99bd2d991baa30a671e066", "index": 9994, "step-1": "<mask token>\n\n\nclass ApiException(Exception):\n\n def __init__(self, message, code=400, data=None):\n Exception.__init__(self, message)\n self.code = code\n self.msg = message\n self.data = data\n\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class cRandomString: @staticmethod def RandomTitle(name): platform = ['PS4', 'XBOX', 'PC', 'NS', 'IOS'] random.shuffle(platform) platform = '/'.join(platform) firstWord = ['Cool', 'Hot', 'New', '2018', 'Gift', '*Cool*', '*Hot*', '*New*'...
flexible
{ "blob_id": "ed02cbf3ebef307d6209004e1e388312bfda0b50", "index": 2027, "step-1": "<mask token>\n\n\nclass cRandomString:\n\n @staticmethod\n def RandomTitle(name):\n platform = ['PS4', 'XBOX', 'PC', 'NS', 'IOS']\n random.shuffle(platform)\n platform = '/'.join(platform)\n firstW...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='supermodule', version='1.0', ext_modules=[Extension( 'supermodule', ['main.c'])]) <|reserved_special_token_1|> from distutils.core import setup, Extension setup(name='supermodule', version='1.0', ext_modules=[Ex...
flexible
{ "blob_id": "78c8f953b924f3e664570b844bf736a788e9cfb7", "index": 3607, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='supermodule', version='1.0', ext_modules=[Extension(\n 'supermodule', ['main.c'])])\n", "step-3": "from distutils.core import setup, Extension\nsetup(name='supermodule', ...
[ 0, 1, 2, 3 ]
from ui.pages import BasePage from ui.locators.login_page_locators import LoginPageLocators class LoginPage(BasePage, LoginPageLocators): def __init__(self, driver=None): super(LoginPage, self).__init__(driver=driver) self.identifier = self.IDENTIFIER def login(self, email=None, password=Non...
normal
{ "blob_id": "c1bcce809aa073ecd6e64dfa65ead9bd48aee3ff", "index": 7406, "step-1": "<mask token>\n\n\nclass LoginPage(BasePage, LoginPageLocators):\n\n def __init__(self, driver=None):\n super(LoginPage, self).__init__(driver=driver)\n self.identifier = self.IDENTIFIER\n <mask token>\n\n def...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> m.sort(reverse=True) <|reserved_special_token_0|> while x > 0: res += max(0, m[i]) m[i] -= 1 x -= 1 if m[i % n] < m[(i + 1) % n]: i = (i + 1) % n print(res) <|reserved_special_token_1|> n, x = input().sp...
flexible
{ "blob_id": "9d3439a2be1f22c8ec59923b88ac22877a4f13e8", "index": 663, "step-1": "<mask token>\n", "step-2": "<mask token>\nm.sort(reverse=True)\n<mask token>\nwhile x > 0:\n res += max(0, m[i])\n m[i] -= 1\n x -= 1\n if m[i % n] < m[(i + 1) % n]:\n i = (i + 1) % n\nprint(res)\n", "step-3":...
[ 0, 1, 2 ]
"""Project agnostic helper functions that could be migrated to and external lib. """
normal
{ "blob_id": "f15bb4ab93ecb2689bf74687852e60dfa98caea9", "index": 7374, "step-1": "<mask token>\n", "step-2": "\"\"\"Project agnostic helper functions that could be migrated to and external lib.\n\"\"\"\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|> if use_gpu: img0 = img0.cuda() <|reserved_special_token_0|> if use_gpu: img1 = img1.cuda() <|reserved_special_token_0|> plt.figure(figsize=[9, 3.5]) plt.subplot(131) plt.imshow(img0_) plt.subplot(132) plt.imshow(img1_) plt...
flexible
{ "blob_id": "8fcbaf2663c22015a0c47f00c2d4fb8db6a5c308", "index": 6209, "step-1": "<mask token>\n", "step-2": "<mask token>\nif use_gpu:\n img0 = img0.cuda()\n<mask token>\nif use_gpu:\n img1 = img1.cuda()\n<mask token>\nplt.figure(figsize=[9, 3.5])\nplt.subplot(131)\nplt.imshow(img0_)\nplt.subplot(132)\n...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 """ request api and write in JSON file all tasks todo for every users """ import json import requests import sys if __name__ == "__main__": req = "https://jsonplaceholder.typicode.com/todos" response = requests.get(req).json() d = {} req_user = "https://jsonplaceholder.typic...
normal
{ "blob_id": "53de53614b3c503a4232c00e8f2fd5a0f4cb6615", "index": 1624, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n req = 'https://jsonplaceholder.typicode.com/todos'\n response = requests.get(req).json()\n d = {}\n req_user = 'https://jsonplaceholder.typicode.c...
[ 0, 1, 2, 3 ]
""" You have a map that marks the locations of treasure islands. Some of the map area has jagged rocks and dangerous reefs. Other areas are safe to sail in. There are other explorers trying to find the treasure. So you must figure out a shortest route to one of the treasure islands. Assume the map area is a two dimens...
normal
{ "blob_id": "e6851e86fa86ab2096f059218b2b8a2994642807", "index": 3717, "step-1": "<mask token>\n\n\ndef find_treasure(grid):\n if not len(grid) or not len(grid[0]):\n return -1\n minimum_steps = math.inf\n for i in range(len(grid)):\n for j in range(len(grid[i])):\n if grid[i][j...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """ Created on Tue Aug 10 17:48:19 2021 @author: LESLY """ from PICO_PLACA_class import PICO_PLACA """ Main program of "Pico y Placa" predictor""" def main(): print("Predictor") placa = input("Enter the license of your vehicle in the following format AAA-###...
normal
{ "blob_id": "c7e5851a41e1cdb33cd0daa103fbf702da6e5ff7", "index": 9818, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n print('Predictor')\n placa = input(\n 'Enter the license of your vehicle in the following format AAA-####: '\n )\n fecha = input('Enter the date ...
[ 0, 1, 2, 3, 4 ]
import csv import json import re import itertools import pandas as pd import networkx as nx import matplotlib.pyplot as plt from networkx.algorithms import community import snap import numpy # setting up data structures to map actor IDs to objects in order to increase run time. csv.field_size_limit(100000000) curr_act...
normal
{ "blob_id": "0934163fc6461e30a73c06e74b3a5e983ed2fa02", "index": 4211, "step-1": "<mask token>\n\n\nclass Movie:\n\n def __init__(self, id: int):\n self.actors = set()\n self.name = ''\n self.id = id\n self.year = 0\n\n def getName(self):\n return self.name\n\n def get...
[ 7, 11, 17, 22, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: new = list(map(lambda x: 2 / x, new_list)) except ZeroDivisionError: pass print(new) <|reserved_special_token_1|> my_list = [1, 2, 4, 0, 4, 0, 10, 20, 0, 1] new_list = list(filter(lambda x: x != 0, my_list)) try: ...
flexible
{ "blob_id": "46f3d3681343d96889ddb073f17ff7f225486f35", "index": 8005, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n new = list(map(lambda x: 2 / x, new_list))\nexcept ZeroDivisionError:\n pass\nprint(new)\n", "step-3": "my_list = [1, 2, 4, 0, 4, 0, 10, 20, 0, 1]\nnew_list = list(filter(l...
[ 0, 1, 2, 3 ]
from ctypes import CDLL svg2pdf = CDLL("./libsvg2pdf.so") svg2pdf.svg2pdf("report.svg", "teste2.pdf") svg2pdf.svg2pdf2("report.svg", "teste3.pdf")
normal
{ "blob_id": "9c85252b4048b5412978b3ac05cd6dde4479e3bf", "index": 3333, "step-1": "<mask token>\n", "step-2": "<mask token>\nsvg2pdf.svg2pdf('report.svg', 'teste2.pdf')\nsvg2pdf.svg2pdf2('report.svg', 'teste3.pdf')\n", "step-3": "<mask token>\nsvg2pdf = CDLL('./libsvg2pdf.so')\nsvg2pdf.svg2pdf('report.svg', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StatsControllerTestCase(unittest.TestCase): def setUp(self): pR = PersonRepository() aR = ActivityRepository() self.L = StatsController(pR, aR) self.p = Person(1, 'John', '1', 'A') self.q = Person(2, 'Mary', '1', 'B') self.a1 = Ac...
flexible
{ "blob_id": "130581ddb0394dcceabc316468385d4e21959b63", "index": 8682, "step-1": "<mask token>\n\n\nclass StatsControllerTestCase(unittest.TestCase):\n\n def setUp(self):\n pR = PersonRepository()\n aR = ActivityRepository()\n self.L = StatsController(pR, aR)\n self.p = Person(1, '...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(stems1) print(stems2) print(stems3) <|reserved_special_token_1|> <|reserved_special_token_0|> stemmer = SnowballStemmer('english', ignore_stopwords=True) lemmatizer = WordNetLemmatizer() source = ['having', 'have', 'needs...
flexible
{ "blob_id": "1f1677687ba6ca47b18728b0fd3b9926436e9796", "index": 2949, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(stems1)\nprint(stems2)\nprint(stems3)\n", "step-3": "<mask token>\nstemmer = SnowballStemmer('english', ignore_stopwords=True)\nlemmatizer = WordNetLemmatizer()\nsource = ['having...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def GetAtomFeatInfo(factory, mol): res = [None] * mol.GetNumAtoms() feats = factory.GetFeaturesForMol(mol) for feat in feats: ids = feat.GetAtomIds() feature = '%s-%s' % (feat.GetFamily(), feat.GetType()) for id_ in ids: if res[id_] is None:...
flexible
{ "blob_id": "4b63df35b36b35f1b886b8981519921a9e697a42", "index": 4840, "step-1": "<mask token>\n\n\ndef GetAtomFeatInfo(factory, mol):\n res = [None] * mol.GetNumAtoms()\n feats = factory.GetFeaturesForMol(mol)\n for feat in feats:\n ids = feat.GetAtomIds()\n feature = '%s-%s' % (feat.GetF...
[ 5, 6, 7, 8, 9 ]
import torch from torchvision import datasets, transforms from torch.utils.data import Dataset, DataLoader # load the data Set from torch.utils.data import random_split from torchvision.datasets import ImageFolder batch_size = 256 data_dir = 'nut_snacks/dataset/' data_transforms = transfor...
normal
{ "blob_id": "4156b003210a41d6ec8f30e2d20adfb1f4b3deb0", "index": 6024, "step-1": "<mask token>\n\n\ndef mean_std(loader):\n mean = 0\n std = 0\n for images, _ in loader:\n batch_samples = images.size(0)\n images = images.view(batch_samples, images.size(1), -1)\n mean += images.mean(...
[ 1, 2, 3, 4, 5 ]
class Solution: ''' 先遍历整个string,并记录最小的character的出现次数。 如果最小character出现次数都不小于k,那么说明整个string就是满足条件的longest substring,返回原string的长度即可; 如果character的出现次数小于k,假设这个character是c,因为满足条件的substring永远不会包含c,所以满足条件的substring一定是在以c为分割参考下的某个substring中。所以我们需要做的就是把c当做是split的参考,在得到的String[]中再次调用我们的method,找到最大的返回值即可。 ''' ...
normal
{ "blob_id": "6ba830aafbe8e4b42a0b927328ebcad1424cda5e", "index": 8381, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def longestSubstring(self, s: str, k: int) ->int:\n\n def helper(s, k):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): hosts = {'127.0.0.1': 'carpenter'} myThread.messageListenThread(hosts) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): hosts = {'127.0.0.1': 'carp...
flexible
{ "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|> class EuclideanLoss(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> class CostFunction(nn.Module): def __init__(self, c_p, c_h): super().__init__() self.c_p = c_p self.c_h = c_h def forward(self, y, d): """ ...
flexible
{ "blob_id": "67be25e8fdf004515e18e1c20b8d0238222a2172", "index": 1401, "step-1": "<mask token>\n\n\nclass EuclideanLoss(nn.Module):\n <mask token>\n <mask token>\n\n\nclass CostFunction(nn.Module):\n\n def __init__(self, c_p, c_h):\n super().__init__()\n self.c_p = c_p\n self.c_h = ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def sexpr_key(s_expr): return s_expr.strip('(').split(' ')[0] <|reserved_special_token_0|> def list_data(_list): if type(_list) is type(list()): return _list[1] else: temp = expr_data(_list) if temp: return temp[0] else: ...
flexible
{ "blob_id": "18789b5106d4be8a02197b165e16a74c08a58c66", "index": 8578, "step-1": "<mask token>\n\n\ndef sexpr_key(s_expr):\n return s_expr.strip('(').split(' ')[0]\n\n\n<mask token>\n\n\ndef list_data(_list):\n if type(_list) is type(list()):\n return _list[1]\n else:\n temp = expr_data(_l...
[ 3, 6, 7, 8, 10 ]
import sys, os import cv2 # set the video reader video_path = 0 # camera number index # video_path = "/home/pacific/Documents/Work/Projects/Workflows/server/PycharmProjects/Pacific_AvatarGame_Host/humanpose_2d/LiveCamera/test.mp4" # real video file if type(video_path).__name__ == "str": videoReader = cv2.VideoCap...
normal
{ "blob_id": "08408cf096bbe23f9a832cc0cf2e017abdbd359f", "index": 4591, "step-1": "<mask token>\n", "step-2": "<mask token>\nif type(video_path).__name__ == 'str':\n videoReader = cv2.VideoCapture(video_path)\n print('Load live video from file...')\nelif type(video_path).__name__ == 'int':\n videoReade...
[ 0, 1, 2, 3, 4 ]
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 agree...
normal
{ "blob_id": "48cef0377087d9245aad1fb759adf8ff07d2b66f", "index": 4464, "step-1": "<mask token>\n\n\ndef cut_text_line(geo, scale_ratio_w, scale_ratio_h, im_array, img_path, s):\n geo /= [scale_ratio_w, scale_ratio_h]\n p_min = np.amin(geo, axis=0)\n p_max = np.amax(geo, axis=0)\n min_xy = p_min.astyp...
[ 2, 4, 5, 6, 7 ]
""" Convert file containing histograms into the response function """ import h5py import wx import numpy as np import matplotlib.pyplot as plt ############################################################################# # Select the file cantoning histograms, # which will be converted to response function app = wx.A...
normal
{ "blob_id": "c4898f3298c2febed476f99fe08bc5386527a47e", "index": 9344, "step-1": "<mask token>\n", "step-2": "<mask token>\nif openFileDialog.ShowModal() == wx.ID_CANCEL:\n raise ValueError('HDF5 file is not selected')\n<mask token>\ndel app\nwith h5py.File(hist_filename, 'r') as F:\n for histogram in F[...
[ 0, 1, 2, 3, 4 ]
import unittest ''' 시험 문제 2) 장식자 구현하기 - 다수의 인자를 받아, 2개의 인자로 변환하여 함수를 호출토록 구현 - 첫번째 인자 : 홀수의 합 - 두번째 인자 : 짝수의 합 모든 테스트가 통과하면, 다음과 같이 출력됩니다. 쉘> python final_2.py ... ---------------------------------------------------------------------- Ran 3 tests in 0.000s OK ''' def divider(fn): def wrap(*args): o...
normal
{ "blob_id": "253804644e366382a730775402768bc307944a19", "index": 6548, "step-1": "<mask token>\n\n\ndef divider(fn):\n\n def wrap(*args):\n odd = sum(i for i in args if i % 2 != 0)\n even = sum(i for i in args if i % 2 == 0)\n return fn(odd, even)\n return wrap\n\n\n@divider\ndef mysum...
[ 7, 8, 9, 10, 11 ]
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import func from extensions import bcrypt db = SQLAlchemy() class User(db.Model): id = db.Column(db.Integer(), primary_key=True) username = db.Column(db.String(255)) password = db.Column(db.String(255)) posts = db.relationship('Post', backref='us...
normal
{ "blob_id": "dd0e96a1f93cbffedc11262a883dda285f5c224c", "index": 9703, "step-1": "<mask token>\n\n\nclass Post(db.Model):\n id = db.Column(db.Integer(), primary_key=True)\n title = db.Column(db.String(255))\n text = db.Column(db.Text())\n date = db.Column(db.DateTime())\n user_id = db.Column(db.In...
[ 12, 17, 20, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_apriori_input(input_file, output_file, sample_col='Sample', gene_id_col='Gene_ID'): df = pd.read_csv(input_file, sep='\t') sample_names = df[sample_col].unique() with open(output_file, 'w') as out: ...
flexible
{ "blob_id": "e14bea6376c8649bf9c9c5759d530af773664cd4", "index": 891, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_apriori_input(input_file, output_file, sample_col='Sample',\n gene_id_col='Gene_ID'):\n df = pd.read_csv(input_file, sep='\\t')\n sample_names = df[sample_col].unique(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from trest.utils import utime from trest.logger import SysLogger from trest.config import settings from trest.exception import JsonError from applications.common.models.user import User class UserService(object): @staticmethod def page_list(where, page, per_page):...
normal
{ "blob_id": "d1ed43bab6171c876b2ad9ef9db834ab8f9026d5", "index": 8411, "step-1": "<mask token>\n\n\nclass UserService(object):\n <mask token>\n\n @staticmethod\n def get(id):\n \"\"\"获取单条记录\n\n [description]\n\n Arguments:\n id int -- 主键\n\n return:\n Us...
[ 3, 4, 5, 6, 7 ]
import pytest from dymopy.client import Dymo from dymopy.client import make_xml, make_params def test_url(): dymo = Dymo() assert dymo.uri == "https://127.0.0.1:41951/DYMO/DLS/Printing" def test_status(): dymo = Dymo() status = dymo.get_status() assert isinstance(status, dict) assert statu...
normal
{ "blob_id": "766098753ec579e2d63893fcbd94e8819b46bc0b", "index": 6867, "step-1": "<mask token>\n\n\ndef test_url():\n dymo = Dymo()\n assert dymo.uri == 'https://127.0.0.1:41951/DYMO/DLS/Printing'\n\n\ndef test_status():\n dymo = Dymo()\n status = dymo.get_status()\n assert isinstance(status, dict...
[ 3, 4, 5, 6, 7 ]
# -*- coding:utf-8 -*- # Author: 李泽军 # Date: 2020/1/27 3:31 PM # Project: flask-demo from flask import abort from flask_login import current_user from functools import wraps from simpledu.modes import User def role_required(role): ''' 带参数的装饰器,可以用它来保护一个路由处理函数智能被特定的用户访问 :param role: :return: '''...
normal
{ "blob_id": "b3f6d255830bdb2b0afc99aab6e3715616ac4dec", "index": 4298, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef role_required(role):\n \"\"\"\n 带参数的装饰器,可以用它来保护一个路由处理函数智能被特定的用户访问\n :param role:\n :return:\n \"\"\"\n\n def decorator(func):\n\n @wraps(func)\n de...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class T...
flexible
{ "blob_id": "2a1d31b2123c11af3fce571287d3dad00a9b0086", "index": 2820, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test(models.Model):\n word1 = models.Char...
[ 0, 1, 2, 3, 4 ]
import weakref from Qt import QtCore from Qt import QtGui from Qt.QtWidgets import QDoubleSpinBox from Qt.QtWidgets import QSpinBox from Qt.QtWidgets import QWidget from Qt.QtWidgets import QSpacerItem from Qt.QtWidgets import QPushButton from Qt.QtWidgets import QComboBox from Qt.QtWidgets import QLineEdit from Qt.QtW...
normal
{ "blob_id": "023dc23a5e649c2fbbb45ff577dffa3b5d2aac64", "index": 7904, "step-1": "<mask token>\n\n\nclass FloatVector3InputWidget(InputWidgetRaw, FloatVector3InputWidget_ui.\n Ui_Form):\n <mask token>\n\n def __init__(self, **kwds):\n super(FloatVector3InputWidget, self).__init__(**kwds)\n ...
[ 59, 60, 62, 81, 103 ]
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QLineEdit, QRadioButton, QPushButton, QTableWidgetItem, QTableWidget, QApplication, QMainWindow, QDateEdit, QLabel, QDialog, QTextEdit, QCheckBox from PyQt5.QtCore import QDate, QTime, QDateTime, Qt from OOPCourseWorkTwo.GUI.SingleAnswerQuestionDi...
normal
{ "blob_id": "98f234ca0cbec419466de0504fd8d5c68fd07627", "index": 9609, "step-1": "<mask token>\n\n\nclass TeacherGUI:\n <mask token>\n\n @classmethod\n def setup(cls, ui_mainwindow):\n cls.__ui_mainwindow = ui_mainwindow\n\n @classmethod\n def display_all_active_school_classes(cls, school_c...
[ 100, 103, 113, 122, 132 ]
from django.db import models # Create your models here. class GameGenre(models.Model): genreName = models.CharField(max_length=100) genreDescription = models.CharField(max_length=300) def __str__(self): return "%s" % (self.genreName) class Game(models.Model): gameName = models.CharField(...
normal
{ "blob_id": "092242cdb231e09ccf3dd4dccfb6d786c3e4aad2", "index": 8036, "step-1": "<mask token>\n\n\nclass Game(models.Model):\n gameName = models.CharField(max_length=100)\n genre = models.ForeignKey(GameGenre)\n\n def __str__(self):\n return '%s, %s' % (self.gameName, self.genre)\n\n\nclass Play...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> def topological(above): """Topologically sort a DAG by removing a layer of sources until empty.""" result = [] while above: sources = set(above) - set(flatten(above.values())) result.extend(sources) for node in sources: del above[node] r...
flexible
{ "blob_id": "a8ea91797942616779ae0acc884db1e521c7ad28", "index": 3927, "step-1": "<mask token>\n\n\ndef topological(above):\n \"\"\"Topologically sort a DAG by removing a layer of sources until empty.\"\"\"\n result = []\n while above:\n sources = set(above) - set(flatten(above.values()))\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def freqModAvgFunc(dirName): fullList = factorStatFileCreator.directoryFreq(dirName) UA = dirName.split('/')[1] avgList = [] sum = 0 i = 0 while i <= len(fullList) - 2: diff = factorStatFileCreator.diffFunc(fullList[i], fullList[i + 1]) if diff == N...
flexible
{ "blob_id": "8ac84aa29e9e4f3b85f1b3c27819feb5f41e8d8e", "index": 598, "step-1": "<mask token>\n\n\ndef freqModAvgFunc(dirName):\n fullList = factorStatFileCreator.directoryFreq(dirName)\n UA = dirName.split('/')[1]\n avgList = []\n sum = 0\n i = 0\n while i <= len(fullList) - 2:\n diff =...
[ 7, 8, 9, 10, 12 ]
import random import numpy as np import pandas as pd def linear_combination_plus_error(X, num_dependent_cols=5, parameter_mean=0, parameter_std=1, error_mean=0, error_std=1): """ Generate a column that is a random linear combination of X1, X2 and X3 plus some random error """ length = X.shape[0] ...
normal
{ "blob_id": "48f2cc5b6d53c7317ad882947cabbc367cda0fb7", "index": 905, "step-1": "<mask token>\n\n\ndef linear_combination_plus_error(X, num_dependent_cols=5, parameter_mean=0,\n parameter_std=1, error_mean=0, error_std=1):\n \"\"\"\n Generate a column that is a random linear combination of\n X1, X2 a...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(np.dot(a, b)) <|reserved_special_token_1|> <|reserved_special_token_0|> n = int(input()) a = [list(map(int, input().split())) for _ in range(n)] b = [list(map(int, input().split())) for _ in range(n)] a = np.array(a) b = ...
flexible
{ "blob_id": "17b8fec5583f2544bd02a2409528082fa1dc2a1e", "index": 4107, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(np.dot(a, b))\n", "step-3": "<mask token>\nn = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\nb = [list(map(int, input().split())) for _ in range(n)]\na = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( 'Note: total_earnings values were scaled by multiplying by {:.10f} and adding {:.6f}' .format(scaler.scale_[8], scaler.min_[8])) <|reserved_special_token_0|> scaled_training_df.to_csv('sales_data_training_scaled.csv...
flexible
{ "blob_id": "050e2207ac7331444d39305869c4b25bcbc53907", "index": 244, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Note: total_earnings values were scaled by multiplying by {:.10f} and adding {:.6f}'\n .format(scaler.scale_[8], scaler.min_[8]))\n<mask token>\nscaled_training_df.to_csv('...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Graph: <|reserved_special_token_0|> def appendNode(self, node): if node.name in self.placeholderNames and node.isPlaceholder: raise Exception( 'Placeholder name "{}" is already in use in current graph'. format(node.name)) ...
flexible
{ "blob_id": "7bd2a29bff1e435cf813dd54109d7f4e17612425", "index": 474, "step-1": "<mask token>\n\n\nclass Graph:\n <mask token>\n\n def appendNode(self, node):\n if node.name in self.placeholderNames and node.isPlaceholder:\n raise Exception(\n 'Placeholder name \"{}\" is al...
[ 5, 7, 8, 9, 10 ]
contador_pares = 0 contador_impares = 0 for i in range(100): numero = int(input('Digite um valor:')) if numero % 2 == 0: contador_pares += 1 else: contador_impares += 1 print('A quantidade de números pares é igual a:', contador_pares) print('A quantidade de números ímpares é igual a:', conta...
normal
{ "blob_id": "03aa33861def30a46de85c5b309878a1180a760f", "index": 5211, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(100):\n numero = int(input('Digite um valor:'))\n if numero % 2 == 0:\n contador_pares += 1\n else:\n contador_impares += 1\nprint('A quantidade de n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate(env): def remove_doctype(target, source, env): f = open(str(target[0])) output = [] for line in f.readlines(): output.append(re.sub('^<!DOCTYPE .*', '', line)) f.clos...
flexible
{ "blob_id": "cae49da8dd436fc51b472c4a88703d8bc6c79bda", "index": 427, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate(env):\n\n def remove_doctype(target, source, env):\n f = open(str(target[0]))\n output = []\n for line in f.readlines():\n output.append...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DataFrameCreatorBase: <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, input_file): self._input_file = input_file self.df = self._read_raw_csv() self._clean_df() <|reserved_special_token_0|> def _read_raw_csv(...
flexible
{ "blob_id": "f4fa7563d2cce5ee28198d4974a4276d9f71f20b", "index": 4329, "step-1": "<mask token>\n\n\nclass DataFrameCreatorBase:\n <mask token>\n <mask token>\n\n def __init__(self, input_file):\n self._input_file = input_file\n self.df = self._read_raw_csv()\n self._clean_df()\n ...
[ 4, 6, 7, 8, 9 ]
from PyQt5.QtWidgets import QPushButton,QWidget,QApplication,QGridLayout,QListWidget,QLineEdit,QVBoxLayout,QLabel import pyqtgraph as pg import sys import numpy as np from tools import DataModel,HoldPositions from load_sina import LoadNet import time from get_day_histroy import history import pandas as pd from volume ...
normal
{ "blob_id": "8ddb7abb480ea8ee674c59719c0946f133ef0a4b", "index": 1303, "step-1": "<mask token>\n\n\nclass addItemThread(QThread):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Example(QWidget):\n\n def...
[ 11, 12, 13, 14, 17 ]
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- """ # @Time : 20-6-9 上午11:47 # @Author : zhufa # @Software: PyCharm """ """ tensorflow version must below 1.15 """ import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", ...
normal
{ "blob_id": "779e7cd05edfd74c8e60eaf5ce8443aea5fdaaef", "index": 8028, "step-1": "#!/usr/bin/python2.7\n# -*- coding: utf-8 -*-\n\n\"\"\"\n# @Time : 20-6-9 上午11:47\n\n# @Author : zhufa\n\n# @Software: PyCharm\n\"\"\"\n\"\"\"\ntensorflow version must below 1.15\n\"\"\"\n\nimport numpy as np\nimport tensorflow...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(incd_data.columns) <|reserved_special_token_1|> <|reserved_special_token_0|> incd_data = pd.read_csv('data/Cancer/incd.csv', usecols=['State', 'FIPS', 'Age-Adjusted Incidence Rate([rate note]) - cases per 100,000', ...
flexible
{ "blob_id": "1deab16d6c574bf532c561b8d6d88aac6e5d996c", "index": 8355, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(incd_data.columns)\n", "step-3": "<mask token>\nincd_data = pd.read_csv('data/Cancer/incd.csv', usecols=['State', 'FIPS',\n 'Age-Adjusted Incidence Rate([rate note]) - cases pe...
[ 0, 1, 2, 3, 4 ]
''' Created on Mar 27, 2019 @author: Iulia ''' from Graph import Graph from Controller import * from Iterators.Vertices import * from File import File from Iterators.EdgesIterator import EdgesIterator def test(): tup = File.readInput("file.txt") graph = tup[0] edgeData = tup[1] ctrl = Controller(grap...
normal
{ "blob_id": "b01ff71792895bb8839e09ae8c4a449405349990", "index": 7066, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test():\n tup = File.readInput('file.txt')\n graph = tup[0]\n edgeData = tup[1]\n ctrl = Controller(graph, edgeData)\n vertices = ctrl.nrVertices()\n itv = verti...
[ 0, 1, 2, 3, 4 ]
''' @author: Ken Venner @contact: ken@venerllc.com @version: 1.13 Read in a file of wine names and create consistent wine descriptions from these names. ''' import kvutil import kvcsv import re import sys import shutil # may comment out in the future import pprint pp = pprint.PrettyPrinte...
normal
{ "blob_id": "d786e89b9d478dcff3c541c89731247075d078c3", "index": 678, "step-1": "<mask token>\n\n\ndef globalVariableCheck(debug=False):\n for liquor in liquorLookup:\n if liquor in noGrapeLookup:\n print(\n 'WARNING:liquorLookup regexs will never execute - they are in noGrape...
[ 7, 13, 15, 18, 19 ]
<|reserved_special_token_0|> @pulumi.input_type class DashboardArgs: <|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_spe...
flexible
{ "blob_id": "2332783c96b24caa383bf47d82384e1c40a48e94", "index": 8566, "step-1": "<mask token>\n\n\n@pulumi.input_type\nclass DashboardArgs:\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...
[ 14, 21, 22, 23, 28 ]
<|reserved_special_token_0|> class TestConfig: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TestFlask(Flask): def configure(self, *storages, **configs): import flask_file_system as fs for key, value in ...
flexible
{ "blob_id": "dfc412acc9b69f50396680db1b9f6feafe162996", "index": 5571, "step-1": "<mask token>\n\n\nclass TestConfig:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestFlask(Flask):\n\n def configure(self, *storages, **configs):\n import flask_file_system as fs\n ...
[ 6, 10, 11, 13, 16 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'KPS_RevisitBusinessEvents.ui' # # Created: Sun May 18 14:50:49 2014 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui, QtSql import sqlite3 try: _fromUtf...
normal
{ "blob_id": "8339113fd6b0c286cc48ec04e6e24978e2a4b44e", "index": 9991, "step-1": "<mask token>\n\n\nclass Ui_Form(object):\n\n def setupUi(self, Form):\n Form.setObjectName(_fromUtf8('Form'))\n Form.resize(666, 538)\n palette = QtGui.QPalette()\n self.eventSkip = 0\n self.db...
[ 8, 10, 11, 12, 13 ]
import numpy as np from math import * from visual import * from visual.graph import * def energy2(n): return ((n*h/L)**2)/(8*m)*convert def factorial(n): out=1 for x in range(n): out=out*(x+1) return out def bosonconfigs(numelvl,numpart): x=numpart n=numelvl out=choose(x+n-1,x) ...
normal
{ "blob_id": "42f656898481768ea0bf1ca0b6afbe06de9dd597", "index": 4132, "step-1": "<mask token>\n\n\ndef energy2(n):\n return (n * h / L) ** 2 / (8 * m) * convert\n\n\ndef factorial(n):\n out = 1\n for x in range(n):\n out = out * (x + 1)\n return out\n\n\n<mask token>\n\n\ndef configs(x, elvl,...
[ 7, 10, 12, 14, 15 ]
<|reserved_special_token_0|> def get_cachefile(filename): """ Return full path to filename within cache dir. """ if not os.path.exists(cachedir): os.makedirs(cachedir) return os.path.join(cachedir, filename) <|reserved_special_token_0|> def get_cached_data(name): if name not in _ca...
flexible
{ "blob_id": "05cfd9d239b63c9b1e0c93a09e89cceb8d8e99e4", "index": 2462, "step-1": "<mask token>\n\n\ndef get_cachefile(filename):\n \"\"\"\n Return full path to filename within cache dir.\n \"\"\"\n if not os.path.exists(cachedir):\n os.makedirs(cachedir)\n return os.path.join(cachedir, file...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> n.sort() <|reserved_special_token_0|> for i in range(n): if i.isalpha(): alpa.append(i) else: num.append(i) result.append(str(alpa)) result.append(str(num)) print(n) <|reserved_special_token_1|> n = inpu...
flexible
{ "blob_id": "e364a4e6e1c4e0fd6805515a1149adaf92e9c8fb", "index": 5584, "step-1": "<mask token>\n", "step-2": "<mask token>\nn.sort()\n<mask token>\nfor i in range(n):\n if i.isalpha():\n alpa.append(i)\n else:\n num.append(i)\nresult.append(str(alpa))\nresult.append(str(num))\nprint(n)\n", ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def gen_label(uid1, uid2): if same_line_dict[uid1].__contains__(uid2) and same_line_dict[uid2 ].__contains__(uid1): return '1' else: return '-1' <|reserved_special_token_0|> def gen_flw(uid1, uid2): if not valid_flw.__contains__(uid1) and not valid_...
flexible
{ "blob_id": "37804c92b69d366cc1774335b6a2295dfd5b98f3", "index": 6592, "step-1": "<mask token>\n\n\ndef gen_label(uid1, uid2):\n if same_line_dict[uid1].__contains__(uid2) and same_line_dict[uid2\n ].__contains__(uid1):\n return '1'\n else:\n return '-1'\n\n\n<mask token>\n\n\ndef gen_...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_logger(log_level: str='INFO', log_name: str='logfile', export_log: bool=True, save_dir: str=''): if log_name in loggers.keys(): logger = loggers.get(log_name) else: logger = logging.getLogg...
flexible
{ "blob_id": "3146775c466368c25c92bd6074abb97408533500", "index": 2956, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_logger(log_level: str='INFO', log_name: str='logfile',\n export_log: bool=True, save_dir: str=''):\n if log_name in loggers.keys():\n logger = loggers.get(log_...
[ 0, 1, 2, 3, 4 ]
# Umut Cakan Computer Science S006742 # Fibonacci list. First and second terms are static. fib_list = [0, 1] # Current index. CURRENT_INDEX = 2 # Function for the checking input is a Fibonacci number or not. def check_fibonacci_number(): global CURRENT_INDEX # Get the fibonacci numbers that are less or equal ...
normal
{ "blob_id": "50fa8852f74f4d2428fb238a86dd1feedb210877", "index": 3261, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef check_fibonacci_number():\n global CURRENT_INDEX\n while fib_list[CURRENT_INDEX - 1] < NUMBER_TO_BE_CHECKED:\n fib_list.append(fib_list[CURRENT_INDEX - 1] + fib_list[...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- class CacheDecorator: def __init__(self): self.cache = {} self.func = None def cachedFunc(self, *args): if args not in self.cache: print("Ergebnis berechnet") self.cache[args] = self.func(*args) else:...
normal
{ "blob_id": "b7f6207fe6c013a964258255445004c3f4e0adbb", "index": 7217, "step-1": "class CacheDecorator:\n <mask token>\n\n def cachedFunc(self, *args):\n if args not in self.cache:\n print('Ergebnis berechnet')\n self.cache[args] = self.func(*args)\n else:\n p...
[ 3, 4, 5, 6, 7 ]
#common method to delete data from a list fruits=['orange','apple','mango','grapes','banana','apple','litchi'] #l=[] #[l.append(i) for i in fruits if i not in l] #print(l) print(set(fruits)) print(fruits.count("orange")) #pop method in a list used to delete last mathod from a lis...
normal
{ "blob_id": "158b39a64d725bdbfc78acc346ed8335613ae099", "index": 8367, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(set(fruits))\nprint(fruits.count('orange'))\n", "step-3": "fruits = ['orange', 'apple', 'mango', 'grapes', 'banana', 'apple', 'litchi']\nprint(set(fruits))\nprint(fruits.count('or...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def longestConsecutive(self, nums: List[int]) ->int: numset = set(nums) ans = 0...
flexible
{ "blob_id": "50c7ce95f17cbd40a753d16d9f9fab349ad4f4ce", "index": 3801, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def longestConsecutive(self, nums: List[int]) ->int:\n numset = set(nums)\n a...
[ 0, 1, 2, 3 ]
from rest_framework import serializers from . import models class RaumSerializer(serializers.ModelSerializer): class Meta: model = models.Raum fields = [ "Raumnummer", "Anzahl_Sitzplaetze", "Beamer", "Whiteboard", ] class ZeitraumSerialize...
normal
{ "blob_id": "451c353a949458f5f71783c4aba1888c40018bfa", "index": 9400, "step-1": "<mask token>\n\n\nclass RaumbelegungSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = models.Raumbelegung\n fields = ['Belegt', 'Belegungsgrund']\n", "step-2": "<mask token>\n\n\nclass Zeitraum...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChildImport(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChildImport(object): def __init__(self, scriptName=None): x = Child.objects.create(fir...
flexible
{ "blob_id": "d0287b057530883a50ad9c1e5e74dce10cd825b6", "index": 7961, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ChildImport(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ChildImport(object):\n\n def __init__(self, scriptName=None):\n x = Child.objects.creat...
[ 0, 1, 2, 3, 4 ]
import json import sys import os # Change to Singularity working directory. os.chdir('/mnt/cwd') # Take subset index as argument subset_index = sys.argv[1] # Open up subset matching this. with open('/mnt/scripts/outputs/instcat_list_subset'+str(subset_index)+'.json', 'r') as f: instcat_list_subset = json.load(f)...
normal
{ "blob_id": "e2e5ca388d67f2a13eaef6067fc19e2dfe284a55", "index": 4469, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir('/mnt/cwd')\n<mask token>\nwith open('/mnt/scripts/outputs/instcat_list_subset' + str(subset_index) +\n '.json', 'r') as f:\n instcat_list_subset = json.load(f)\nsys.path.a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def transform_data2(fn, *args): for arg in args: print(fn(arg)) <|reserved_special_token_0|> <|reserved_special_token_1|> def transform_data(fn): print(fn(10)) <|reserved_special_token_0|> def transform_data2(fn, *args): for arg in args: print(fn(arg))...
flexible
{ "blob_id": "c87e6f8780bf8d9097f200c7f2f0faf55beb480c", "index": 52, "step-1": "<mask token>\n\n\ndef transform_data2(fn, *args):\n for arg in args:\n print(fn(arg))\n\n\n<mask token>\n", "step-2": "def transform_data(fn):\n print(fn(10))\n\n\n<mask token>\n\n\ndef transform_data2(fn, *args):\n ...
[ 1, 2, 3, 4, 5 ]
from app import app from flask import render_template, request from app.models import model, formopener @app.route('/', methods=['GET', 'POST']) @app.route('/index') def index(): return render_template("index.html") @app.route('/personality', methods=['GET', 'POST']) def personfont(): user_input=dict(request....
normal
{ "blob_id": "bb3c4039ff224c0ca0305778b938ef969c196033", "index": 8759, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\n@app.route('/index')\ndef index():\n return render_template('index.html')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@app.route(...
[ 0, 1, 2, 3, 4 ]