code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import main.Tools class EnigmaRotor: def __init__(self, entrata, uscita, rotore_succ=None, flag=True): self.entrata=entrata.copy() self.uscita=uscita.copy() self.numeroSpostamenti=0 self.flag=flag self.rotore_succ=rotore_succ #Imposta il rotore sull'elemento specificat...
normal
{ "blob_id": "c14673b56cb31efb5d79859dd0f6f3c6806e1056", "index": 3576, "step-1": "<mask token>\n\n\nclass EnigmaRotor:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def getEntrata(self):\n return self.entrata\n <mask token>\n <mask...
[ 2, 8, 10, 11, 12 ]
<|reserved_special_token_0|> class Workout(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def addRepeat(self, names, durations, count): self.workout.append(Repeat(names, durations, count)) def generateCode(self, filename=None): if not filename is None: ...
flexible
{ "blob_id": "3f80c4c212259a8f3ff96bcc745fd28a85dac3ba", "index": 8807, "step-1": "<mask token>\n\n\nclass Workout(object):\n <mask token>\n <mask token>\n\n def addRepeat(self, names, durations, count):\n self.workout.append(Repeat(names, durations, count))\n\n def generateCode(self, filename=...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python3 from collections import deque from itertools import permutations INS_ADD = 1 INS_MULTIPLY = 2 INS_INPUT = 3 INS_OUTPUT = 4 INS_JUMP_IF_TRUE = 5 INS_JUMP_IF_FALSE = 6 INS_LESS_THAN = 7 INS_EQUALS = 8 INS_ADJUST_RELATIVE_BASE = 9 INS_DONE = 99 ...
normal
{ "blob_id": "121fddf022c4eed7fd00e81edcb2df6a7a3b7510", "index": 4903, "step-1": "<mask token>\n\n\nclass Computer:\n\n def __init__(self, data, inputs, memory_size=8192, interactive=True):\n self._memory = [0] * memory_size\n for i in range(len(data)):\n self._memory[i] = data[i]\n ...
[ 17, 19, 21, 22, 25 ]
#!/usr/bin/env/ python # -*- coding:utf-8 -*- # Created by: Vanish # Created on: 2019/9/25 import numpy as np from scipy import optimize def sigmoid(z): return 1 / (1 + np.exp(-z)) def costReg(theta, X, y, lamda): theta = np.matrix(theta) X = np.matrix(X) y = np.matrix(y) first = np.multip...
normal
{ "blob_id": "991c361043eb1539a80b5e8e1db44bc365e7e639", "index": 6345, "step-1": "<mask token>\n\n\ndef predict(theta, X):\n probability = sigmoid(X * theta.T)\n return [(1 if x >= 0.5 else 0) for x in probability]\n\n\ndef implement_for_LR(X_train, X_test, y_train, y_test, lamda=1):\n n = X_train.shape...
[ 2, 3, 5, 6, 7 ]
import random from typing import List from faker import Faker from call_center.src.actors.agent import InsuranceAgent from call_center.src.actors.consumer import Consumer from call_center.src.common.person import ( AGE, AVAILABLE, INSURANCE_OPERATION, PHONE_NUMBER, INCOME, CARS_COUNT, KID...
normal
{ "blob_id": "db31a69c57f773a79e5eaa8b3443b0366fd74861", "index": 8565, "step-1": "<mask token>\n\n\nclass ActorsCreator(metaclass=SingletonMeta):\n <mask token>\n\n def __init__(self):\n self.consumers = ActorsCreator.create_consumers()\n self.agents = ActorsCreator.create_agents()\n\n def...
[ 6, 7, 8, 9, 10 ]
from django.contrib import admin # Register your models here. from django.contrib import admin from practice_app.models import Person class PersonAdmin(admin.ModelAdmin): pass admin.site.register(Person)
normal
{ "blob_id": "d90aeaaa682b371afb4771ecfbf1077fc12520b4", "index": 3873, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PersonAdmin(admin.ModelAdmin):\n pass\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass PersonAdmin(admin.ModelAdmin):\n pass\n\n\nadmin.site.register(Person)\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class pairtron: def affiliation_cleaner(self, affiliation): affiliation = str(affiliation) affiliation = affiliation.strip(' ;').replace(' ', ' ').replace(' ', ' ') while ' ;' in affiliation: affiliation = affiliation.replace(' ;', '...
flexible
{ "blob_id": "fbab5826f47163cf82b534d311eae572c5fcd128", "index": 3287, "step-1": "<mask token>\n\n\nclass pairtron:\n\n def affiliation_cleaner(self, affiliation):\n affiliation = str(affiliation)\n affiliation = affiliation.strip(' ;').replace(' ', ' ').replace(' ',\n ' ')\n ...
[ 9, 10, 12, 13, 15 ]
# ********************************************************************************** # # # # Project: Data Frame Explorer # # Author: Pawel Rosikiewicz ...
normal
{ "blob_id": "5f50b20bd044471ebb8e1350d1a75a250b255d8f", "index": 8854, "step-1": "<mask token>\n\n\ndef find_and_display_patter_in_series(*, series, pattern):\n \"\"\"I used that function when i don't remeber full name of a given column\"\"\"\n res = series.loc[series.str.contains(pattern)]\n return res...
[ 4, 5, 7, 8, 10 ]
<|reserved_special_token_0|> @juju.requires_login def list_models(user='user-admin'): """ Lists Juju Models Arguments: user: Name of user to list models for. Returns: Dictionary of known Juju Models (default: user-admin) """ models = juju.CLIENT.ModelManager(request='ListModels', params=...
flexible
{ "blob_id": "11045cffc6d47902be7236e1d684422317f2c5f9", "index": 1444, "step-1": "<mask token>\n\n\n@juju.requires_login\ndef list_models(user='user-admin'):\n \"\"\" Lists Juju Models\n\n Arguments:\n user: Name of user to list models for.\n\n Returns:\n Dictionary of known Juju Models (default: ...
[ 1, 2, 3, 4, 5 ]
#Get roll numbers, name & marks of the students of a class(get from user) and store these details in a file- marks.txt count = int(input("How many students are there in class? ")) fileObj = open('marks.txt',"w") for i in range(count): print("Enter details for student",(i+1),"below:") rollNo = int(input("Rolln...
normal
{ "blob_id": "74cb06ffa41748af431b46c9ff98eb91771a5015", "index": 537, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(count):\n print('Enter details for student', i + 1, 'below:')\n rollNo = int(input('Rollno: '))\n name = input('Name: ')\n marks = float(input('Marks: '))\n r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def jwt_error_handler(error): code = 401 messages = list(getattr(error, 'args', [])) return mk_errors(code, messages) <|reserved_special_token_0|> def validation_error_handler(error): code = getattr(error, 'status_code', 500) messages = getattr(error, 'messages', [...
flexible
{ "blob_id": "e1da3255668999c3b77aa8c9332b197a9203478e", "index": 8992, "step-1": "<mask token>\n\n\ndef jwt_error_handler(error):\n code = 401\n messages = list(getattr(error, 'args', []))\n return mk_errors(code, messages)\n\n\n<mask token>\n\n\ndef validation_error_handler(error):\n code = getattr(...
[ 4, 5, 6, 7 ]
import graphene import f1hub.drivers.schema import f1hub.results.schema import f1hub.constructors.schema import f1hub.races.schema import f1hub.status.schema import f1hub.circuits.schema import f1hub.constructorresults.schema import f1hub.constructorstandings.schema import f1hub.driverstandings.schema import f1hub.lap...
normal
{ "blob_id": "05e4bcc7323b908a7b45d766ada463ce172e25c4", "index": 378, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Query(f1hub.drivers.schema.Query, f1hub.results.schema.Query, f1hub.\n constructors.schema.Query, f1hub.races.schema.Query, f1hub.status.\n schema.Query, f1hub.circuits.sch...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RandomTest: def __init__(self, seed=42, deterministic=False): self.seed = seed self.deterministic = deterministic @fixed_random def test_function(self, i): return [random.randint(0, 10) for x in range(10)] <|reserved_special_token_0|> <|rese...
flexible
{ "blob_id": "7ee5779625d53ff1e18f73b20ba5849666f89b55", "index": 2111, "step-1": "<mask token>\n\n\nclass RandomTest:\n\n def __init__(self, seed=42, deterministic=False):\n self.seed = seed\n self.deterministic = deterministic\n\n @fixed_random\n def test_function(self, i):\n retur...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class Tags(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: ordering = '-created_at', class Newsl...
flexible
{ "blob_id": "71503282e58f60e0936a5236edc094f1da937422", "index": 6565, "step-1": "<mask token>\n\n\nclass Tags(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = '-created_at',\n\n\nclass Newsletter(m...
[ 5, 7, 8, 10, 11 ]
n = input() n = list(n) n.sort() alph = [] num = [] 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)
normal
{ "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|> class PredictionRequest(BaseModel): feature_vector: List[float] score: Optional[bool] = False @app.post('/prediction') def predict(req: PredictionRequest): prediction = clf.predict([req.feature_vector]) response = {'is_inlier': int(prediction[0])} score = clf.score_s...
flexible
{ "blob_id": "d6fa3039c0987bf556c5bd78b66eb43543fd00fe", "index": 6343, "step-1": "<mask token>\n\n\nclass PredictionRequest(BaseModel):\n feature_vector: List[float]\n score: Optional[bool] = False\n\n\n@app.post('/prediction')\ndef predict(req: PredictionRequest):\n prediction = clf.predict([req.featur...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @spotify.route('/callback') def callback(): auth_code = request.args['code'] code_payload = {'grant_type': 'authorization_code', 'code': str( auth_code), 'redirect_uri': REDIRECT_URI} base64encoded = base64.b64encode(bytes('{}:{}'.format(SPOTIFY_CLIENT_ID, SPOT...
flexible
{ "blob_id": "f080191fec4e56adc4013da74c840817e88caf56", "index": 869, "step-1": "<mask token>\n\n\n@spotify.route('/callback')\ndef callback():\n auth_code = request.args['code']\n code_payload = {'grant_type': 'authorization_code', 'code': str(\n auth_code), 'redirect_uri': REDIRECT_URI}\n base6...
[ 2, 3, 4, 5, 6 ]
import FWCore.ParameterSet.Config as cms maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) readFiles = cms.untracked.vstring() secFiles = cms.untracked.vstring() source = cms.Source ("PoolSource",fileNames = readFiles, secondaryFileNames = secFiles) readFiles.extend( [ '/store/mc/Summer12_DR53X...
normal
{ "blob_id": "965bb4c8e7d6650dab7f002645dceacab59a0c5c", "index": 7298, "step-1": "<mask token>\n", "step-2": "<mask token>\nreadFiles.extend([\n '/store/mc/Summer12_DR53X/TTH_Inclusive_M-115_8TeV_pythia6/AODSIM/PU_S10_START53_V7A-v1/00000/FE26AAB2-D90B-E211-AD0F-0025902009B8.root'\n ,\n '/store/mc/Sum...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # python/motorcycle.py Author "Nathan Wycoff <nathanbrwycoff@gmail.com>" Date 06.23.2019 # Run a CGAN on the motorcycle data. import keras import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt np.random.seed(123) import tensorflow as tf from scipy.opt...
normal
{ "blob_id": "aba3e0907e59bc5125759e90d3c784ceb97fca80", "index": 9941, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(123)\n<mask token>\ntf.enable_eager_execution()\ntf.set_random_seed(123)\n<mask token>\ngen.add(tf.keras.layers.Dense(H, input_dim=P + R, activation=tf.keras.\n activati...
[ 0, 1, 2, 3, 4 ]
import random a = input('Nome do primeiro aluno: ') b = input('Nome do segundo aluno: ') c = input('Nome do terceiro aluno: ') d = input('Nome do quarto aluno: ') names = [a, b, c, d] print('O aluno escolhido é {}.'.format(random.choice(names)))
normal
{ "blob_id": "bac3cee5e6d129fcf345d92000cb2a257c303dd5", "index": 9805, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('O aluno escolhido é {}.'.format(random.choice(names)))\n", "step-3": "<mask token>\na = input('Nome do primeiro aluno: ')\nb = input('Nome do segundo aluno: ')\nc = input('Nome d...
[ 0, 1, 2, 3 ]
import random s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+=-/.,;'[]{}:<>?" i = 0 fin = "" while i == 0: num = int(input("What length do you want? ")) password = "".join(random.sample(s, num)) print(password) j = 0 while(j ==0): want = input("Do you this ...
normal
{ "blob_id": "3089dba0956151bd43e443b679ec0b24da644d08", "index": 3701, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i == 0:\n num = int(input('What length do you want? '))\n password = ''.join(random.sample(s, num))\n print(password)\n j = 0\n while j == 0:\n want = input('D...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('accounts.views', url('^$', 'home', name='home'), url('^login/$', 'login', name='login'), url('^logout/$', 'logout', name ='logout'), url('^register/$', 'register', name='register'), url( '^dashb...
flexible
{ "blob_id": "798ddd4a6e4febb4664bf1c973877628d1a45c71", "index": 368, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('accounts.views', url('^$', 'home', name='home'),\n url('^login/$', 'login', name='login'), url('^logout/$', 'logout', name\n ='logout'), url('^register/$', 'r...
[ 0, 1, 2, 3 ]
""" Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it without extra space and in O(n) runtime? Example: Input: [4,3,2,7,8,2,3,1] Output: [2,3] """ # O(n) TC and SC class Solution: ...
normal
{ "blob_id": "5cfd7744f98c80483cb4dd318c17a7cd83ed3ae3", "index": 758, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def findDuplicates(self, nums: List[int]) ->List[int]:\n res = []\n for num in nums:\n if nums[ab...
[ 1, 2, 3, 4, 5 ]
import requests from bs4 import BeautifulSoup import re # if no using some headers, wikiloc answers HTML error 503, probably they protect their servers against scrapping headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0',} def main(): print("################...
normal
{ "blob_id": "5a4a014d07cf312f148e089ea43484f663ce32bc", "index": 8586, "step-1": "<mask token>\n\n\ndef main():\n print('##############################')\n response = requests.get(\n 'http://www.muenchen.de/rathaus/Serviceangebote/familie/kinderbetreuung/corona.html#geschlossene-kitas-oder-kitagrupp...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python import math def Main(): try: radius = float(input("Please enter the radius: ")) area = math.pi * radius**2 print("Area =", area) except: print("You did not enter a number") if __name__ == "__main__": Main()
normal
{ "blob_id": "33c4e0504425c5d22cefb9b4c798c3fd56a63771", "index": 3641, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Main():\n try:\n radius = float(input('Please enter the radius: '))\n area = math.pi * radius ** 2\n print('Area =', area)\n except:\n print('You...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BackgroundCheck(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def predict_proba(self, x): return self.prob_background(x) class GaussianEstimation(object): def __init__(...
flexible
{ "blob_id": "d61b04539295f6b25e7f6589d32f313e3c6df82f", "index": 1180, "step-1": "<mask token>\n\n\nclass BackgroundCheck(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def predict_proba(self, x):\n return self.prob_background(x)\n\n\nclass GaussianEstimation(objec...
[ 8, 10, 12, 13, 17 ]
import sys import array import random import math import gameduino2.prep import zlib import struct import gameduino as GD from eve import align4 from PIL import Image import numpy as np import wave import common GLOWR = (128, 256) GLOWR = (160, 400) sys.path.append("/home/jamesb/git/gd2-asset/examples/nightstrike") ...
normal
{ "blob_id": "2471daad5969da29a20417a099a3ecd92fa036b4", "index": 6393, "step-1": "<mask token>\n\n\nclass Renderer(common.Branded):\n\n def __init__(self, eve):\n self.eve = eve\n self.t = 0\n\n def load(self):\n eve = self.eve\n eve.cc(open(\n '/home/jamesb/git/gd2-a...
[ 4, 5, 6, 7, 8 ]
''' * @file IntQueue.py * @author (original JAVA) William Fiset, william.alexandre.fiset@gmail.com * liujingkun, liujkon@gmail.com * (conversion to Python) Armin Zare Zadeh, ali.a.zarezadeh@gmail.com * @date 23 Jun 2020 * @version 0.1 * @brief This file contains an implementation of an inte...
normal
{ "blob_id": "0ed99037d7ff708b7931fbc3553b1aeb19a20f53", "index": 810, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass IntQueue(Queue):\n <mask token>\n\n def __init__(self, maxSize):\n \"\"\"\n maxSize is the maximum number of items\n that can be in the queue at any given time...
[ 0, 8, 11, 12, 13 ]
''' Author: Iris Peng. Date: Feb 21, 2016 Usage: Scrape Weibo posts from Zhongsou for the first time for a query In the terminal, type $ python3 scrape_weibo.py and follow the prompts ''' import requests from bs4 import BeautifulSoup from pandas import DataFrame import time import pandas import glob, os global QUE...
normal
{ "blob_id": "ed3fbae19c88100690dd5c558c0dc6d36a4849c8", "index": 1451, "step-1": "<mask token>\n\n\nclass NewScrape:\n\n def scrape_main(self):\n \"\"\"\n Top-level function.\n Use links from below, scrape a page, sleep for 5s, and restart on the next link.\n \"\"\"\n for i ...
[ 9, 12, 13, 14, 15 ]
from django.contrib import admin # from .models import Product, Client from .models import Board admin.site.register(Board) # admin.site.register(Product) # # admin.site.register(Price) # admin.site.register(Client) # # Register your models here.
normal
{ "blob_id": "ea323a8398ceff8496e7f8d0f365d50f3115e954", "index": 5228, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Board)\n", "step-3": "from django.contrib import admin\nfrom .models import Board\nadmin.site.register(Board)\n", "step-4": "from django.contrib import admin\n# fr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Song(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class File(Base): __tablename__ = 'files' id = Column(Integer, primary_key=True) filename = Column(String, nullable=False) ...
flexible
{ "blob_id": "d5c2b73c202c9944cd64798ef5ddc08ce68a4a9a", "index": 3446, "step-1": "<mask token>\n\n\nclass Song(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass File(Base):\n __tablename__ = 'files'\n id = Column(Integer, primary_key=True)\n filename = Column(Stri...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math', 'Programming'], 'languages': ['C++', 'Python', 'Java']} myInt = 123 myFloat = 12.3333 myName = 'Somesh Thakur'
flexible
{ "blob_id": "345967e2aeafda6ce30cbbbbacf976c97b17def7", "index": 515, "step-1": "<mask token>\n", "step-2": "myDict = {'Friends': ['AP', 'Soham', 'Baba'], 'Likes': ['Math',\n 'Programming'], 'languages': ['C++', 'Python', 'Java']}\nmyInt = 123\nmyFloat = 12.3333\nmyName = 'Somesh Thakur'\n", "step-3": nul...
[ 0, 1 ]
from src.secStructure import * from suffix_trees import STree import math import re def test_processData(): # Test1: ignoring peak position data = ['example/example1.fa', 'example/example2.fa'] struct_data = ['example/exampleStrucData/exampleStructuralData1.fa', 'example/exampleStrucDat...
normal
{ "blob_id": "60b1a77d2de4a52ae9597f88917c4a3996c99923", "index": 5626, "step-1": "<mask token>\n\n\ndef test_createColorVector():\n k = 2\n no_sec_peak = 1\n template = 'EEESSSIIISSSBBBSSSHHHSSSSSSIIISSSEEE'\n kmer_counts = {'EE': 5, 'ES': 7, 'SS': 20, 'SI': 10, 'II': 15, 'IS': 11,\n 'SB': 5, ...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/env python # coding: utf-8 import logging import config def get_common_logger(name='common', logfile=None): ''' args: name (str): logger name logfile (str): log file, use stream handler (stdout) as default. return: logger obj ''' my_logger = logging.getLogger(name) ...
normal
{ "blob_id": "1754bce54a47cb78dce3b545d3dce835a4e0e69f", "index": 947, "step-1": "<mask token>\n\n\ndef get_common_logger(name='common', logfile=None):\n \"\"\"\n args: name (str): logger name\n logfile (str): log file, use stream handler (stdout) as default.\n return:\n logger obj\n \"\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(1 / 2 * 2) <|reserved_special_token_1|> print(1/2 * 2) # division ret
flexible
{ "blob_id": "2c1e51f2c392e77299463d95a2277b3d2ca7c299", "index": 4336, "step-1": "<mask token>\n", "step-2": "print(1 / 2 * 2)\n", "step-3": "print(1/2 * 2) # division ret\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import matplotlib.pyplot as plt import sys sys.path.append('coin_flipping_src') from monte_carlo import monte_carlo from probability import probability plt.style.use('bmh') x_coords = range(10) probablility_results = [probability(x,10) for x in x_coords] plt.plot(x_coords,probablility_results,linewidth = 2.5) # plt.plo...
normal
{ "blob_id": "124d7da330aa7c869320e10f4f89cc1c872f85f2", "index": 430, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('coin_flipping_src')\n<mask token>\nplt.style.use('bmh')\n<mask token>\nplt.plot(x_coords, probablility_results, linewidth=2.5)\nfor _ in range(5):\n plt.plot(x_coords, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> myxlobject.convert_sheet_to_dict(file_path='Soul Breaks.xlsx', sheet= 'First Sheet', filter_variables_dict={'User Type': 'Admin', 'Environment': 'Dev'}) <|reserved_special_token_1|> <|reserved_special_token_0|> myxlobje...
flexible
{ "blob_id": "8ec981bf8746e09d3865bc20dcfbf2fbd797c145", "index": 7511, "step-1": "<mask token>\n", "step-2": "<mask token>\nmyxlobject.convert_sheet_to_dict(file_path='Soul Breaks.xlsx', sheet=\n 'First Sheet', filter_variables_dict={'User Type': 'Admin',\n 'Environment': 'Dev'})\n", "step-3": "<mask t...
[ 0, 1, 2, 3, 4 ]
''' Handprint module for handling credentials. Authors ------- Michael Hucka <mhucka@caltech.edu> -- Caltech Library Copyright --------- Copyright (c) 2018-2022 by the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see the file "LICENSE" for mor...
normal
{ "blob_id": "7e29220752b4a52be34cdf0c734695d1052d0414", "index": 9309, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .base import Credentials\nfrom .amazon_auth import AmazonCredentials\nfrom .google_auth import GoogleCredentials\nfrom .microsoft_auth import MicrosoftCredentials\n", "step-3": "''...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ALPACA_KEY = 'Enter your apaca key here' ALPACA_SECRET_KEY = 'Enter your apaca secret key here' ALPACA_MARKET = 'enter alpaca market link here' TWILIO_KEY = 'enter your twilio key here' TWILIO_SECRET_KEY = 'enter your twilio secret key here' YOUR_PHONE_NUMBER...
flexible
{ "blob_id": "10cb4b59d1e1e823c56ae5ceea0514b1c1904292", "index": 3769, "step-1": "<mask token>\n", "step-2": "ALPACA_KEY = 'Enter your apaca key here'\nALPACA_SECRET_KEY = 'Enter your apaca secret key here'\nALPACA_MARKET = 'enter alpaca market link here'\nTWILIO_KEY = 'enter your twilio key here'\nTWILIO_SECR...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('file.txt', 'r') as fh: data = fh.readline() <|reserved_special_token_0|> for key in lis: if key in my_dict.keys(): my_dict[key] += 1 else: my_dict[key] = 1 print(my_dict) <|reserved_special_token_1|> with open('file.t...
flexible
{ "blob_id": "8cd582915c5abd96a4ef8a3a5309311f2a73a156", "index": 460, "step-1": "<mask token>\n", "step-2": "with open('file.txt', 'r') as fh:\n data = fh.readline()\n<mask token>\nfor key in lis:\n if key in my_dict.keys():\n my_dict[key] += 1\n else:\n my_dict[key] = 1\nprint(my_dict)\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(User) admin.site.register(UserProfile) admin.site.register(Lead) admin.site.register(Agent) admin.site.register(Category) <|reserved_special_token_1|> from django.contrib import admin from .models import Use...
flexible
{ "blob_id": "55d184a9342b40fe027913e46933325bb00e33a6", "index": 5386, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(User)\nadmin.site.register(UserProfile)\nadmin.site.register(Lead)\nadmin.site.register(Agent)\nadmin.site.register(Category)\n", "step-3": "from django.contrib impo...
[ 0, 1, 2 ]
import os, subprocess, time from os.path import isfile, join import shutil # to move files from af folder to another import math def GetListFile(PathFile, FileExtension): return [os.path.splitext(f)[0] for f in os.listdir(PathFile) if isfile(join(PathFile, f)) and os.path.splitext(f)[1] == '.' + FileExtension] d...
normal
{ "blob_id": "8b671404228642f7ef96844c33ac3cee402bdb19", "index": 1279, "step-1": "import os, subprocess, time\nfrom os.path import isfile, join\nimport shutil # to move files from af folder to another\nimport math\n\ndef GetListFile(PathFile, FileExtension):\n return [os.path.splitext(f)[0] for f in os.listdi...
[ 0 ]
<|reserved_special_token_0|> def aanderaa_read_universal(port, max_retry=3, parsers=[aanderaa_4531d. parse_4531d, aanderaa_4330f.parse_4330f, aanderaa_3835.parse_3835, aanderaa_4319a.parse_4319a]): logger.debug('aanderaa_read_universal()') with Serial(port, 9600, timeout=2) as ser: r = None ...
flexible
{ "blob_id": "c52ad4040c14471319939605c400ff4d4ad982a7", "index": 5213, "step-1": "<mask token>\n\n\ndef aanderaa_read_universal(port, max_retry=3, parsers=[aanderaa_4531d.\n parse_4531d, aanderaa_4330f.parse_4330f, aanderaa_3835.parse_3835,\n aanderaa_4319a.parse_4319a]):\n logger.debug('aanderaa_read_u...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class tlimit: def __init__(self, name, text): self.name = name self.text = text <|reserved_special_token_0|> class SensorData: date = datetime.datetime(1970, 1, 1, 0, 0, 0) server_room_temperature = 0.0 server_room_humidity = 0.0 def __init__(self...
flexible
{ "blob_id": "cb9ea8791009a29a24a76bc2b161e7f8599fec1b", "index": 5780, "step-1": "<mask token>\n\n\nclass tlimit:\n\n def __init__(self, name, text):\n self.name = name\n self.text = text\n\n\n<mask token>\n\n\nclass SensorData:\n date = datetime.datetime(1970, 1, 1, 0, 0, 0)\n server_room...
[ 12, 13, 14, 18, 20 ]
import sys ''' Given a string, does the string contain an equal number of uppercase and lowercase letters? Ignore whitespace, numbers, and punctuation. Return the string “true” if balanced or the string “false” if not balanced. ''' for line in sys.stdin: lower = 0 upper = 0 # Count number of lowercase a...
normal
{ "blob_id": "4b3664153940b064b424bd77de473a6409437f88", "index": 3279, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n lower = 0\n upper = 0\n for x in range(0, len(line)):\n if 'a' <= line[x] <= 'z':\n lower = lower + 1\n elif 'A' <= line[x] <= '...
[ 0, 1, 2, 3 ]
from django.db import models # db에 있는 models을 가져옴 from django.utils import timezone # 유틸에 있는 timezone을 가져옴 # Create your models here. class Post(models.Model): # Post라는 객체를 정의함 인수로 장고모델을 가져왔음 # 장고모델이기 때문에 데이터베이스에 저장된다. author = models.ForeignKey('auth.User') # 외래키, 다른 객체에 대한 링크 title = models.Char...
normal
{ "blob_id": "3aa8c9b39174f0ed5799d6991516b34ca669b7d6", "index": 9765, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.title\n\n\nclass User(models.Mod...
[ 6, 7, 8, 9, 10 ]
from PyQt5.QtCore import QObject, pyqtSlot from Controllers.BookController import BookController from Model.BookModel import BookModel from Controllers.DatabaseController import DatabaseController #Issuance Controller class contains the issuance properties and performs database operations for the issuance class Issuan...
normal
{ "blob_id": "1d4df09256324cce50fad096cdeff289af229728", "index": 3132, "step-1": "<mask token>\n\n\nclass IssuanceController(QObject):\n\n def __init__(self, model):\n super().__init__()\n self._database_controller = DatabaseController()\n self._model = model\n <mask token>\n\n @pyq...
[ 8, 9, 12, 13, 14 ]
import os import hashlib import argparse def hashfile(path, blocksize=65536): afile = open(path, 'rb') hasher = hashlib.md5() buf = afile.read(blocksize) while len(buf) > 0: hasher.update(buf) buf = afile.read(blocksize) afile.close() return hasher.hexdigest() def make_duplic...
normal
{ "blob_id": "e99c158e54fd86b00e4e045e7fb28d961089800d", "index": 3289, "step-1": "<mask token>\n\n\ndef hashfile(path, blocksize=65536):\n afile = open(path, 'rb')\n hasher = hashlib.md5()\n buf = afile.read(blocksize)\n while len(buf) > 0:\n hasher.update(buf)\n buf = afile.read(blocks...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ObjectDetectionResult(object): def __init__(self, ltx=0, lty=0, rbx=0, rby=0, text=None): self.object_class = 0 self.confidence = 0 self.lt = Point(ltx, lty) self.rb = Point(rbx, rby) self.result_text = text def IsRectInvalid(self): ...
flexible
{ "blob_id": "0ceb9eac46e3182821e65a1ae3a69d842db51e62", "index": 7879, "step-1": "<mask token>\n\n\nclass ObjectDetectionResult(object):\n\n def __init__(self, ltx=0, lty=0, rbx=0, rby=0, text=None):\n self.object_class = 0\n self.confidence = 0\n self.lt = Point(ltx, lty)\n self.r...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 3.0.7 on 2020-06-15 15:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products', '0003_auto_20200615_1225'), ] operations = [ migrations.AlterField( model_name='product', name='harmoniza...
normal
{ "blob_id": "c382b298cce8d7045d6ce8a84f90b3800dba7717", "index": 297, "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 = [('products', '...
[ 0, 1, 2, 3, 4 ]
import os, glob, argparse, json, re from collections import defaultdict import numpy as np import pandas as pd from utils.CONSTANTS import output_dir, all_chromosomes, BINNED_CHRSZ, dataset_expts def extract_chrom_num(s): m = re.search('\d+', s) if m is None: return 24 else: return int(m.group(0)) de...
normal
{ "blob_id": "c6d61a0159073304309cd4b1534ed5aed666bab5", "index": 3666, "step-1": "<mask token>\n\n\ndef main(expt_set, chrom, checkpoint_code, dataset='val', model_list=[],\n directory=None):\n if directory is None:\n directory = output_dir\n model_list = sorted(model_list, key=extract_chrom_num)...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): import sys from pyramid.paster import get_appsettings from sqlalchemy import engine_from_config from pyvideohub.models import ScopedSession, Base config_file = sys.argv[1] settings = get_appsettings(config_file) engine ...
flexible
{ "blob_id": "dbb66930edd70729e4df7d3023e83a6eae65cccd", "index": 1030, "step-1": "<mask token>\n", "step-2": "def main():\n import sys\n from pyramid.paster import get_appsettings\n from sqlalchemy import engine_from_config\n from pyvideohub.models import ScopedSession, Base\n config_file = sys....
[ 0, 1, 2, 3 ]
""".. Ignore pydocstyle D400.""" from rolca.payment.api.views import ( PaymentViewSet, ) routeList = ((r'payment', PaymentViewSet),)
normal
{ "blob_id": "2bfdc259bcd5ff058ee8661a14afd8a915b8372b", "index": 7020, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouteList = ('payment', PaymentViewSet),\n", "step-3": "<mask token>\nfrom rolca.payment.api.views import PaymentViewSet\nrouteList = ('payment', PaymentViewSet),\n", "step-4": "\"\"\...
[ 0, 1, 2, 3 ]
#While Loop count = 0 while count<9: print("Number:",count) count = count+1 print("Good Bye") #For Loop fruits = ['Mango','Grapes','Apple'] for fruit in fruits: print("current fruits:",fruit) print("Good bye")
normal
{ "blob_id": "9b3040fa02cf8f039bac146f8a73384731c56722", "index": 9142, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile count < 9:\n print('Number:', count)\n count = count + 1\nprint('Good Bye')\n<mask token>\nfor fruit in fruits:\n print('current fruits:', fruit)\nprint('Good bye')\n", "...
[ 0, 1, 2, 3 ]
#!/usr/bin/python3 """ This module contains a Fabric function definition. """ from datetime import datetime, time from fabric.api import * from pathlib import Path def do_pack(): timestamp = datetime.utcnow().strftime("%Y%m%d%H%M%S") archive = "web_static_" + timestamp + ".tgz" local("mkdir -p version...
normal
{ "blob_id": "6f3de70267956a6c7c3c5b261cf591051de4c548", "index": 1968, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef do_pack():\n timestamp = datetime.utcnow().strftime('%Y%m%d%H%M%S')\n archive = 'web_static_' + timestamp + '.tgz'\n local('mkdir -p versions')\n local('tar -cvzf vers...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('hello guys') print('hello everyone') <|reserved_special_token_1|> print ("hello guys") print ("hello everyone")
flexible
{ "blob_id": "4d87c3f70809bbd488159f0b55131af903c7e7b4", "index": 1509, "step-1": "<mask token>\n", "step-2": "print('hello guys')\nprint('hello everyone')\n", "step-3": "print (\"hello guys\")\nprint (\"hello everyone\")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def over_nine_thousand(lst): sum = 0 for number in lst: sum += number if sum > 9000: break return sum <|reserved_special_token_0|> <|reserved_special_token_1|> def over_nine_thousand(lst): sum = 0 for numbe...
flexible
{ "blob_id": "c2f39e33030cbe7c5d4827b47fb28d7604bdbc6d", "index": 8135, "step-1": "<mask token>\n", "step-2": "def over_nine_thousand(lst):\n sum = 0\n for number in lst:\n sum += number\n if sum > 9000:\n break\n return sum\n\n\n<mask token>\n", "step-3": "def over_nine_thou...
[ 0, 1, 2, 3 ]
from abstract_class_V import V import torch import torch.nn as nn class V_test_abstract(V): def __init__(self): super(V_test_abstract, self).__init__() def V_setup(self,y,X,nu): self.explicit_gradient = False self.need_higherorderderiv = True self.dim = X.shape[1] self...
normal
{ "blob_id": "27e9e63338d422b5fca6f7a67fa3d255602a3358", "index": 225, "step-1": "<mask token>\n\n\nclass V_test_abstract(V):\n\n def __init__(self):\n super(V_test_abstract, self).__init__()\n <mask token>\n\n def forward(self):\n z = self.beta[:self.dim]\n r1_local = self.beta[self...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Users(MethodView): <|reserved_special_token_0|> <|reserved_special_token_0|> def put(self): pass <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Users(MethodView): def get(self): return jsonify({...
flexible
{ "blob_id": "781ce153d5053078ee11cecc13d055a67999a651", "index": 3800, "step-1": "<mask token>\n\n\nclass Users(MethodView):\n <mask token>\n <mask token>\n\n def put(self):\n pass\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Users(MethodView):\n\n def get(self):\n return ...
[ 2, 4, 5, 6, 7 ]
string1 = "Vegetable" #string2 = "Fruit" string2 = "vegetable" print(string1 == string2) print(string1 != string2) if string1.lower() == string2.lower(): print("The strings are equal") else: print("The strings are not equal") number1 = 25 number2 = 30 # == # != # > # < # >= # <= if number1 <...
normal
{ "blob_id": "fecaf41152e8c98784585abfdb3777fc0a4824f3", "index": 1052, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(string1 == string2)\nprint(string1 != string2)\nif string1.lower() == string2.lower():\n print('The strings are equal')\nelse:\n print('The strings are not equal')\n<mask toke...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @app.route('/') def index(date=''): date = request.args.get('date') if not date: now = datetime.datetime.now() date = '%02d.%02d.%04d' % (now.day, now.month, now.year) conn = sqlite3.connect('data.db') c = conn.cursor() res = c.execute( "SELECT ...
flexible
{ "blob_id": "f6fe33e04ccdca1d9714caec412478d0cfc8b363", "index": 5559, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index(date=''):\n date = request.args.get('date')\n if not date:\n now = datetime.datetime.now()\n date = '%02d.%02d.%04d' % (now.day, now.month, now.year)\n conn = sqli...
[ 1, 2, 3, 4, 5 ]
__author__ = 'NikolaiEgorov' def Lad(a1, a2, b1, b2): if (a1 == b1) | (a2 == b2): return 'YES' else: return 'NO' a1 = int(input()) a2 = int(input()) b1 = int(input()) b2 = int(input()) print(Lad(a1, a2, b1, b2))
normal
{ "blob_id": "0f55b598058b65c9dbf9cd4761d1ff6fc7091b19", "index": 8791, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Lad(a1, a2, b1, b2):\n if (a1 == b1) | (a2 == b2):\n return 'YES'\n else:\n return 'NO'\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef Lad(a1, a2, b1...
[ 0, 1, 2, 3 ]
#import bmm_mysql_connect # Import my connection module import csv import MySQLdb import os #bmm_mysql_connect.connect() # Connecting to mysql test database #mycur = conn.cursor() # Creating my cursor path = os.path.expanduser('~/Projects/bmm_private/login_test.txt') login = csv.reade...
normal
{ "blob_id": "4569413c8ea985a010a1fea4835a5b368a23663a", "index": 9455, "step-1": "#import bmm_mysql_connect # Import my connection module\nimport csv \nimport MySQLdb \nimport os\n\n#bmm_mysql_connect.connect() # Connecting to mysql test database\n#mycur = conn.cursor() # Creating my cu...
[ 0 ]
<|reserved_special_token_0|> class UserClass(AbstractBaseUser): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "8a1f024be00200218782c919b21161bf48fc817e", "index": 7805, "step-1": "<mask token>\n\n\nclass UserClass(AbstractBaseUser):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token...
[ 20, 31, 32, 36, 37 ]
<|reserved_special_token_0|> def final_option(dict_of_options, back): """ adds the final option to the dictionary based on a boolean :param dict_of_options: dictionary with readable labels as keys and uncalled functions as values. It is important that these functions don't require parameters. ...
flexible
{ "blob_id": "f28b47e1b07011ce9d0708331f68d7f16195c567", "index": 7225, "step-1": "<mask token>\n\n\ndef final_option(dict_of_options, back):\n \"\"\"\n adds the final option to the dictionary based on a boolean\n\n :param dict_of_options: dictionary with readable labels as keys and uncalled functions as...
[ 8, 10, 11, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2): shaan.forward(200) shaan.right(90) shaan.forward(250) shaan.right(90) shaan.left(60) for i in range(4): shaan.forward(200) shaan.right(120) shaan.forward(100) shaan.left(150) shaan.forwar...
flexible
{ "blob_id": "6f13ebe7355d530ba3403aab54b313ecf35b1261", "index": 4523, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2):\n shaan.forward(200)\n shaan.right(90)\n shaan.forward(250)\n shaan.right(90)\nshaan.left(60)\nfor i in range(4):\n shaan.forward(200)\n shaan.right(1...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> data data.describe() data.dtypes pd.crosstab(data.salary, data.left) pd.crosstab(data.salary, data.left).plot(kind='bar') plt.show() <|reserved_special_token_0|> print(q) print(q.sum(1)) print(q.div(q.sum(1), axis=0)) q.div(q.sum(...
flexible
{ "blob_id": "a1bf4b941b845b43ec640b19a001e290b46c488c", "index": 7021, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata\ndata.describe()\ndata.dtypes\npd.crosstab(data.salary, data.left)\npd.crosstab(data.salary, data.left).plot(kind='bar')\nplt.show()\n<mask token>\nprint(q)\nprint(q.sum(1))\nprint(q...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for eachfile in os.listdir(desktop_directory): if os.path.isfile(desktop_directory + eachfile): fileName, fileExtension = os.path.splitext(eachfile) if all(fileExtension != e for e in exclude_these): ...
flexible
{ "blob_id": "805b64a7bd727a88081a6ead574fff9b1542070f", "index": 2023, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor eachfile in os.listdir(desktop_directory):\n if os.path.isfile(desktop_directory + eachfile):\n fileName, fileExtension = os.path.splitext(eachfile)\n if all(fileExte...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class ModelInfo: <|reserved_special_token_0|> <|reserved_special_token_1|> class ModelInfo: def __init__(self, name: str, path: str, filter: str): self.name: str = name self.path: str = path self.filter: str = filter
flexible
{ "blob_id": "def089c2749444797ac3079809c082dacab08554", "index": 1167, "step-1": "<mask token>\n", "step-2": "class ModelInfo:\n <mask token>\n", "step-3": "class ModelInfo:\n\n def __init__(self, name: str, path: str, filter: str):\n self.name: str = name\n self.path: str = path\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BlogPostForm(forms.ModelForm): class Meta: model = BlogPost fields = '__all__' <|reserved_special_token_1|> from django import forms from .models import BlogPost class BlogPostForm(forms.ModelFor...
flexible
{ "blob_id": "c4624425f57211e583b5fbaec3943539ce6fea6f", "index": 88, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BlogPostForm(forms.ModelForm):\n\n\n class Meta:\n model = BlogPost\n fields = '__all__'\n", "step-3": "from django import forms\nfrom .models import BlogPost\n...
[ 0, 1, 2 ]
import azure.functions as func import json from ..common import cosmos_client def main(req: func.HttpRequest) -> func.HttpResponse: return func.HttpResponse( body = json.dumps(cosmos_client.DB.Goals), mimetype="application/json", charset="utf-8" ) # [ # {'amoun...
normal
{ "blob_id": "e38be2890526c640ba8d9db5a376ff57ba9e0aa2", "index": 8703, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(req: func.HttpRequest) ->func.HttpResponse:\n return func.HttpResponse(body=json.dumps(cosmos_client.DB.Goals),\n mimetype='application/json', charset='utf-8')\n", ...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt class LogisticRegression: '''LogisticRegression for binary classification max_iter: the maximum iteration times for training learning_rate: learing rate for gradiend decsend training Input's shape shoul...
normal
{ "blob_id": "1dd62264aafe8ee745a3cfdfb994ac6a40c1af42", "index": 1848, "step-1": "<mask token>\n\n\nclass LogisticRegression:\n <mask token>\n\n def __init__(self, max_iter=2000, learning_rate=0.01):\n self.max_iter = max_iter\n self.learning_rate = learning_rate\n print('LogisticRegre...
[ 7, 11, 13, 14, 15 ]
#!/usr/bin/env python3 import json import sys import time import zmq log_file = "./mavlink-log.txt" zmq_context = zmq.Context() connect_to = sys.argv[1] send_socket = zmq_context.socket(zmq.PUSH) send_socket.connect(connect_to) def get_first_timestamp(log_file): with open(log_file) as f: for line in f: line_...
normal
{ "blob_id": "49679782ac696b3dc4f5038565f88304a44098e1", "index": 6188, "step-1": "<mask token>\n\n\ndef get_first_timestamp(log_file):\n with open(log_file) as f:\n for line in f:\n line_json = json.loads(line)\n return line_json['timestamp']\n\n\n<mask token>\n", "step-2": "<ma...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _k, _v in _lr_action_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items <|reserved_special_token_0|> for _k...
flexible
{ "blob_id": "160f272edd8283ea561552f22c71967db4a1660a", "index": 7983, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _k, _v in _lr_action_items.items():\n for _x, _y in zip(_v[0], _v[1]):\n if not _x in _lr_action:\n _lr_action[_x] = {}\n _lr_action[_x][_k] = _y\ndel _lr_...
[ 0, 1, 2, 3 ]
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import tensorflow as tf from tensorflow.keras import datasets, layers, models import matplotlib.pyplot as plt import numpy ...
normal
{ "blob_id": "f8d815bcdc74452b66a1b3b33bf0fbe976e728c8", "index": 231, "step-1": "<mask token>\n\n\ndef dataX(features, set):\n data_x = np.array([])\n count = 0\n for filepath in glob.iglob(set):\n globpath = filepath + '\\\\*.jpg'\n for filepath in glob.iglob('' + globpath):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Consignor(db.Model): id = db.Column(db.Integer, db.ForeignKey('account.id'), primary_key=True) account = db.relationship('Account', uselist=False) indents = db.relationship('Indent', lazy='dynamic') def __init__(self): pass def __repr__(self): r...
flexible
{ "blob_id": "b6824251b1165ca6c66049d40c79fccee6bc7d3a", "index": 159, "step-1": "<mask token>\n\n\nclass Consignor(db.Model):\n id = db.Column(db.Integer, db.ForeignKey('account.id'), primary_key=True)\n account = db.relationship('Account', uselist=False)\n indents = db.relationship('Indent', lazy='dyna...
[ 8, 14, 15, 16, 18 ]
#!/usr/bin/env python """ Power calculation based for admixture mapping. @ref: Design and Analysis of admixture mapping studies, (2004). @Author: wavefancy@gmail.com Usage: PowerCalculation.py -r aratio -n nhap PowerCalculation.py -h | --help | -v | --version | -f | --format Not...
normal
{ "blob_id": "7f9046582ff03d1c72d191a8f78c911cbc8a0650", "index": 5907, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ShowFormat():\n \"\"\"File format example\"\"\"\n print(\n \"\"\"\n #rfmix output, 3 person, 2 snps\n ------------------------\n1 1 2 1 2 2\n1 2 2 1 2 2\n\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app = Flask(__name__) <|reserved_special_token_0|> <|reserved_special_token_1|> from flask import * app = Flask(__name__) from app import views from app import admin_views from app import usr_reg from app import cookie from app...
flexible
{ "blob_id": "e736991f364ba9ff709348e4b1f612b1e9673281", "index": 252, "step-1": "<mask token>\n", "step-2": "<mask token>\napp = Flask(__name__)\n<mask token>\n", "step-3": "from flask import *\napp = Flask(__name__)\nfrom app import views\nfrom app import admin_views\nfrom app import usr_reg\nfrom app impor...
[ 0, 1, 2 ]
class MinHeap: <|reserved_special_token_0|> def __init__(self): pass def insert(self, value): self.__heap.append(value) self.__sift_up() def pop(self): if len(self.__heap) == 1: return None minimum = self.__heap[1] if len(self.__heap) == 2: ...
flexible
{ "blob_id": "d412e5768b23b8bbb8f72e2ae204650bbc1f0550", "index": 8979, "step-1": "class MinHeap:\n <mask token>\n\n def __init__(self):\n pass\n\n def insert(self, value):\n self.__heap.append(value)\n self.__sift_up()\n\n def pop(self):\n if len(self.__heap) == 1:\n ...
[ 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Width x: ', width, ' Height y: ', height) print('Frame Number,x coordinate of ROI,Weidth,Height,Width/Height') <|reserved_special_token_0|> while True: j += 1 if j % 1000 != 0: continue totalframesampled...
flexible
{ "blob_id": "4bd928c16cd0f06931aad5a478f8a911c5a7108b", "index": 5850, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Width x: ', width, ' Height y: ', height)\nprint('Frame Number,x coordinate of ROI,Weidth,Height,Width/Height')\n<mask token>\nwhile True:\n j += 1\n if j % 1000 != 0:\n ...
[ 0, 1, 2, 3, 4 ]
import csv from sys import argv import re import sys datasave=[] if len(argv) is not 3: #stop usage if not correct input print('Usage: python dna.py data.csv sequence.txt') sys.exit() #open CSV file and save with open (argv[1],'r') as csv_file: datafile = csv.reader(csv_file) line_count = 0 for ...
normal
{ "blob_id": "1eeb7a539f43e9fb013494e2aa0d81b4eab0ae1a", "index": 9353, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(argv) is not 3:\n print('Usage: python dna.py data.csv sequence.txt')\n sys.exit()\nwith open(argv[1], 'r') as csv_file:\n datafile = csv.reader(csv_file)\n line_count ...
[ 0, 2, 3, 4, 5 ]
#公路工程工程量清单编码默认格式母节点为数字型式,子节点为-b字母形式,为使编码唯一便于数据处理,编制此脚本 import re import pandas as pd import os def get_csv_path():#原编码保存为csv文件的一列,便于读取 path=input('enter csv path:') if os.path.isfile(path): return path else: print('csv file not exsit,try again:') return get_csv_path() def unique_code...
normal
{ "blob_id": "857e3e04b99cb346fd89b34c0d14957d65b7ac38", "index": 9566, "step-1": "<mask token>\n\n\ndef get_csv_path():\n path = input('enter csv path:')\n if os.path.isfile(path):\n return path\n else:\n print('csv file not exsit,try again:')\n return get_csv_path()\n\n\n<mask toke...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Model: def __init__(self, training=True): self.classes = settings.classes_name self.num_classes = len(settings.classes_name) self.image_size = settings.image_size self.cell_size = settings.cell_size self.boxes_per_cell = settings.box_per_...
flexible
{ "blob_id": "8ccec24e1a7060269ffbb376ba0c480da9eabe0a", "index": 819, "step-1": "<mask token>\n\n\nclass Model:\n\n def __init__(self, training=True):\n self.classes = settings.classes_name\n self.num_classes = len(settings.classes_name)\n self.image_size = settings.image_size\n se...
[ 6, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-12 20:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('home', '0010_auto_20170512_2248'), ] o...
normal
{ "blob_id": "438efbaf35401a29ea5408fee3b49b85f237760e", "index": 1089, "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 = [('home', '001...
[ 0, 1, 2, 3, 4 ]
import gc import sys import time import warnings import multiprocessing import numpy as np import pandas as pd import lightgbm as lgb from os import path, makedirs from tqdm import tqdm from utils import Logger from datetime import datetime from sklearn.metrics import roc_auc_score from sklearn.model_s...
normal
{ "blob_id": "74c875d00c665aabbcad4e23e6059c3445d5e7bd", "index": 1597, "step-1": "<mask token>\n\n\ndef load_dataframe(dataset):\n return pd.read_csv(dataset)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef load_dataframe(dataset):\n return pd.read_csv(dataset)\n\n\ndef augment(x, y, t=2):\n xs...
[ 1, 2, 3, 4, 5 ]
yuki = list(map(int, input().split())) S = input() enemy = [S.count('G'), S.count('C'), S.count('P')] ans = 0 for i in range(3): ans += min(yuki[i], enemy[(i + 1) % 3]) * 3 yuki[i], enemy[(i + 1) % 3] = max(0, yuki[i] - enemy[(i + 1) % 3]), max( 0, enemy[(i + 1) % 3] - yuki[i]) for i in range(3): an...
normal
{ "blob_id": "ce98c13555c474de0a9cb12e99a97b2316312b00", "index": 979, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(3):\n ans += min(yuki[i], enemy[(i + 1) % 3]) * 3\n yuki[i], enemy[(i + 1) % 3] = max(0, yuki[i] - enemy[(i + 1) % 3]), max(\n 0, enemy[(i + 1) % 3] - yuki[i])\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, ...
flexible
{ "blob_id": "ba483c7eaf2f2ced7f70a14b53c781f190585024", "index": 1257, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0],\n [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0,\n 0, 0, 0,...
[ 0, 1, 2, 3, 4 ]
import nltk from nltk import bigrams from lm import * # Oppgave 1: # opretter LM klasse til aa perpleksitere news og adventure m = LM() # Henter news og adventure for videre bruk news=nltk.corpus.brown.sents(categories='news') adventure=nltk.corpus.brown.sents(categories='adventure') # initial parametre perpNews = 0...
normal
{ "blob_id": "d268f8d563aac28852457f6f130b2fb4ea6269a2", "index": 907, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Perpleksitet til news: %.2f' % perpNews)\nprint('Perpleksitet til adventure: %.2f' % perpAdventure)\n<mask token>\nfor sekvens in zippy:\n print('Ord: %4s Antall: %4d Sekvens: %...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(float(num1) + float(num2)) <|reserved_special_token_0|> print(num1 + num2) <|reserved_special_token_1|> num1 = input('첫 번째 실수 : ') num2 = input('두 번째 실수 : ') print(float(num1) + float(num2)) num1 = float(input('첫 번째 실수 : ...
flexible
{ "blob_id": "ee8bf681adcb07c4f79245c8f118131bbcabd2fa", "index": 7920, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(float(num1) + float(num2))\n<mask token>\nprint(num1 + num2)\n", "step-3": "num1 = input('첫 번째 실수 : ')\nnum2 = input('두 번째 실수 : ')\nprint(float(num1) + float(num2))\nnum1 = float(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CvPTestCase(unittest.TestCase): def onecompplayer_setup(self): game1 = TicTacToe.Game() computer1 = TicTacToe.Computer('X', game1) player2 = TicTacToe.Player('O', game1) return game1, computer1, player2 def test_place3(self): game1, ...
flexible
{ "blob_id": "de0521db3909054c333ac3877ff0adf15ab180fb", "index": 1732, "step-1": "<mask token>\n\n\nclass CvPTestCase(unittest.TestCase):\n\n def onecompplayer_setup(self):\n game1 = TicTacToe.Game()\n computer1 = TicTacToe.Computer('X', game1)\n player2 = TicTacToe.Player('O', game1)\n ...
[ 13, 15, 17, 20, 22 ]
import veil_component with veil_component.init_component(__name__): from .material import list_category_materials from .material import list_material_categories from .material import list_issue_materials from .material import list_issue_task_materials from .material import get_material_image_url ...
normal
{ "blob_id": "acad268a228b544d60966a8767734cbf9c1237ac", "index": 9979, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith veil_component.init_component(__name__):\n from .material import list_category_materials\n from .material import list_material_categories\n from .material import list_issue_...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.EpInfo import EpInfo from alipay.aop.api.domain.EpInfo import EpInfo from alipay.aop.api.domain.EpInfo import EpInfo from alipay.aop.api.domain.EpInfo import EpInfo from alipay.aop....
normal
{ "blob_id": "6743a4f3c9118e790e52b586a36d71a735101702", "index": 1901, "step-1": "<mask token>\n\n\nclass CompanyInfo(object):\n\n def __init__(self):\n self._alter_list = None\n self._basic_info = None\n self._case_info_list = None\n self._entinv_list = None\n self._fr_posi...
[ 14, 18, 19, 20, 22 ]
# Generated by Django 2.0.1 on 2018-05-01 11:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rover', '0002_auto_20180501_1431'), ] operations = [ migrations.CreateModel( name='RoverPage', fields=[ ...
normal
{ "blob_id": "fed94e0affa1fe6c705577a63fabee839aa9f05c", "index": 5096, "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 = [('rover', '00...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Calcu.py # import os, sys def menuCalc(): os.system('clear') print("Esto parece un menu:") print("\t1 - Suma") print("\t2 - Resta") print("\t3 - Multiplicacion") print("\t4 - Division") print("\tq - Para salir") def calculadora(cal...
normal
{ "blob_id": "ac033e45ea61770c302be677f4dfc95945e2cca5", "index": 6100, "step-1": "<mask token>\n\n\ndef calculadora(calcu):\n if calcu == '1':\n os.system('clear')\n s1 = int(input('Ingrese un numero\\n'))\n s2 = int(input('Ingrese otro\\n'))\n os.system('clear')\n print(f'{...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if a % 2 == 0: print('Even') else: print('Odd') <|reserved_special_token_1|> a = int(raw_input()) if a % 2 == 0: print('Even') else: print('Odd') <|reserved_special_token_1|> a=int(raw_input()) if (a%2)==0: ...
flexible
{ "blob_id": "00b06b5e6465bae3eab336441b283a9831bb93c0", "index": 4531, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a % 2 == 0:\n print('Even')\nelse:\n print('Odd')\n", "step-3": "a = int(raw_input())\nif a % 2 == 0:\n print('Even')\nelse:\n print('Odd')\n", "step-4": "a=int(raw_inp...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def start_task(display_window, daq, exp_type, parameters, file_save, signal_model=None, language_model=None, fake=True, auc_filename=None): """Creates a Task and starts execution.""" task = make_task(display_window, ...
flexible
{ "blob_id": "f2e6d23e6d8c5aa6e80a652dc6cb8bda45824d0c", "index": 1026, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef start_task(display_window, daq, exp_type, parameters, file_save,\n signal_model=None, language_model=None, fake=True, auc_filename=None):\n \"\"\"Creates a Task and starts e...
[ 0, 1, 2, 3, 4 ]
class Member: <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, first_name, middle_name, last_name, gender): self.fname = first_name self.mname = middle_name self.lname = last_name self.gender = gender Member.users_num += 1 <|reserved_s...
flexible
{ "blob_id": "f276e33cde2e043fc8f81403e499544aa816a639", "index": 9316, "step-1": "class Member:\n <mask token>\n <mask token>\n\n def __init__(self, first_name, middle_name, last_name, gender):\n self.fname = first_name\n self.mname = middle_name\n self.lname = last_name\n se...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> def segmentation_function(image, name, blue_mask=False, white_mask=False, yellow_mask=False): image = cv2.GaussianBlur(image, (11, 11), 0) hsv_image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV) low_green = np.array([30, 0, 0]) high_green = np.array([86, 255, 255]) mask...
flexible
{ "blob_id": "1614157c57b3d1b30087c42cb840d617dc91eecb", "index": 493, "step-1": "<mask token>\n\n\ndef segmentation_function(image, name, blue_mask=False, white_mask=False,\n yellow_mask=False):\n image = cv2.GaussianBlur(image, (11, 11), 0)\n hsv_image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)\n low_...
[ 1, 2, 3, 4, 5 ]
import gym import os import sys import numpy as np import theano import theano.tensor as T import matplotlib.pyplot as plt from gym import wrappers from datetime import datetime from mountain_car_v1_q_learning import Transformer # so you can test different architectures class Layer: def __init__(self, m1, m2, f=...
normal
{ "blob_id": "63ee25791177ead5389c14990ce6da3e2c11b683", "index": 6356, "step-1": "<mask token>\n\n\nclass Layer:\n\n def __init__(self, m1, m2, f=T.nnet.relu, use_bias=True, zeros=False):\n if zeros:\n w = np.zeros((m1, m2))\n else:\n w = np.random.randn(m1, m2) * np.sqrt(2...
[ 9, 11, 12, 13, 17 ]
<|reserved_special_token_0|> class KeyValueRedis: <|reserved_special_token_0|> def __init__(self, context, redis_client): """Initialize the Class properties.""" self._context = context self._redis_client = redis_client <|reserved_special_token_0|> @context.setter def cont...
flexible
{ "blob_id": "a5b74c31aed103b55404afc538af60c3eb18cb1b", "index": 9738, "step-1": "<mask token>\n\n\nclass KeyValueRedis:\n <mask token>\n\n def __init__(self, context, redis_client):\n \"\"\"Initialize the Class properties.\"\"\"\n self._context = context\n self._redis_client = redis_c...
[ 5, 6, 8, 9, 10 ]