code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
# -*- coding: utf-8 -*- """ ----------------------------------------- IDEA Name : PyCharm Project Name : HelloWorld ----------------------------------------- File Name : task_worker Description : Author : Edwin Date : 2018/1/4 23:38 ----------------------------------------- Cha...
normal
{ "blob_id": "be1bfa3e366d715d32613284924cf79abde06d41", "index": 582, "step-1": "<mask token>\n\n\nclass QueueManager(BaseManager):\n pass\n\n\ndef start_request():\n QueueManager.register('get_task_queue')\n QueueManager.register('get_result_queue')\n server_add = '127.0.0.1'\n print('Connect to ...
[ 2, 3, 4, 5, 6 ]
dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태 print(dic['name'])
normal
{ "blob_id": "09c3a10230e7d0b3b893ccf236c39fc2dc12b2c6", "index": 1097, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dic['name'])\n", "step-3": "dic = {'name': 'Eric', 'age': '25'}\nprint(dic['name'])\n", "step-4": "dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태\n\n\nprint(dic['name'])\n", ...
[ 0, 1, 2, 3 ]
import matplotlib.pyplot as plt file_list = ["Quantification_comet_fdr.csv", "Quantification_crux_fdr.csv", "Quantification_msfg_fdr.csv", "Quantification_msfg_percolator.csv"] file_titles = ["Comet", "Crux", "MSGFPlus", "MSGFPlus + Pe...
normal
{ "blob_id": "e08159a51b611ce6d0ca354a4fe6759d00af2cb7", "index": 660, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file_name in file_list:\n proteins = 0\n peptides = 0\n for line_index, line in enumerate(open(file_name, 'r')):\n if line_index > 3:\n proteins += 1\n ...
[ 0, 1, 2, 3, 4 ]
from types import * class Tokenizer: def __init__(self, buf): self.buf = buf self.index = 0 def token(self): return self.buf[self.index] def move(self, value): self.index += value def skip_whitespaces(self): while self.index < len(self.buf) and self.token()....
normal
{ "blob_id": "282bccf20cfb114e31c5465c110819796bf81bc0", "index": 9318, "step-1": "<mask token>\n\n\nclass Tokenizer:\n\n def __init__(self, buf):\n self.buf = buf\n self.index = 0\n <mask token>\n <mask token>\n\n def skip_whitespaces(self):\n while self.index < len(self.buf) and...
[ 4, 5, 6, 7, 8 ]
from pymarketo.client import MarketoClientFactory import os import sys #@UnusedImport import time #@UnusedImport import datetime #@UnusedImport from pprint import pprint #@UnresolvedImport TESTDIR = os.path.split(__file__)[0] PACKAGEDIR = os.path.join(TESTDIR,"..") INIFILE = os.path.join(PACKAGEDIR,"marketo.ini") DATA...
normal
{ "blob_id": "b05a5fcbba74bf4108bc953c6f868eb1f5ca298f", "index": 638, "step-1": "from pymarketo.client import MarketoClientFactory\nimport os\nimport sys #@UnusedImport\nimport time #@UnusedImport\nimport datetime #@UnusedImport\nfrom pprint import pprint #@UnresolvedImport\n\nTESTDIR = os.path.split(__file__)[0...
[ 0 ]
from django.urls import path, include from rest_framework.routers import SimpleRouter from board_api.views import PostViewSet, UpvoteView, CommentViewSet router = SimpleRouter() router.register(r"post", PostViewSet) router.register(r"post_upvote", UpvoteView) router.register(r"comment", CommentViewSet) urlpatterns ...
normal
{ "blob_id": "db309283137383cd698f235e7326c6e5c50f6cf3", "index": 6671, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouter.register('post', PostViewSet)\nrouter.register('post_upvote', UpvoteView)\nrouter.register('comment', CommentViewSet)\n<mask token>\n", "step-3": "<mask token>\nrouter = SimpleRo...
[ 0, 1, 2, 3, 4 ]
"""Settings module for test app.""" ENV = "development" TESTING = True SQLALCHEMY_DATABASE_URI = "sqlite://" SECRET_KEY = "not-so-secret-in-tests" DEBUG_TB_ENABLED = False SQLALCHEMY_TRACK_MODIFICATIONS = False APP_ENV = "testing" JWT_SECRET_KEY = ( "-----BEGIN RSA PRIVATE KEY-----\n" "MIICWwIBAAKBgQDdlatRjR...
normal
{ "blob_id": "909ea7b9335a858662f83abc71b4d58578bd0850", "index": 8261, "step-1": "<mask token>\n", "step-2": "<mask token>\nENV = 'development'\nTESTING = True\nSQLALCHEMY_DATABASE_URI = 'sqlite://'\nSECRET_KEY = 'not-so-secret-in-tests'\nDEBUG_TB_ENABLED = False\nSQLALCHEMY_TRACK_MODIFICATIONS = False\nAPP_EN...
[ 0, 1, 2 ]
#%% import numpy as np import cv2 import matplotlib.pyplot as plt import win32gui,win32ui,win32con,win32api import pyautogui as pg from PIL import ImageGrab import time import pandas as pd # %% def get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'): handle_of_hearthstone=win32gui.FindWindow(...
normal
{ "blob_id": "e36d2426fb8a268ab9ff4f3d6135aa72697e6326", "index": 1505, "step-1": "<mask token>\n\n\ndef get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'):\n handle_of_hearthstone = win32gui.FindWindow(lpClassName, lpWindowName)\n return win32gui.GetClientRect(handle_of_hearthstone)\n\n\ndef coun...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- from django.http import Http404 from django.shortcuts import render,render_to_response, get_object_or_404, redirect, HttpResponse from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_protect, csrf_exempt from django.template import RequestContext,Context...
normal
{ "blob_id": "fb16009985ee7fe4a467a94160f593723b5aaf03", "index": 7964, "step-1": "# -*- coding: utf-8 -*- \nfrom django.http import Http404\nfrom django.shortcuts import render,render_to_response, get_object_or_404, redirect, HttpResponse\nfrom django.core.context_processors import csrf\nfrom django.views.decora...
[ 0 ]
from __future__ import print_function import os, sys, time import fitz import PySimpleGUI as sg """ PyMuPDF utility ---------------- For a given entry in a page's getImagleList() list, function "recoverpix" returns either the raw image data, or a modified pixmap if an /SMask entry exists. The item's first two entries ...
normal
{ "blob_id": "856afd30a2ed01a1d44bbe91a7b69998e9a51bb7", "index": 3170, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef recoverpix(doc, item):\n x = item[0]\n s = item[1]\n if s == 0:\n return doc.extractImage(x)\n\n def getimage(pix):\n if pix.colorspace.n != 4:\n ...
[ 0, 1, 3, 4, 5 ]
""" Have the function CharlietheDog(strArr) read the array of strings stored in strArr which will be a 4x4 matrix of the characters 'C', 'H', 'F', 'O', where C represents Charlie the dog, H represents its home, F represents dog food, and O represents and empty space in the grid. Your goal is to figure out the least...
normal
{ "blob_id": "731110b02c8a09dc84042a99c14eef990ae33cd2", "index": 5913, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef CharlietheDog(strArr):\n\n def walk(food_home, dog, matriz, steps=0):\n food_home_dx = food_home[0][0] - dog[0]\n food_home_dy = food_home[0][1] - dog[1]\n ...
[ 0, 1, 2, 3, 4 ]
from outils import Outils class BilanComptes(object): """ Classe pour la création du bilan des comptes """ @staticmethod def bilan(dossier_destination, subedition, subgeneraux, lignes): """ création du bilan :param dossier_destination: Une instance de la classe dossier.Dos...
normal
{ "blob_id": "53c874fbe14031c323f83db58f17990f4e60bc58", "index": 2195, "step-1": "<mask token>\n\n\nclass BilanComptes(object):\n <mask token>\n <mask token>\n\n @staticmethod\n def creation_lignes(subedition, subgeneraux, consolidation):\n \"\"\"\n génération des lignes de données du b...
[ 2, 3, 4, 5, 6 ]
from platypush.message.event import Event class ClipboardEvent(Event): def __init__(self, text: str, *args, **kwargs): super().__init__(*args, text=text, **kwargs) # vim:sw=4:ts=4:et:
normal
{ "blob_id": "9b02ce0b3acb14bdd6463c5bdba865b28253767c", "index": 7896, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClipboardEvent(Event):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ClipboardEvent(Event):\n\n def __init__(self, text: str, *args, **kwargs):\n super()....
[ 0, 1, 2, 3, 4 ]
"""Integration to integrate Keymitt BLE devices with Home Assistant.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any from microbot import MicroBotApiClient, parse_advertisement_data from homeassistant.components import bluetooth from homeassistant.components.bluetooth.passi...
normal
{ "blob_id": "5509880c30c2e03ca6eb42ad32018c39fb5939ed", "index": 9955, "step-1": "<mask token>\n\n\nclass MicroBotDataUpdateCoordinator(PassiveBluetoothDataUpdateCoordinator):\n <mask token>\n\n def __init__(self, hass: HomeAssistant, client: MicroBotApiClient,\n ble_device: BLEDevice) ->None:\n ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python3 print(sum([row[lineNumber * 3 % len(row)] == '#' for lineNumber, row in enumerate(open('input.txt').read().splitlines())]))
normal
{ "blob_id": "b2fecadbd99edb89379f82a935aa1622f043eeac", "index": 9099, "step-1": "<mask token>\n", "step-2": "print(sum([(row[lineNumber * 3 % len(row)] == '#') for lineNumber, row in\n enumerate(open('input.txt').read().splitlines())]))\n", "step-3": "#!/usr/bin/env python3\n\nprint(sum([row[lineNumber *...
[ 0, 1, 2 ]
# Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of so...
normal
{ "blob_id": "08b57c00beb8dfedfee1bc032b8c281d7a151931", "index": 8033, "step-1": "<mask token>\n\n\nclass Manager(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, port, options, printer):\n \"\"\"Initializes test runner data struc...
[ 14, 20, 25, 31, 33 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.core.validators class Migration(migrations.Migration): dependencies = [ ('Registration', '0015_auto_20150525_1815'), ] operations = [ migrations.AlterField( ...
normal
{ "blob_id": "7a1be5c9c48413ba1969631e99ecb45cf15ef613", "index": 559, "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 = [('Registration...
[ 0, 1, 2, 3, 4 ]
''' Load a variety of relevant physical parameters. All quantities are in atomic units, such that m_e = 1 e = 1 hbar = 1 1/4\pi\epsilon = 1 ''' import numpy as np hbar = 1.0 m_e = 1.0 h22m = hbar**2 / (2*m_e) pi = np.pi eV = 1/27.21138505 eV_Ha = eV nm = 18.89726124565 kB_eV = 8.6173324e-5 kB = kB_e...
normal
{ "blob_id": "f9f835b24aa8fc77109db9e2d89a3f43bcb4b181", "index": 7079, "step-1": "<mask token>\n", "step-2": "<mask token>\nhbar = 1.0\nm_e = 1.0\nh22m = hbar ** 2 / (2 * m_e)\npi = np.pi\neV = 1 / 27.21138505\neV_Ha = eV\nnm = 18.89726124565\nkB_eV = 8.6173324e-05\nkB = kB_eV * eV_Ha\n", "step-3": "<mask to...
[ 0, 1, 2, 3 ]
/home/openerp/production/extra-addons/productivity_analysis/report/productivity_analysis.py
normal
{ "blob_id": "6531833a4fe57c15c0668cee9015c7d43491427a", "index": 341, "step-1": "/home/openerp/production/extra-addons/productivity_analysis/report/productivity_analysis.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
#聚类算法: # kmeans # 密度聚类:DBSCAN # 层次聚类:AgglomerativeClustering # 谱聚类:SpectralClustering # 分批kmeans:MiniBatchKMeans # 评价指标:FMI(Fowlkes–Mallows index) # 排除:特征聚类:FeatureAgglomeration# 亲和传播聚类(AP)聚类:affinity_propagation# 偏移均值向量:MeanShift import numpy as np import sklearn.cluster as cluster import os impo...
normal
{ "blob_id": "aaebd9eba8a5c51c64baaf60224720b87a6364e1", "index": 1388, "step-1": "<mask token>\n\n\n@print_run_time\ndef dbscan(train_x, train_y):\n db = cluster.DBSCAN(eps=0.2, min_samples=3)\n db.fit(train_x)\n fmi = metrics.fowlkes_mallows_score(train_y, db.labels_)\n return fmi\n\n\n<mask token>\...
[ 1, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- """ /*************************************************************************** TileMapScalePlugin A QGIS plugin Let you add tiled datasets (GDAL WMS) and shows them in the correct scale. ------------------- begin ...
normal
{ "blob_id": "f2e2ebd5b848cf3a01b7304e5e194beb3eec1c10", "index": 1214, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef classFactory(iface):\n from .tilemapscaleplugin import TileMapScalePlugin\n return TileMapScalePlugin(iface)\n", "step-3": "# -*- coding: utf-8 -*-\n\"\"\"\n/*************...
[ 0, 1, 2 ]
#!/usr/bin/python """ Expression Parser Tree for fully parenthesized input expression """ from bintree import BinaryTree from stackModule import Stack def buildParseTree(expression): expList = expression.split() empTree = BinaryTree('') parentStack = Stack() parentStack.push(empTree) currentNode ...
normal
{ "blob_id": "e18ebf961c2daa7dd127d08f85edb6ea519e3470", "index": 8359, "step-1": "#!/usr/bin/python\n\n\"\"\"\nExpression Parser Tree for fully parenthesized input expression\n\"\"\"\n\nfrom bintree import BinaryTree\nfrom stackModule import Stack\n\ndef buildParseTree(expression):\n expList = expression.spli...
[ 0 ]
from editor.editor import Editor e = Editor() e.showWindow()
normal
{ "blob_id": "46d6771fd9f589e2498cd019ba72232cbda06e5a", "index": 3108, "step-1": "<mask token>\n", "step-2": "<mask token>\ne.showWindow()\n", "step-3": "<mask token>\ne = Editor()\ne.showWindow()\n", "step-4": "from editor.editor import Editor\ne = Editor()\ne.showWindow()\n", "step-5": null, "step-id...
[ 0, 1, 2, 3 ]
from tensorflow.keras.applications.resnet50 import ResNet50 from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions import numpy as np model = ResNet50(weights='imagenet', # Learned weights on imagenet include_top=True) ...
normal
{ "blob_id": "1af6e66c19078a9ee971f608daa93247911d8406", "index": 5881, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(decoded_predictions)\n", "step-3": "<mask token>\nmodel = ResNet50(weights='imagenet', include_top=True)\nimg_input = image.load_img('my_picture.jpg', target_size=(224, 224))\nimg...
[ 0, 1, 2, 3, 4 ]
import generic name = __name__ def options(opt): generic._options(opt, name) def configure(cfg): generic._configure(cfg, name, incs=('czmq.h',), libs=('czmq',), pcname= name.lower(), uses='LIBZMQ', mandatory=True)
normal
{ "blob_id": "9e511c769f6ccedc06845a382171fb3729913d05", "index": 9767, "step-1": "<mask token>\n\n\ndef options(opt):\n generic._options(opt, name)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef options(opt):\n generic._options(opt, name)\n\n\ndef configure(cfg):\n generic._configure(cfg, name...
[ 1, 2, 3, 4 ]
""" Quick select (randomized selection algorithm) - based on quick sort (ch8_sorting); used to obtain the ith-smallest element in an unordered list of items (e.g.numbers) """ def swap(unsorted_array, a, b): temp = unsorted_array[a] unsorted_array[a] = unsorted_array[b] unsorted_array[b] = temp def part...
normal
{ "blob_id": "f9234741c6356b4677b5d32ffea86549d001c258", "index": 5625, "step-1": "<mask token>\n\n\ndef swap(unsorted_array, a, b):\n temp = unsorted_array[a]\n unsorted_array[a] = unsorted_array[b]\n unsorted_array[b] = temp\n\n\n<mask token>\n\n\ndef quick_select_helper(unsorted_array, left, right, k)...
[ 3, 4, 5, 6, 7 ]
from load_blender_data import pose_spherical from misc import mse, mse2psnr, to8b import os import imageio import json import torch import torch.nn as nn import numpy as np import cv2 from torch.utils.data.dataset import Dataset from torch.utils.data.dataloader import DataLoader device = torch.device('cuda') if tor...
normal
{ "blob_id": "7180dc0d622fd449fcee32f2c50000d05ae2d8bb", "index": 6850, "step-1": "<mask token>\n\n\nclass BlenderDataset(Dataset):\n <mask token>\n <mask token>\n\n def get_coords2d(self, H, W):\n coord = np.linspace(0, 1, H, endpoint=False)\n coords = np.stack(np.meshgrid(coord, coord), -...
[ 6, 9, 12, 14, 16 ]
from django.apps import AppConfig class LaughsappConfig(AppConfig): name = 'laughsApp'
normal
{ "blob_id": "6b785502e8a8983c164ebdffdd304da47c926acb", "index": 774, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LaughsappConfig(AppConfig):\n name = 'laughsApp'\n", "step-4": "from django.apps impor...
[ 0, 1, 2, 3 ]
from unittest.mock import MagicMock import pytest from charpe.mediums.email_handler import EmailHandler from charpe.errors import InsuficientInformation def test_send_requirements(config): handler = EmailHandler(config) with pytest.raises(InsuficientInformation): handler.publish({}) with pytest...
normal
{ "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 ]
quotes = [ "Today you are you! That is truer than true! There is no one alive who is you-er than you!", "Don't cry because it's over. Smile because it happened.", "You have brains in your head. You have feet in your shoes. You can steer yourself in any direction you choose. You're on your own, and you know what you kno...
normal
{ "blob_id": "f9ba944724b262afb39f2859b5726b961536cdf0", "index": 2092, "step-1": "<mask token>\n", "step-2": "quotes = [\n 'Today you are you! That is truer than true! There is no one alive who is you-er than you!'\n , \"Don't cry because it's over. Smile because it happened.\",\n \"You have brains in...
[ 0, 1, 2 ]
from django.shortcuts import render, HttpResponse, redirect from .models import Book, Author # This is the models.py Database # Create your views here. def main(request): context = { "the_books" : Book.objects.all(), #Book Class model.py } return render(request, "index.html", context) def book(re...
normal
{ "blob_id": "02bec34b138d53235dc944adeae8ccb8d6b3d340", "index": 4424, "step-1": "<mask token>\n\n\ndef book(request):\n Book.objects.create(title=request.POST['b_title'], desc=request.POST[\n 'b_desc'])\n return redirect('/')\n\n\ndef author(request):\n context = {'the_auths': Author.objects.all...
[ 5, 6, 7, 8, 9 ]
from bs4 import BeautifulSoup import urllib2 import datetime import re import csv import sys import time import bb_load as bb_l import pandas as pd import requests #Scrape the web for new buybacks def scrape_buybacks(): ''' (NoneType) -> scraped_database.csv, database=open('scrape_database....
normal
{ "blob_id": "276bcb2e90c30f87c618106e5e862f00d082da34", "index": 9224, "step-1": "\r\nfrom bs4 import BeautifulSoup\r\nimport urllib2\r\nimport datetime\r\nimport re\r\nimport csv\r\nimport sys\r\nimport time\r\nimport bb_load as bb_l\r\nimport pandas as pd\r\nimport requests\r\n\r\n#Scrape the web for new buyba...
[ 0 ]
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): # (119ms) def isSubtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool...
normal
{ "blob_id": "5ac4dd62d8e56c7baf38f9fe9f8b4a5034f1cb80", "index": 192, "step-1": "# Definition for a binary tree node.\n# class TreeNode(object):\n# def __init__(self, x):\n# self.val = x\n# self.left = None\n# self.right = None\n\nclass Solution(object):\n# (119ms)\n def isSubtree(...
[ 0 ]
#!/usr/bin/python3 # The uploader service listens for connections from localhost on port 3961. # It expects a JSON object on a line by itself as the request. It responds # with another JSON object on a line by itself, then closes the connection. # Atropine CGI scripts can send requests to this service to tell it to: #...
normal
{ "blob_id": "bd202e18cb98efc2b62ce4670fadcf70c35a33cb", "index": 2529, "step-1": "<mask token>\n\n\nclass UploaderThread(object):\n <mask token>\n\n def is_uploading_tourney(self, tourney):\n return tourney in self.uploading_tourneys\n <mask token>\n <mask token>\n\n def get_last_successful...
[ 19, 21, 26, 31, 34 ]
#!/usr/bin/env python #-*-coding:utf-8-*- #author:wuya import os import xlrd import json class Helper(object): '''公共方法''' def base_dir(self,filePath,folder='data'): ''' 返回公共路径 :parameter folder:文件夹 :parameter filePath:文件名称 ''' return os.path.join( os.path.dirn...
normal
{ "blob_id": "7c2349810fc757848eeb5bddef4640d87d5f9ab9", "index": 2439, "step-1": "<mask token>\n\n\nclass Helper(object):\n <mask token>\n\n def base_dir(self, filePath, folder='data'):\n \"\"\"\n 返回公共路径\n :parameter folder:文件夹\n :parameter filePath:文件名称\n \"\"\"\n return ...
[ 3, 4, 6, 7, 8 ]
import re import pandas as pd import pandas.io.formats.excel from configparser import ConfigParser from datetime import datetime from termcolor import cprint import os import shutil from openpyxl import load_workbook import numpy as np class pairtron(): def affiliation_cleaner(self, affiliation): # print(...
normal
{ "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 ]
import requests from requests import Response from auditlogging.Trail import Trail from utils.Utils import is_empty from auditlogging.agents.AuditAgent import AuditAgent class APIAuditAgent(AuditAgent): """ Captures the audit trail using a REST endpoint URL (POST) Add this agent to Auditor in order to cap...
normal
{ "blob_id": "45a57fac564f23253f9d9cd5d0fd820e559c15b9", "index": 1212, "step-1": "<mask token>\n\n\nclass APIAuditAgent(AuditAgent):\n <mask token>\n\n def __init__(self):\n self._url = 'http://localhost:3000/auditlogs/create'\n self._resp = None\n\n def change_endpoint(self, url: str):\n ...
[ 8, 9, 10, 11 ]
import sys input = sys.stdin.readline N = int(input()) A, B, C, D = [], [], [], [] for i in range(N): a, b, c, d = map(int, input().split()) A.append(a) B.append(b) C.append(c) D.append(d) AB = [] CD = [] for i in range(N): for j in range(N): AB.append(A[i] + B[j]) CD.append(C[...
normal
{ "blob_id": "2a9426653146603d9aa79a59ce181d97aa3c551c", "index": 8525, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n a, b, c, d = map(int, input().split())\n A.append(a)\n B.append(b)\n C.append(c)\n D.append(d)\n<mask token>\nfor i in range(N):\n for j in range(N)...
[ 0, 1, 2, 3, 4 ]
import os import urllib.request as ulib import json from bs4 import BeautifulSoup as Bsoup def find_links(name): name = name.replace(" ", "+") url_str = 'https://www.google.com/search?ei=1m7NWePfFYaGmQG51q7IBg&hl=en&q={}' + \ '\&tbm=isch&ved=0ahUKEwjjovnD7sjWAhUGQyYKHTmrC2kQuT0I7gEoAQ&start={}'...
normal
{ "blob_id": "02ffdd1c03cc20883eddc691fc841022b4ff40fd", "index": 1601, "step-1": "<mask token>\n\n\ndef download_images(links, name):\n dir_name = name.replace(' ', '_')\n if not os.path.isdir(dir_name):\n os.mkdir(dir_name)\n for i, img_link in enumerate(links):\n img_path = os.path.join(...
[ 1, 2, 3, 4, 5 ]
import re from django import forms from django.contrib.auth import password_validation from django.contrib.auth.forms import PasswordChangeForm from django.contrib.auth.password_validation import validate_password from .models import Account class EditProfileModelForm(forms.ModelForm): class Meta: model...
normal
{ "blob_id": "af442d4a78930a0ebcd85a1cdfe4aa86461be5c1", "index": 1274, "step-1": "<mask token>\n\n\nclass PasswordChangeFormExt(PasswordChangeForm):\n \"\"\"Form for changing user's password.\"\"\"\n\n def clean(self):\n user = self.user\n new_password = self.cleaned_data.get('new_password1')...
[ 3, 4, 5, 6, 7 ]
def get_analyse(curse): ''' 要求curse数据中index为时间,columns为策略名称,每一列为该策略净值 ''' qf_drawdown = [] qf_yeild = [] qf_std = [] date = curse.index y = curse.copy() for i in curse.columns: # 计算当前日之前的资金曲线最高点 y["max2here"] = y[i].expanding().max() # 计算历史最高值到...
normal
{ "blob_id": "56d90835e64bd80fd9a6bb3a9b414e154d314d4a", "index": 5108, "step-1": "<mask token>\n", "step-2": "def get_analyse(curse):\n \"\"\"\n 要求curse数据中index为时间,columns为策略名称,每一列为该策略净值\n\n \"\"\"\n qf_drawdown = []\n qf_yeild = []\n qf_std = []\n date = curse.index\n y = curse.copy()\...
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Given an input with the following format # x y yerr # on standard input, print a fit of y = ax+b # to the data. import sys, string from math import sqrt def cP(X, Yerr): sum = 0 for i in range(len(X)): sum = sum + (X[i]*X[i])/(Yerr[i]*Yerr[i]) return sum def cQ(Y...
normal
{ "blob_id": "e78504971c51a98eed60ea8032502b6ce1a11f29", "index": 4206, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Given an input with the following format\n# x y yerr\n# on standard input, print a fit of y = ax+b\n# to the data.\n\nimport sys, string\nfrom math import sqrt\n\ndef cP(X, Yerr):...
[ 0 ]
#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/ #https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/
normal
{ "blob_id": "2ca40a53291a62bbdb4386decc5a2dfa84431836", "index": 6630, "step-1": "#https://www.geeksforgeeks.org/count-of-substrings-of-length-k-with-exactly-k-distinct-characters/\n#https://www.geeksforgeeks.org/count-number-of-substrings-with-exactly-k-distinct-characters/\n", "step-2": null, "step-3": nul...
[ 1 ]
from unittest import TestCase, main as unittest_main, mock from app import app from bson.objectid import ObjectId ''' dummy data to use in testing create, update, and delete routes (U and D not yet made) Inspiration taken from Playlister tutorial. ''' sample_offer_id = ObjectId('5349b4ddd2781d08c09890f4') sample_offer...
normal
{ "blob_id": "cef6b5ef2082dc5910806550d9a9c96357752baf", "index": 3541, "step-1": "<mask token>\n\n\nclass HomelyTests(TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Get Flask test client.\"\"\"\n self.client = app.test_client()\n app.config['TESTING'] = True\n\n def test_pro...
[ 7, 10, 11, 14, 15 ]
# http://www.dalkescientific.com/writings/diary/archive/2007/10/07/wide_finder.html ''' Making a faster standard library approach As I was writing an email to Fredrik describing these results, I came up with another approach to speeding up the performance, using only the standard library. Fredrik showed that using a ...
normal
{ "blob_id": "734fd4c492f2fd31a0459e90e5c4a7468120b4cd", "index": 2369, "step-1": "# http://www.dalkescientific.com/writings/diary/archive/2007/10/07/wide_finder.html\n'''\nMaking a faster standard library approach\n\nAs I was writing an email to Fredrik describing these results,\nI came up with another approach ...
[ 0 ]
class FieldDesigner: """ Designs a field for BattleShips, accepts field height and width """ def __init__( self, ): self.field = [] def design_field( self, height, width, ): self.field = [[ '~' for __ ...
normal
{ "blob_id": "c812419e7e024b0bb1207832b2b4a726ef61b272", "index": 9137, "step-1": "class FieldDesigner:\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return '\\n'.join(map(str, self.field))\n", "step-2": "class FieldDesigner:\n <mask token>\n\n def __init__(self)...
[ 2, 3, 4, 5, 6 ]
# coding: utf-8 etc_dictionary = { '2 30대': '이삼십대', '20~30대': '이삼십대', '20, 30대': '이십대 삼십대', '1+1': '원플러스원', '3에서 6개월인': '3개월에서 육개월인', } english_dictionary = { 'Devsisters': '데브시스터즈', 'track': '트랙', # krbook 'LA': '엘에이', '...
normal
{ "blob_id": "ccd1e57518065963158984dda52297db45ce204e", "index": 2471, "step-1": "<mask token>\n", "step-2": "etc_dictionary = {'2 30대': '이삼십대', '20~30대': '이삼십대', '20, 30대': '이십대 삼십대',\n '1+1': '원플러스원', '3에서 6개월인': '3개월에서 육개월인'}\nenglish_dictionary = {'Devsisters': '데브시스터즈', 'track': '트랙', 'LA': '엘에이',\n ...
[ 0, 1, 2 ]
import json import webapp2 import requests import requests_toolbelt.adapters.appengine from . import mongodb import datetime from bson.json_util import dumps class RestHandler(webapp2.RequestHandler): def dispatch(self): # time.sleep(1) super(RestHandler, self).dispatch() def send_json(self, conten...
normal
{ "blob_id": "8af3bb1b33a01353cd7f26c9496485e36d954edb", "index": 5362, "step-1": "import json\n\nimport webapp2\n\nimport requests\n\nimport requests_toolbelt.adapters.appengine\n\nfrom . import mongodb\n\nimport datetime\n\nfrom bson.json_util import dumps\n\nclass RestHandler(webapp2.RequestHandler):\n\n def ...
[ 0 ]
__author__ = "Prikly Grayp" __license__ = "MIT" __version__ = "1.0.0" __email__ = "priklygrayp@gmail.com" __status__ = "Development" from contextlib import closing class RefrigeratorRaider: '''Raid a refrigerator''' def open(self): print('Open fridge door.') def take(self, food): print('...
normal
{ "blob_id": "7455eb670c2c019b8d066fcc6f2878a2136b7fd0", "index": 5051, "step-1": "<mask token>\n\n\nclass RefrigeratorRaider:\n \"\"\"Raid a refrigerator\"\"\"\n\n def open(self):\n print('Open fridge door.')\n\n def take(self, food):\n print('Finding {}...'.format(food))\n if food ...
[ 6, 7, 8, 9, 10 ]
from typing import List """ 1. Generate an array containing the products of all elements to the left of current element 2. Similarly, start from the last element and generate an array containing the products to the right of each element 3. Multiply both arrays element-wise """ class Solution: def productExceptS...
normal
{ "blob_id": "26ae44b5be1d78ed3fe9c858413ae47e163c5460", "index": 1282, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def productExceptSelf(self, nums: List[int]) ->List[int]:\n output = []\n pro...
[ 0, 1, 2, 3, 4 ]
import json import random import uuid from collections import OrderedDict import docker from .db_utils import DBUtils from .models import DynamicDockerChallenge class DockerUtils: @staticmethod def add_new_docker_container(user_id, challenge_id, flag, port): configs = DBUtils.get_all_configs() ...
normal
{ "blob_id": "e2e2e746d0a8f6b01e6f54e930c7def2d48c2d62", "index": 4653, "step-1": "<mask token>\n\n\nclass DockerUtils:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DockerUtils:\n <mask token>\n\n @staticmethod\n def remove_current_docker_container(user_id, is_retry=False)...
[ 1, 2, 3, 4, 5 ]
import contextlib import dask import dask.array as da import packaging.version import pandas import six import sklearn SK_VERSION = packaging.version.parse(sklearn.__version__) DASK_VERSION = packaging.version.parse(dask.__version__) PANDAS_VERSION = packaging.version.parse(pandas.__version__) @contextlib.contextma...
normal
{ "blob_id": "1bdb19373960e4f63d80d6ab73ec3c0939e40b7f", "index": 364, "step-1": "<mask token>\n\n\n@contextlib.contextmanager\ndef dummy_context(*args, **kwargs):\n yield\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@contextlib.contextmanager\ndef dummy_context(*args, **kwargs):\n yield\n\n\nif six...
[ 1, 2, 3, 4, 5 ]
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RDt(RPackage): """A Wrapper of the JavaScript Library 'DataTables'. Data obje...
normal
{ "blob_id": "c88e2336432f93d95b4e2285aa532b673a4a410b", "index": 1095, "step-1": "<mask token>\n\n\nclass RDt(RPackage):\n <mask token>\n <mask token>\n version('0.23', sha256=\n '360ae2fcb1141125a1b16448570fc37d14c4dd3f78a872c26df4fda1787cdc70')\n version('0.20', sha256=\n 'c66d7f49ec1...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # -*-coding:utf-8 -*- import smtplib import MySQLdb import datetime import types def sendEmail(sender,passwd,host,port,receivers,date,mail) : message = MIMEText(mail, 'html', 'utf-8') message['From'] = Header("告警发送者<"+sender+">", 'utf-8') subject = str(date) + '服务器告警通知' message['Subjec...
normal
{ "blob_id": "221a75d37fbb49e8508fc786ee8e6e90b19e12c0", "index": 4683, "step-1": "#!/usr/bin/python\n# -*-coding:utf-8 -*-\nimport smtplib\nimport MySQLdb\nimport datetime\nimport types\ndef sendEmail(sender,passwd,host,port,receivers,date,mail) :\n message = MIMEText(mail, 'html', 'utf-8')\n message['From...
[ 0 ]
from flask_wtf import FlaskForm from wtforms import StringField, SelectField,SubmitField, PasswordField, RadioField, MultipleFileField, SubmitField, TextAreaField from wtforms.fields.html5 import EmailField, TelField, DateField from wtforms.validators import DataRequired, Email, Length, InputRequired class SignUpForm(...
normal
{ "blob_id": "32ed07a89a6f929a6c4b78fd79e687b85e01015b", "index": 535, "step-1": "<mask token>\n\n\nclass ForgotForm(FlaskForm):\n email = EmailField('Email Id*', validators=[DataRequired(), Email()])\n design = SelectField(u'Designation*', choices=[('admin', 'Admin'), (\n 'stud', 'Student')], valida...
[ 8, 10, 11, 12, 14 ]
from django.contrib import admin from .models import Hash admin.site.register(Hash)
normal
{ "blob_id": "e2e4adaa8f7f62662e0c2915faff1bed72986351", "index": 1084, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Hash)\n", "step-3": "from django.contrib import admin\nfrom .models import Hash\nadmin.site.register(Hash)\n", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
def multiply(num1, num2): return num1 * num2
normal
{ "blob_id": "e835e75f444e97ca948ce27504cc9149ea0092f6", "index": 1946, "step-1": "<mask token>\n", "step-2": "def multiply(num1, num2):\n return num1 * num2\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import praw import config from imgurpython import ImgurClient import datetime from time import sleep def respond_to_comment(comment, album_user, album_url, num_images, num_gifs): body = "Here is an album of all unique image/gif posts made by " \ "[{user}]({album_url}). ({num_images} images" \ ...
normal
{ "blob_id": "ca009022832963934230e356f9ea9eaedac7378b", "index": 1745, "step-1": "<mask token>\n\n\ndef update_album(user, imgur_client, reddit_client):\n return\n\n\n<mask token>\n\n\ndef is_gif(url):\n return True\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef respond_to_comment(comment, album_...
[ 2, 6, 7, 8, 9 ]
sum_value = 0 for _ in range(5): sum_value += int(input()) print(sum_value)
normal
{ "blob_id": "4add80894036e0395a6e6eb13e8a2db0d963de8c", "index": 9654, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(5):\n sum_value += int(input())\nprint(sum_value)\n", "step-3": "sum_value = 0\nfor _ in range(5):\n sum_value += int(input())\nprint(sum_value)\n", "step-4": nul...
[ 0, 1, 2 ]
a=raw_input("Enter the column\n") b=raw_input("Enter the row\n") i=0 k=0 m=0 c="" d="" while (m<int(b)): while(i<int(a)): c=c+" " for j in xrange(1,4): c=c+"-" i=i+1 while(k<int(a)): d=d+"|" for l in xrange(1,4): d=d+" " k=k+1 m=m+1 ...
normal
{ "blob_id": "c28d7fc45be9a6efa7b7ef00520898c3d238ac63", "index": 5518, "step-1": "a=raw_input(\"Enter the column\\n\")\nb=raw_input(\"Enter the row\\n\")\ni=0\nk=0\nm=0\nc=\"\"\nd=\"\"\nwhile (m<int(b)):\n while(i<int(a)):\n c=c+\" \"\n for j in xrange(1,4):\n c=c+\"-\"\n i=i+1...
[ 0 ]
import csv import os from collections import namedtuple from typing import List, Dict from config import * HEADER = ['File', 'LKHContigs', 'LKHValue', 'LKHTime', 'APContigs', 'APValue', 'APTime', 'ActualObjectiveValue'] Assembly_Stats = namedtuple('Assembly_Stats', HEADER) dir = '/home/andreas/GDrive/workspace/spars...
normal
{ "blob_id": "edd98e3996b0fce46d33dd33340018ab5b029637", "index": 2333, "step-1": "<mask token>\n\n\ndef read_assembly_file(file: str) ->List:\n if not os.path.isfile(file):\n return [-1, -1, -1, -1, -1, -1]\n with open(file, 'r') as f:\n file_content_string = f.read()\n if 'LKH_Contigs...
[ 5, 7, 8, 9, 10 ]
# # tests/middleware/test_static.py # import pytest import growler from pathlib import Path from unittest import mock from sys import version_info from growler.middleware.static import Static @pytest.fixture def static(tmpdir): return Static(str(tmpdir)) def test_static_fixture(static, tmpdir): assert isin...
normal
{ "blob_id": "9a7994a1e51c9cf7fe7d8b50ab26fa3d789fc8e5", "index": 1012, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef static(tmpdir):\n return Static(str(tmpdir))\n\n\ndef test_static_fixture(static, tmpdir):\n assert isinstance(static, Static)\n assert str(static.path) == str(tmpdir)\n\n\n<mask toke...
[ 4, 7, 8, 9, 10 ]
# Input Output test (입출력 테스트 ) """ 날짜 : 2021/04/27 이름 : 이지영 내용 : 파이썬 표준입출력 실습 _ 교재 p42 """ # 파이썬 표준 출력 print('hello', end='!') #print : 출력함수 (자바에선 document.write('hello');) print('python') print('010', '1234', '1111', sep='-') # seperate 값 # 파이썬 표준 입력 num = input('숫자입력 : ') print('입력한 숫자 :', num) print('num type :'...
normal
{ "blob_id": "cc628270a973866025a5e2a5d07e39b4dbdcd324", "index": 1718, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('hello', end='!')\nprint('python')\nprint('010', '1234', '1111', sep='-')\n<mask token>\nprint('입력한 숫자 :', num)\nprint('num type :', type(num))\n<mask token>\nprint('result :', resu...
[ 0, 1, 2, 3 ]
from django.shortcuts import render from django.shortcuts import redirect from block.models import Block from .models import Article from .forms import ArticleForm from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required def article_list(request, block_id): block_id = ...
normal
{ "blob_id": "0f94537fa64066bb29c5e9e97836b0a8ac01ac19", "index": 9844, "step-1": "<mask token>\n\n\n@login_required\ndef article_create(request, block_id):\n block_id = int(block_id)\n block = Block.objects.get(id=block_id)\n if request.method == 'GET':\n return render(request, 'article_create.ht...
[ 1, 2, 3, 4, 5 ]
import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.model_selection import GroupKFold from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_log_error from sklearn.preprocessing import OneHotEncoder from sklearn.linear_model import...
normal
{ "blob_id": "6028b46eab422dea02af24e9cf724fe0d8b3ecc4", "index": 9531, "step-1": "<mask token>\n\n\ndef test_lasso():\n test = pd.read_csv('./data/test.csv')\n building_metadata = pd.read_csv('./data/building_metadata.csv')\n weather_test = pd.read_csv('./data/weather_test.csv')\n test.sort_values(by...
[ 1, 2, 3, 4, 5 ]
##Extras def permissao(): editor = False for row in session.auth.user_groups: grupo = session.auth.user_groups[row] if (grupo == "gerenciador") or (grupo == "administrador"): editor = True return editor
normal
{ "blob_id": "70de2bed00aabe3805c3a19da004713d4109568a", "index": 9036, "step-1": "<mask token>\n", "step-2": "def permissao():\n editor = False\n for row in session.auth.user_groups:\n grupo = session.auth.user_groups[row]\n if grupo == 'gerenciador' or grupo == 'administrador':\n ...
[ 0, 1, 2 ]
import os import json import random chapter_mode = True setname = 'test_other' use_chapter = '_chapter' minlen = 1000 maxlen = 1000 context = '_1000' info_json = 'bookinfo{}_{}{}.json'.format(use_chapter, setname, context) book_ID_mapping = {} with open('speaker_book.txt') as fin: for line in fin: elems ...
normal
{ "blob_id": "3b41bd59c133bb04dae3aa48dc0699388d5bf3d4", "index": 8346, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('speaker_book.txt') as fin:\n for line in fin:\n elems = line.split('|')\n ID = elems[0].lstrip().strip()\n speaker = elems[1].lstrip().strip()\n ...
[ 0, 1, 2, 3, 4 ]
import os f_s_list = [2, 1.5, 1, 0.5, 0.2] g_end_list = [500, 1000, 2000, 5000, 10000, 20000, 60000] h_i_list = [(10000 * i, 10000 * (i + 1)) for i in range(6)] i_seed_list = [1, 12, 123, 1234, 12345, 123456] for s in f_s_list: os.system("python SKs_model.py " + str(s) + " 0 10000 0 relu") for train_end in g_...
normal
{ "blob_id": "56a681015ea27e2c8e00ab8bcc8019d5987c4ee1", "index": 6949, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor s in f_s_list:\n os.system('python SKs_model.py ' + str(s) + ' 0 10000 0 relu')\nfor train_end in g_end_list:\n os.system('python SKs_model.py 0.2 0 ' + str(train_end) + ' 0 rel...
[ 0, 1, 2, 3, 4 ]
import uuid import json import pytest import requests import httpx from spinta.testing.manifest import bootstrap_manifest from spinta.utils.data import take from spinta.testing.utils import error from spinta.testing.utils import get_error_codes, RowIds from spinta.testing.context import create_test_context from spint...
normal
{ "blob_id": "57e9c1a4ac57f68e0e73c2c67c6828de8efb1b16", "index": 3903, "step-1": "<mask token>\n\n\ndef _push_test_data(app, model, data=None):\n app.authmodel(model, ['insert'])\n resp = app.post('/', json={'_data': [{**res, '_op': 'insert', '_type':\n model} for res in data or test_data]})\n as...
[ 43, 48, 56, 58, 63 ]
include_rules = [ "+apps", "+components/live_caption", "+services/device/public", "+components/device_reauth", # Enable remote assistance on Chrome OS "+remoting/host", ] specific_include_rules = { ".*test.*": [ "+chrome/browser/ui/views/frame", "+components/captive_portal", "+components/web...
normal
{ "blob_id": "728af8b07bc391b496709e54926f3f1f49897176", "index": 1992, "step-1": "<mask token>\n", "step-2": "include_rules = ['+apps', '+components/live_caption',\n '+services/device/public', '+components/device_reauth', '+remoting/host']\nspecific_include_rules = {'.*test.*': ['+chrome/browser/ui/views/fr...
[ 0, 1, 2 ]
''' Created on Mar 19, 2019 @author: malte ''' import gc import pickle from hyperopt import tpe, hp from hyperopt.base import Trials from hyperopt.fmin import fmin from config.globals import BASE_PATH from domain.features import FEATURES from evaluate import evaluate from featuregen.create_set import create_set fro...
normal
{ "blob_id": "daf070291bbf59a7a06b129bbde5fd79b5cd46ad", "index": 6715, "step-1": "<mask token>\n\n\ndef objective(params):\n train = create_set(base_path=BASE_PATH + SET, conf=CONF, key=DSKEY,\n redo=False)\n test = train.query('train == 0')\n train.query('train == 1', inplace=True)\n X = trai...
[ 2, 3, 4, 5, 6 ]
class Car: __name="" __maxspeed = 0 def __init__(self): self.__updateSoftware() self.__name = "Supercar" self.__maxspeed=320 def drive(self): print("Driving") print("name of the car " + self.__name) def __updateSoftware(self): print("Updating So...
normal
{ "blob_id": "318556a6c327294986fcef938c254b8dfe66adaa", "index": 6375, "step-1": "class Car:\n <mask token>\n <mask token>\n\n def __init__(self):\n self.__updateSoftware()\n self.__name = 'Supercar'\n self.__maxspeed = 320\n\n def drive(self):\n print('Driving')\n ...
[ 5, 6, 7, 8, 9 ]
import pygame import os from time import sleep screen = pygame.display.set_mode((900,700)) screen.fill((255,255,255)) pygame.display.set_caption("NTUFOODIERECOMMENDSYSTEM") ''' ########################### ──╔╗────╔╗ ──║║───╔╝╚╗ ╔═╝╠╦══╬╗╔╬╦══╦═╗╔══╦═╦╗─╔╗ ║╔╗╠╣╔═╝║║╠╣╔╗║╔╗╣╔╗║╔╣║─║║ ║╚╝║║╚═╗║╚╣║╚╝║║...
normal
{ "blob_id": "2a8032c23e3c7aa3a7b0593c79db7adbc0353f93", "index": 2125, "step-1": "<mask token>\n\n\nclass button:\n\n def __init__(self, colour, x, y, width, height, text=''):\n self.colour = colour\n self.x = x\n self.y = y\n self.width = width\n self.height = height\n ...
[ 11, 12, 15, 22, 23 ]
from rest_framework import serializers from .models import * __all__ = ( 'CatalogCoinListSerializer', 'CatalogCoinSerializer', 'SeriesListSerializer', 'CoinListSerializer', 'CoinSerializer', 'CountriesListSerializer', ) class CountriesListSerializer(serializers.ModelSerializer): class Meta: mode...
normal
{ "blob_id": "b77da75b01e96ff89f873f4c5764a62cf68cd576", "index": 217, "step-1": "<mask token>\n\n\nclass SeriesListSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Serie\n fields = 'name',\n\n\nclass CatalogCoinListSerializer(serializers.ModelSerializer):\n\n\n class Meta:...
[ 7, 8, 9, 10, 11 ]
import sys max = sys.maxsize print(" sys.maxsize -> ", max)
normal
{ "blob_id": "c1c79e5adc620690e4e386f7f1cd9f781eeec0ce", "index": 6843, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' sys.maxsize -> ', max)\n", "step-3": "<mask token>\nmax = sys.maxsize\nprint(' sys.maxsize -> ', max)\n", "step-4": "import sys\nmax = sys.maxsize\nprint(' sys.maxsize -> ', m...
[ 0, 1, 2, 3, 4 ]
# class User: # def __init__(self, name_parameter, email_parameter): # self.nameofPerson = name_parameter # self.emailofPerson = email_parameter # self.account_balance = 0 # def depositMoney(self, amount); # self.account_balance += amount # return self # def transfe...
normal
{ "blob_id": "c69dcffc06146af610a7976e522b6e35cabde1aa", "index": 3050, "step-1": "# class User:\n# def __init__(self, name_parameter, email_parameter):\n# self.nameofPerson = name_parameter\n# self.emailofPerson = email_parameter\n# self.account_balance = 0\n\n# def depositMoney(s...
[ 1 ]
import pytest def test_template(): assert True
normal
{ "blob_id": "e7fa84dbc037253c7f852aa618e6ea88d1fda909", "index": 1939, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_template():\n assert True\n", "step-3": "import pytest\n\n\ndef test_template():\n assert True\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
import matplotlib.pyplot as plt def xyplot(xdata,ydata,title): fname = "/Users/nalmog/Desktop/swa_equipped_cumulative_"+title+".png" #plt.figure(figsize=(500,500)) plt.plot(xdata, ydata) plt.ylabel('some numbers') # plt.savefig("/Users/nalmog/Desktop/swa_equipped_cumulative_"+title+".png", format...
normal
{ "blob_id": "10a7c1827abb8a87f5965453aa2d8f5e8b4914e5", "index": 6563, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef xyplot(xdata, ydata, title):\n fname = '/Users/nalmog/Desktop/swa_equipped_cumulative_' + title + '.png'\n plt.plot(xdata, ydata)\n plt.ylabel('some numbers')\n plt.ti...
[ 0, 1, 2, 3 ]
# -*- coding:utf-8 -*- """ Author:xufei Date:2021/1/21 """
normal
{ "blob_id": "d39e3a552a7c558d3f5b410e0b228fb7409d732a", "index": 928, "step-1": "<mask token>\n", "step-2": "# -*- coding:utf-8 -*-\n\"\"\"\nAuthor:xufei\nDate:2021/1/21\n\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
""" This module takes care of starting the API Server, Loading the DB and Adding the endpoints """ import os from flask import Flask, request, jsonify, url_for from flask_migrate import Migrate from flask_swagger import swagger from flask_cors import CORS from flask_jwt_extended import ( JWTManager, jwt_required, c...
normal
{ "blob_id": "36d596c1019dbaaf8dc394633ca464421517dc21", "index": 3381, "step-1": "\"\"\"\nThis module takes care of starting the API Server, Loading the DB and Adding the endpoints\n\"\"\"\nimport os\nfrom flask import Flask, request, jsonify, url_for\nfrom flask_migrate import Migrate\nfrom flask_swagger import...
[ 0 ]
from . import views from django.conf.urls import url,re_path enquiryUrlPattern = [ url(r'daily-rate-enquiry', views.daily_rate_enquiry_form), re_path(r'^contact-us-landing-page/$', views.contact_us_landing_page), ]
normal
{ "blob_id": "ccf1710cff972eaa06e1ccb5ebedc70d946e3215", "index": 4906, "step-1": "<mask token>\n", "step-2": "<mask token>\nenquiryUrlPattern = [url('daily-rate-enquiry', views.\n daily_rate_enquiry_form), re_path('^contact-us-landing-page/$', views.\n contact_us_landing_page)]\n", "step-3": "from . im...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import pandas as pd import matplotlib.pyplot as plt from tqdm import tqdm from scipy.io import loadmat from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt import numpy as np import copy from matplotlib import cm from matplotlib.animation import FuncAnimation import scipy.opt...
normal
{ "blob_id": "f5820824b5b7e473b79b5dfee2f203684c3755be", "index": 5154, "step-1": "<mask token>\n\n\ndef vector_to_message(vector):\n vocab_file = open('data/vocab.txt', 'r')\n vocab = vocab_file.readlines()\n message_words = []\n for vocab_record, vector_enterance in zip(vocab, vector):\n is_t...
[ 2, 3, 4, 5, 6 ]
import os from unittest import TestCase from pyfibre.gui.file_display_pane import FileDisplayPane from pyfibre.tests.fixtures import ( directory, test_image_path) from pyfibre.tests.probe_classes.parsers import ProbeParser from pyfibre.tests.probe_classes.readers import ProbeMultiImageReader source_dir = os.p...
normal
{ "blob_id": "7c65d0bdd4fd808b3d87706357a651601368e43b", "index": 8596, "step-1": "<mask token>\n\n\nclass TestFileDisplayPane(TestCase):\n\n def setUp(self):\n self.file_display = FileDisplayPane(supported_readers={'Probe':\n ProbeMultiImageReader()}, supported_parsers={'Probe':\n ...
[ 5, 6, 7, 8, 9 ]
from django.shortcuts import render, get_object_or_404 # Create your views here. from django.http import HttpResponse from .models import Post from django.utils import timezone def list_of_posts(request): posts = (Post.objects .filter(published_date__lte=timezone.now()) .order_b...
normal
{ "blob_id": "71a0900dc09b1ff55e4e5a4cc7cab617b9c73406", "index": 4519, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef post_detail(request, pk):\n post = get_object_or_404(Post, pk=pk)\n return render(request, 'blog/post_detail.html', {'post': post})\n", "step-3": "<mask token>\n\n\ndef li...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy as np from scipy import misc from sklearn.model_selection import train_test_split from sklearn.utils import shuffle import time import math import cv2 import matplotlib matplotlib.use("TkAgg") from matplotlib import pyplot as plt from keras.models import Sequential from keras.layers im...
normal
{ "blob_id": "b109568c4dba05b16cbed1759a2b9e0a99babc67", "index": 2982, "step-1": "<mask token>\n\n\ndef load_data(data):\n temp = []\n for i in range(len(data)):\n im = cv2.imread(data[i])\n im = misc.imresize(im, size=DOWNSAMPLE_RATIO)\n im = crop(im)\n temp.append(im)\n ret...
[ 8, 10, 12, 16, 19 ]
# Generated by Django 3.0.5 on 2020-05-12 13:26 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='idcard', fields=[ ('id', models.AutoField(a...
normal
{ "blob_id": "422873f89468b1faabed96f72f463b6294b85276", "index": 5314, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
from base_plugin import * from plugin_utils import * from datetime import datetime import time class LogPlugin(Plugin): def initialize(self): self.add_trigger(on_message) self.add_command("!chatsearch", self.search) self.add_command("!chatreplay", self.replay) def run(self, message): append_to_file(str(...
normal
{ "blob_id": "d932ab84848c9a8ca8bb23a57424b8f6190b6260", "index": 2563, "step-1": "<mask token>\n\n\nclass LogPlugin(Plugin):\n <mask token>\n <mask token>\n\n def search(self, message, query, *additional_queries):\n chat_history = read_lines_from_file('chatlog.log')\n chat_history.reverse(...
[ 3, 4, 5, 6, 7 ]
from django.db import models # Create your models here. class GameGenre(models.Model): genreName = models.CharField(max_length=100) genreDescription = models.CharField(max_length=300) def __str__(self): return "%s" % (self.genreName) class Game(models.Model): gameName = models.CharField(...
normal
{ "blob_id": "092242cdb231e09ccf3dd4dccfb6d786c3e4aad2", "index": 8036, "step-1": "<mask token>\n\n\nclass Game(models.Model):\n gameName = models.CharField(max_length=100)\n genre = models.ForeignKey(GameGenre)\n\n def __str__(self):\n return '%s, %s' % (self.gameName, self.genre)\n\n\nclass Play...
[ 6, 8, 9, 10, 11 ]
import os import datetime import traceback import json import requests import logging from model import Product from naver_api import naver_client_id, naver_client_secret DEBUG = False if not DEBUG: logging.getLogger('boto3').setLevel(logging.WARNING) logging.getLogger('botocore').setLevel(logging.WARNING) ...
normal
{ "blob_id": "76905171602cbeb53903a4b0259685288da3a083", "index": 6365, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n products = list(Product.scan(Product.do_crawl == True))\n for product in products:\n product.search_lowest_price()\n print('{} product(s) crawled'.format(len(p...
[ 1, 2, 3, 4, 5 ]
import os import tkinter as tk from tkinter import messagebox from os.path import join from pynput import keyboard from src.save_count import SaveCount class MainApplication(tk.Frame): def __init__(self, root: tk.Tk): super().__init__(root) self.root = root self.pack(padx=32, pady=32, e...
normal
{ "blob_id": "7e2bf898eb1c0118205042797e6dac535342979b", "index": 185, "step-1": "<mask token>\n\n\nclass MainApplication(tk.Frame):\n <mask token>\n\n def count_up(self):\n if self.var_count.get() == 0 and self.lst_counts.index(tk.END) == 0:\n SaveCount(tk.Toplevel(), self.save_to_listbox...
[ 6, 9, 14, 15, 16 ]
# models.py from sentiment_data import * from utils import * import nltk from nltk.corpus import stopwords import numpy as np from scipy.sparse import csr_matrix class FeatureExtractor(object): """ Feature extraction base type. Takes a sentence and returns an indexed list of features. """ def get_inde...
normal
{ "blob_id": "5d8d47d77fba9027d7c5ec4e672fc0c597b76eae", "index": 4091, "step-1": "<mask token>\n\n\nclass UnigramFeatureExtractor(FeatureExtractor):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BigramFeatureExtractor(FeatureExtractor):\n \"\"\"\n Bigram feature extractor analogous to th...
[ 22, 29, 30, 31, 34 ]
from fastapi import APIRouter, Depends, status, Response from typing import List import schemas, database from sqlalchemy.orm import Session import repository.blog as blog from .oauth2 import get_current_user router = APIRouter( prefix="/blog", tags=['Blog']) @router.get('/', status_code=statu...
normal
{ "blob_id": "7fd5e83d28e919e7b94cea290c6b4db3378938b6", "index": 4600, "step-1": "<mask token>\n\n\n@router.get('/', status_code=status.HTTP_200_OK, response_model=List[\n schemas.ShowBlog])\ndef all_blog(db: Session=Depends(database.get_db), current_user: schemas.\n User=Depends(get_current_user)):\n r...
[ 4, 5, 6, 7, 8 ]
import time import datetime import mx from openerp.report import report_sxw class course_form(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(course_form, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'time1': self....
normal
{ "blob_id": "c4fcca61e560046c77046079fb305be8c883653b", "index": 2077, "step-1": "<mask token>\n\n\nclass course_form(report_sxw.rml_parse):\n <mask token>\n <mask token>\n\n def _get_course(self, data):\n training_category_obj = self.pool.get('hr.training.category')\n training_category_id...
[ 4, 6, 7, 8, 9 ]
# import core modules and community packages import sys, math, random import pygame # import configuration settings from src.config import * from src.board.levels import LEVEL_1 # import game elements from src.pucman import Pucman from src.ghast import Ghast from src.board.board import Board class Session(): def...
normal
{ "blob_id": "f51a21ed71ede4e7462d9c77cb932a5f05b09e71", "index": 9174, "step-1": "<mask token>\n\n\nclass Session:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Session:\n <mask token>\n\n def start(self):\n self.board.draw()\n session = True\n while sess...
[ 1, 2, 3, 4, 5 ]
def label_modes(trip_list, silent=True): """Labels trip segments by likely mode of travel. Labels are "chilling" if traveler is stationary, "walking" if slow, "driving" if fast, and "bogus" if too fast to be real. trip_list [list]: a list of dicts in JSON format. silent [bool]: if True, does n...
normal
{ "blob_id": "3f4e8402bbd096a33ed159ca0fed250c74c2f876", "index": 4833, "step-1": "<mask token>\n", "step-2": "def label_modes(trip_list, silent=True):\n \"\"\"Labels trip segments by likely mode of travel.\n\n Labels are \"chilling\" if traveler is stationary, \"walking\" if slow,\n \"driving\" if...
[ 0, 1, 2 ]
#!/usr/bin/env python3 import re import subprocess PREFIX = "Enclave/" OBJ_FILES = [ # "Enclave.o", "p_block.o", # "symbols.o", "runtime.o", "primitives.o", "unary_op.o", "unary/isna.o", "unary/mathgen.o", "unary/mathtrig.o", "unary/plusminus.o", "unary/summary.o", "unar...
normal
{ "blob_id": "45d69194e14e8c20161e979d4ff34d0b90df4672", "index": 4750, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor obj_file in OBJ_FILES:\n cond_results[obj_file] = set()\n dump = subprocess.run(['objdump', '-M', 'intel', '-dr', PREFIX +\n obj_file], stdout=subprocess.PIPE, check=True...
[ 0, 1, 2, 3, 4 ]
from armulator.armv6.bits_ops import add_with_carry, bit_not from armulator.armv6.enums import InstrSet from armulator.armv6.opcodes.opcode import Opcode class SubsPcLrThumb(Opcode): def __init__(self, instruction, imm32, n): super().__init__(instruction) self.imm32 = imm32 self.n = n ...
normal
{ "blob_id": "89376b2464dfb724197a1c1e164af8277e03ad59", "index": 2507, "step-1": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n\n def __init__(self, instruction, imm32, n):\n super().__init__(instruct...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render from django.http import HttpResponse,JsonResponse from ex.models import Teacher,Student,Group,Report,TeamEvaluation,PrivateLetter,ChatBoxIsOpen from django.core import serializers from rest_framework.views import APIView from rest_framework.response import Response from django.cont...
normal
{ "blob_id": "4b5794ff79371c2e49c5d2b621805b08c4ff7acb", "index": 8898, "step-1": "<mask token>\n\n\nclass searchContactView(APIView):\n\n def get(self, request, *args, **kwargs):\n try:\n try:\n payload = JwtQueryParamAuthentication.authenticate(self,\n requ...
[ 14, 18, 21, 25, 26 ]
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 ]
## PURPOSE: get reads for certain motifs across certain tumors ## INPUT: manifest data all-tumor-manifest.csv ## collapsed fastq files sample.converted.unpaired.fastq.collapsed ## OUTPUT: table containing reads for specific motif across samples motif.tumor.common.reads.fastq.collapsed.summary.tsv import...
normal
{ "blob_id": "ddabceb223f4e457a0f69af5abf793ae72e5f432", "index": 1465, "step-1": "<mask token>\n\n\ndef getCollapsedFastqDataframe(file):\n df = pd.read_table(file, header=None, delim_whitespace=True)\n df = df.dropna(axis=1, how='all')\n sample = file.split('/')\n sample = sample[len(sample) - 1]\n ...
[ 2, 3, 4, 5, 6 ]