code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from flask import abort from flask_restx import Resource, Namespace, Model, fields, reqparse from infraestructura.lineas_repo import LineasRepo from infraestructura.equipos_repo import EquiposRepo from infraestructura.clientes_lep_repo import ClientesLepRepo from infraestructura.lineaequipoplan_repo import LineaEquipoP...
normal
{ "blob_id": "821e89730fde2e12b24b52b04701c1f3501e0d57", "index": 8771, "step-1": "<mask token>\n\n\n@nsLinea.route('/<int:id>')\nclass LineasResource(Resource):\n <mask token>\n <mask token>\n\n\n@nsLinea.route('/baja/<int:id>')\nclass LineasResource(Resource):\n\n def put(self, id):\n if repo.ba...
[ 3, 7, 8, 9, 12 ]
import pkgutil import mimetypes import time from datetime import datetime from pywb.utils.wbexception import NotFoundException from pywb.utils.loaders import BlockLoader from pywb.utils.statusandheaders import StatusAndHeaders from pywb.framework.basehandlers import BaseHandler, WbUrlHandler from pywb.framework.wbre...
normal
{ "blob_id": "df1486afcc99e03510512ed6ed3e8b3471459d50", "index": 5343, "step-1": "<mask token>\n\n\nclass WBHandler(SearchPageWbUrlHandler):\n <mask token>\n <mask token>\n <mask token>\n\n def handle_query(self, wbrequest, cdx_lines, output):\n return self.index_reader.make_cdx_response(wbreq...
[ 10, 19, 21, 22, 25 ]
from datetime import timedelta import pandas as pd __all__ = ["FixWindowCutoffStrategy"] class CutoffStrategy: """ Class that holds a CutoffStrategy. This is a measure to prevent leakage Parameters ---------- generate_fn: a function that generates a cutoff time for a given entity. input...
normal
{ "blob_id": "30f030d48368e1b103f926ee7a15b4b75c4459c7", "index": 7030, "step-1": "<mask token>\n\n\nclass CutoffStrategy:\n <mask token>\n\n def __init__(self, generate_fn, description='undescribed cutoff strategy'):\n self.generate_fn = generate_fn\n self.description = description\n\n\nclass...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if mibBuilder.loadTexts: mscAtmIfVpcSrcEbrOvRowStatusTable.setStatus('mandatory') <|reserved_special_token_0|> if mibBuilder.loadTexts: mscAtmIfVpcSrcEbrOvRowStatusEntry.setStatus('mandatory') <|reserved_special_token_0|> ...
flexible
{ "blob_id": "202670314ad28685aaa296dce4b5094daab3f47a", "index": 4889, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusTable.setStatus('mandatory')\n<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusEntry.setStatus('mandatory'...
[ 0, 1, 2, 3 ]
# -*-coding:utf-8-*- import os import time import shutil import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--dir', type=str, required=True) parser.add_argument('--task', type=str, required=True) args = parser.parse_args() if not os.path.exists(args...
normal
{ "blob_id": "dc3a3f5675860792ecfa7dcd5180402d89b669b1", "index": 8254, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser()\n parser.add_argument('--dir', type=str, required=True)\n parser.add_argument('--task', type=str, required=True)\n...
[ 0, 1, 2, 3 ]
import logging import time import random import pickle import os from sys import maxsize import torch from tensorboardX import SummaryWriter from baselines.common.schedules import LinearSchedule from abp.utils import clear_summary_path from abp.models.feature_q_model import feature_q_model from abp.adaptives.common.p...
normal
{ "blob_id": "424a0e8a7a80e24aec4bdb9b8c84fd9a5e6090c6", "index": 6782, "step-1": "<mask token>\n\n\nclass SADQ_GQF(object):\n <mask token>\n <mask token>\n\n def should_explore(self):\n self.epsilon = self.epsilon_schedule.value(self.steps)\n self.summary.add_scalar(tag='%s/Epsilon' % self...
[ 11, 16, 19, 22, 23 ]
""" Process pair-end reads of barcode-guide-donor Step 1 cassette to generate a library reference table mapping barcodes to features. Create dictionaries mapping barcodes to forward and reverse reads, split into sub-segments. R1_dict: map barcodes to corresponding R1 sequences. R2_dict: map barcodes to corresponding R...
normal
{ "blob_id": "9206e4c4eff8ca64266ce53705e88069912b80d8", "index": 1526, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-f', '-forward', required=True, help=\n 'forward sequencing files', nargs='+', action='store', dest='forward_files'\n )\nparser.add_argument('-r', '-reverse', r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def Start(): Start_Code = '#include <windows.h>\n' Start_Code += '#include <tlhelp32.h>\n' Start_Code += '#include <stdio.h>\n' Start_Code += '#include <stdlib.h>\n' Start_Code += '#include <string.h>\n' Start_Code += 'int main(int argc, char **argv) {' Start_C...
flexible
{ "blob_id": "e9b9f87a18a5788ac86b1e85c0f3d7858946e03a", "index": 2999, "step-1": "<mask token>\n\n\ndef Start():\n Start_Code = '#include <windows.h>\\n'\n Start_Code += '#include <tlhelp32.h>\\n'\n Start_Code += '#include <stdio.h>\\n'\n Start_Code += '#include <stdlib.h>\\n'\n Start_Code += '#in...
[ 4, 5, 6, 7, 8 ]
import datetime class Dato: def __init__(self, id: int, dato: str, tipo: str, fecha: datetime.datetime): self.__id = id self.__dato = dato self.__tipo = tipo self.__fecha = fecha def getId(self): return self.__id def setId(self, id): self.__id = id def...
normal
{ "blob_id": "95256390e1e7e9227b96dccce33082de9d2cddd3", "index": 5158, "step-1": "<mask token>\n\n\nclass Dato:\n <mask token>\n <mask token>\n\n def setId(self, id):\n self.__id = id\n <mask token>\n\n def setDato(self, dato):\n self.__dato = dato\n <mask token>\n\n def setTip...
[ 6, 7, 9, 10, 12 ]
<|reserved_special_token_0|> class Base: <|reserved_special_token_0|> def open_url(self, url): self.driver.get(url) self.driver.maximize_window() def find_element(self, locator, timeout=10): element = WebDriverWait(self.driver, timeout).until(EC. presence_of_element_l...
flexible
{ "blob_id": "82fc86e44d02c45d7904139e4dfdff069e2bdb90", "index": 5634, "step-1": "<mask token>\n\n\nclass Base:\n <mask token>\n\n def open_url(self, url):\n self.driver.get(url)\n self.driver.maximize_window()\n\n def find_element(self, locator, timeout=10):\n element = WebDriverWa...
[ 6, 9, 11, 12, 13 ]
<|reserved_special_token_0|> class Config: <|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_token_0|> <|reser...
flexible
{ "blob_id": "1f7147c914eee37776c0418575e93e3d36ee3aa5", "index": 7099, "step-1": "<mask token>\n\n\nclass Config:\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>\n <mask token>\n...
[ 7, 9, 10, 11, 13 ]
import random prime=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] t=100 print(t) n=25 for _ in range(t): a=random.randint(1,n) b=random.choice(prime) print(a,b) for _ in range(a): print(random.randint(1,n),end=" ") print("")
normal
{ "blob_id": "16738e7d89bee8074f39d0b3abc3fa786faf081f", "index": 2370, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(t)\n<mask token>\nfor _ in range(t):\n a = random.randint(1, n)\n b = random.choice(prime)\n print(a, b)\n for _ in range(a):\n print(random.randint(1, n), end=' ...
[ 0, 1, 2, 3, 4 ]
# Name: Calvin Liew # Date: 2021-01-29 # Purpose: Video game final project, Tic-Tac-Toe 15 by Calvin Liew. import random # Function that reminds the users of the game rules and other instructions. def intro(): print("""\n####### ####### ####### # ...
normal
{ "blob_id": "11259c92b005a66e5f3c9592875f478df199c813", "index": 6993, "step-1": "<mask token>\n\n\ndef intro():\n print(\n \"\"\"\n####### ####### ####### # ####### \n # # #### # ## #### # #### ###### ##...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Home(Base): <|reserved_special_token_0|> def pre_render(self): self.response = self.db.response self.request = self.db.request self.config = self.db.config self.response.meta.title = self.db.config.meta.title self.response.meta.descri...
flexible
{ "blob_id": "9d0d4707cc9a654752dd0b98fe0fec6a0c1419a1", "index": 3029, "step-1": "<mask token>\n\n\nclass Home(Base):\n <mask token>\n\n def pre_render(self):\n self.response = self.db.response\n self.request = self.db.request\n self.config = self.db.config\n self.response.meta....
[ 4, 5, 6, 7, 8 ]
from django.apps import AppConfig class FosAppConfig(AppConfig): name = 'fos_app'
normal
{ "blob_id": "d83f2d9bb25a46bc7344b420ce65bf729165e6b9", "index": 278, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FosAppConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FosAppConfig(AppConfig):\n name = 'fos_app'\n", "step-4": "from django.apps import AppCon...
[ 0, 1, 2, 3 ]
from fastapi import FastAPI, Header, Cookie, Form, Request, requests, Body, Response, HTTPException, status, Path, Query from fastapi.responses import HTMLResponse from typing import Optional from fastapi.testclient import TestClient from typing import List, Callable from fastapi.staticfiles import StaticFiles from fas...
normal
{ "blob_id": "70188d011ef60b1586864c4b85a9f9e70e5a4caf", "index": 7386, "step-1": "<mask token>\n\n\nclass Item(BaseModel):\n name: str\n price: float\n\n\nclass ValidationError(APIRoute):\n\n def get_route_handler(self) ->Callable:\n original_route_handler = super().get_route_handler()\n\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class LinearBot(object): def __init__(self, player, player_name, weights_file, basis): self.reader = StateEncapsulator(player, player_name) with open(STATE_FILENAME, 'r') as f: data = json.load(f) self.state = self.reader.parse_state(data) ...
flexible
{ "blob_id": "e9a6baf10efc5b6bd07af1fe352b0b17ecc172bd", "index": 1855, "step-1": "<mask token>\n\n\nclass LinearBot(object):\n\n def __init__(self, player, player_name, weights_file, basis):\n self.reader = StateEncapsulator(player, player_name)\n with open(STATE_FILENAME, 'r') as f:\n ...
[ 3, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models class ClassMKB(models.Model): name = models.CharField(max_length=512,verbose_name = 'Наименование') code = models.CharField(max_length=20, null=True, blank=True,verbose_name = 'Код') parent_id = models.IntegerFie...
normal
{ "blob_id": "8753996c90ecea685e6312020dfd31fabb366138", "index": 5270, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClassMKB(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 db_table = 'cla...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class DerivedVariable(DerivedVariableBase): <|reserved_special_token_0|> @staticmethod def required(project): """Declare the variables needed for derivation.""" required = [{'short_name': 'co2'}, {'short_name': 'ps'}] return required @staticmethod...
flexible
{ "blob_id": "7c9b68b2d32d8e435f332d4412ea1ba899607ec4", "index": 9395, "step-1": "<mask token>\n\n\nclass DerivedVariable(DerivedVariableBase):\n <mask token>\n\n @staticmethod\n def required(project):\n \"\"\"Declare the variables needed for derivation.\"\"\"\n required = [{'short_name': ...
[ 3, 4, 5, 6, 7 ]
# PROBLEM: Code organized in package and want to import a submodule from one o the other pkg # submodules without hardcoding the package name into the import statement # SOLUTION: Use pkg-relative import # Absolete path from mypackage.A import grok print(dir(grok)) grok.testA()
normal
{ "blob_id": "ad9facb9c8e552845df9171549f886f3e9cba193", "index": 7544, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dir(grok))\ngrok.testA()\n", "step-3": "from mypackage.A import grok\nprint(dir(grok))\ngrok.testA()\n", "step-4": "# PROBLEM: Code organized in package and want to import a su...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if sys.platform == 'win32': test = TestGyp.TestGyp(formats=['ninja']) os.makedirs('subdir') read_only_files = ['read-only-file', 'subdir/A', 'subdir/B', 'subdir/C'] for f in read_only_files: test.write(f, '...
flexible
{ "blob_id": "efe5921afb160b7b5a953cdd0c2f90f64b5f34c9", "index": 5975, "step-1": "<mask token>\n", "step-2": "<mask token>\nif sys.platform == 'win32':\n test = TestGyp.TestGyp(formats=['ninja'])\n os.makedirs('subdir')\n read_only_files = ['read-only-file', 'subdir/A', 'subdir/B', 'subdir/C']\n fo...
[ 0, 1, 2, 3 ]
import re n = input("電話番号を入力してください>>") pattern = r'[\(]{0,1}[0-9]{2,4}[\)\-\(]{0,1}[0-9]{2,4}[\)\-]{0,1}[0-9]{3,4}' if re.findall(pattern, n): print(n, "は電話番号の形式です") else: print(n, "は電話番号の形式ではありません")
normal
{ "blob_id": "7ea81f83f556fcc55c9c9d44bcd63c583829fc08", "index": 8977, "step-1": "<mask token>\n", "step-2": "<mask token>\nif re.findall(pattern, n):\n print(n, 'は電話番号の形式です')\nelse:\n print(n, 'は電話番号の形式ではありません')\n", "step-3": "<mask token>\nn = input('電話番号を入力してください>>')\npattern = (\n '[\\\\(]{0,1}[...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Cells: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, nx, ny, density=5): self.nx = nx self.ny = ny self._cells = [[Cells.UNDEFINED for y in range(ny)] for x in range(nx)] sel...
flexible
{ "blob_id": "563e534e4794aa872dcdc5319b9a1943d19f940f", "index": 1289, "step-1": "<mask token>\n\n\nclass Cells:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, nx, ny, density=5):\n self.nx = nx\n self.ny = ny\n self._cells = [[Cells.UNDEFINED for y in range(...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- """The main application module for duffy.""" from flask import Flask from duffy import api_v1 from duffy.types import seamicro from duffy.extensions import db, migrate, marshmallow from duffy.config import ProdConfig,DevConfig def create_app(config_object=DevConfig): app = Flask(__name__...
normal
{ "blob_id": "11101273a02abec17fc884d5c1d5d182eb82ee0c", "index": 4625, "step-1": "<mask token>\n\n\ndef create_app(config_object=DevConfig):\n app = Flask(__name__.split('.')[0])\n app.config.from_object(config_object)\n app.config.from_envvar('DUFFY_SETTINGS', silent=True)\n register_extensions(app)...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Command(BaseCommand): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Command(BaseCommand): def handle(self, *args, **options): rqueue = RedisQueue(setting...
flexible
{ "blob_id": "cccf6ec50ae00d8e00a1a53ea06fa8b6d061b72e", "index": 8258, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Command(BaseCommand):\n\n def handle(self, *args, **options):\n rqueue = RedisQueue(se...
[ 0, 1, 2, 3 ]
from nose.tools import with_setup, nottest from tests.par_test_base import ParTestBase from ProbPy import RandVar, Factor, ParFactor class TestFactorMult(ParTestBase): def __init__(self): super().__init__() def par_test_0(self): """ f(X), scalar """ for i in range(4)...
normal
{ "blob_id": "0aad96de65cc125e5c026dfd72a9cc9f4ebd3dd2", "index": 6486, "step-1": "<mask token>\n\n\nclass TestFactorMult(ParTestBase):\n\n def __init__(self):\n super().__init__()\n <mask token>\n\n def par_test_1(self):\n \"\"\"\n f(X, Y), scalar\n \"\"\"\n for i in r...
[ 12, 14, 15, 16, 19 ]
# -*- coding: utf-8 -*- """ Created on Sun Mar 5 02:39:55 2017 @author: sparsh """ """ Crop Disease Classification Project for Code Fun Do 2017 - IIT Roorkee """ """ File for predicting a test image. """ import os os.environ['THEANO_FLAGS'] = "device=gpu1, floatX=float32" import theano import numpy as np np.random...
normal
{ "blob_id": "96210942b01c510300120913bed1bc6d497a39a9", "index": 1945, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(1)\n<mask token>\nK.set_image_dim_ordering('th')\n<mask token>\nmodel.add(ZeroPadding2D((1, 1), input_shape=(3, img_width, img_height)))\nmodel.add(Convolution2D(64, 3, 3, ...
[ 0, 1, 2, 3, 4 ]
import osfrom setuptools import setup def read(fname): with open(fname) as fhandle: return fhandle.read() def readMD(fname): # Utility function to read the README file. full_fname = os.path.join(os.path.dirname(__file__), fname) if 'PANDOC_PATH' in os.environ: import pandoc pandoc.core.PANDOC_PATH = os.enviro...
normal
{ "blob_id": "7b18c967cf50d87b089dc22f3fbe6d40d708483f", "index": 8441, "step-1": "import osfrom setuptools import setup\ndef read(fname): with open(fname) as fhandle: return fhandle.read()\ndef readMD(fname): # Utility function to read the README file. full_fname = os.path.join(os.path.dirname(__file__), fnam...
[ 0 ]
from unidecode import unidecode import pdb import os, manage import re from datetime import * import codecs import csv import smtplib from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.contrib.auth.models import User from django.db.models import Q from django.contrib import...
normal
{ "blob_id": "480787d7bc0e87df7c59c4deb402eea76643680c", "index": 7529, "step-1": "<mask token>\n\n\ndef createMatchFeed(request, teamwedstrijd=None):\n cal = EventFeed(teamwedstrijd)\n return cal.__call__(request)\n\n\n@login_required\ndef viewMatch(request, match):\n try:\n m = Match.objects.get...
[ 6, 8, 9, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def phi(n): r = n d = 2 p = n while r > 1: if r % d == 0: p -= int(r / d) while r % d == 0: r = int(r / d) d += 1 return p <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "e4f97018567559fc2714b75654974fb7c51f770f", "index": 5266, "step-1": "<mask token>\n", "step-2": "def phi(n):\n r = n\n d = 2\n p = n\n while r > 1:\n if r % d == 0:\n p -= int(r / d)\n while r % d == 0:\n r = int(r / d)\n d += 1\n r...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MPNNMessage: """Package for sending an MPNN model over pickle""" def __init__(self, model: tf.keras.Model): """ Args: model: Model to be sent """ self.config = model.to_json() self.weights = [np.array(v) for v in model.get...
flexible
{ "blob_id": "95ab8fce573ef959946d50d9af6e893cb8798917", "index": 6714, "step-1": "<mask token>\n\n\nclass MPNNMessage:\n \"\"\"Package for sending an MPNN model over pickle\"\"\"\n\n def __init__(self, model: tf.keras.Model):\n \"\"\"\n Args:\n model: Model to be sent\n \"\"...
[ 9, 11, 12, 13, 14 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 14 01:32:26 2019 @author: himanshu """ import numpy as np from scipy.interpolate import interp1d from option import Option class FFTPricing: def __init__(self, option : Option, riskFreeRate, ...
normal
{ "blob_id": "25987c15c28e3939f9f531dbc1d4bd9bf622b5a9", "index": 5691, "step-1": "<mask token>\n\n\nclass FFTPricing:\n\n def __init__(self, option: Option, riskFreeRate, volatility,\n samplePoints, bandwidth, dampingFactor, underlyingModel='GBM'):\n self.__option = option\n self.__r = ri...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class CompetenceTest(TestCase): <|reserved_special_token_0|> def test_translation(self): competence = Competence.objects.first() self.assertEqual(competence.name, 'mining') competence.set_current_language('sv') self.assertEqual(competence.name, 'gr...
flexible
{ "blob_id": "d7b0ff6549d854d21ad1d2d0f5a9e7f75f4ac1d5", "index": 956, "step-1": "<mask token>\n\n\nclass CompetenceTest(TestCase):\n <mask token>\n\n def test_translation(self):\n competence = Competence.objects.first()\n self.assertEqual(competence.name, 'mining')\n competence.set_cur...
[ 2, 3, 4, 5 ]
class tenDParameters: def __init__(self, b: float, DM: float, pm_l: float, pm_b: float, vrad: float, sb: float, spml: float, spmb: float, sdm: float, vc: float): self.b = b self.DM = DM # this is actually pm_l * cos b, apparently self.pm_l = pm...
normal
{ "blob_id": "82e7e22293551e061dcb295c52714c22df0ed0ce", "index": 5678, "step-1": "<mask token>\n", "step-2": "class tenDParameters:\n <mask token>\n", "step-3": "class tenDParameters:\n\n def __init__(self, b: float, DM: float, pm_l: float, pm_b: float, vrad:\n float, sb: float, spml: float, spm...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .string_helper import camelize, uncamelize, camelize_for_dict_key, camelize_for_dict_key_in_list, uncamelize_for_dict_key, uncamelize_for_dict_key_in_list from .datetime_helper import datetime_format from .class_helper import override from .paginate impo...
flexible
{ "blob_id": "64a590d31be98f7639034662b2a322e5572cc1ae", "index": 3554, "step-1": "<mask token>\n", "step-2": "from .string_helper import camelize, uncamelize, camelize_for_dict_key, camelize_for_dict_key_in_list, uncamelize_for_dict_key, uncamelize_for_dict_key_in_list\nfrom .datetime_helper import datetime_fo...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def cc_dot(nu, nv): return float(len(nu & nv)) / len(nu | nv) def cc_max(nu, nv): return float(len(nu & nv)) / max(len(nu), len(nv)) <|reserved_special_token_0|> def average_clustering(G, nodes=None, mode='dot'): """Compute the average bipartite clustering coefficient. ...
flexible
{ "blob_id": "a21c132ba9f24ff2c695bf66cae074705025d6b1", "index": 8063, "step-1": "<mask token>\n\n\ndef cc_dot(nu, nv):\n return float(len(nu & nv)) / len(nu | nv)\n\n\ndef cc_max(nu, nv):\n return float(len(nu & nv)) / max(len(nu), len(nv))\n\n\n<mask token>\n\n\ndef average_clustering(G, nodes=None, mode...
[ 4, 8, 9, 10, 11 ]
from django.urls import reverse_lazy from django.views.generic import ( ListView, DetailView, CreateView, UpdateView, DeleteView, ) from .models import Entry class EntryListView(ListView): model = Entry queryset = Entry.objects.all().order_by("-date_created") class EntryDetailView(Detai...
normal
{ "blob_id": "37c03732ae52171fc24aec85c940848b02d76dc1", "index": 1176, "step-1": "<mask token>\n\n\nclass EntryCreateView(CreateView):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass EntryUpdateView(UpdateView):\n model = Entry\n fields = ['title', 'content']\n\n def get_success_url(sel...
[ 6, 7, 10, 11, 13 ]
default_app_config = 'reman.apps.RemanConfig'
normal
{ "blob_id": "0b0b928aef9a4e9953b02639bf5e7769cc4389d7", "index": 2488, "step-1": "<mask token>\n", "step-2": "default_app_config = 'reman.apps.RemanConfig'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def handler(event, context): dynamodb = boto3.resource('dynamodb', region_name='us-west-2', aws_access_key_id=AWS_KEY, aws_secret_access_key=AWS_SECRET) table = dynamodb.Table('orders') body = event['body-jso...
flexible
{ "blob_id": "511ea9eb1dc234a488c19f9ee9fbd40f81955d54", "index": 5172, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef handler(event, context):\n dynamodb = boto3.resource('dynamodb', region_name='us-west-2',\n aws_access_key_id=AWS_KEY, aws_secret_access_key=AWS_SECRET)\n table = dyn...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_googlesearch # Purpose: Searches Google for content related to the domain in question. # # Author: Steve Micallef <steve@binarypool.com> # # Created: 07/05/2012 # Copyright...
normal
{ "blob_id": "3a6eaa238e78e7a818bcf6e18cc7881eadf94b07", "index": 7863, "step-1": "<mask token>\n\n\nclass sfp_googlesearch(SpiderFootPlugin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def watchedEvents(self):\n return ['INTERNET_NAME']\n\n def prod...
[ 4, 5, 7, 8, 9 ]
radius = int(input("enter the value for the radius of the cycle: ")) circumference = 2 * 3.14159 * radius diameter = 2 * radius area = 3.14159 * radius ** 2 print('circumference is ', circumference) print('diameter is: ', diameter) print('area is ', area)
normal
{ "blob_id": "ab5412a3d22bd53a592c93bad4870b06fd9f0720", "index": 4080, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('circumference is ', circumference)\nprint('diameter is: ', diameter)\nprint('area is ', area)\n", "step-3": "radius = int(input('enter the value for the radius of the cycle: '))\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __all__ = ['PiGear', 'CamGear', 'VideoGear'] <|reserved_special_token_1|> from .pigear import PiGear from .camgear import CamGear from .videogear import VideoGear __all__ = ['PiGear', 'CamGear', 'VideoGear'] <|reserved_specia...
flexible
{ "blob_id": "3431e342c940b0d91f817c3e583728e55e305210", "index": 8940, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['PiGear', 'CamGear', 'VideoGear']\n", "step-3": "from .pigear import PiGear\nfrom .camgear import CamGear\nfrom .videogear import VideoGear\n__all__ = ['PiGear', 'CamGear', '...
[ 0, 1, 2, 3 ]
#!/usr/bin/python3 import RPi.GPIO as GPIO import time # motor_EN_A: Pin7 | motor_EN_B: Pin11 # motor_A: Pin8,Pin10 | motor_B: Pin13,Pin12 #Motor_A_EN = 7 Motor_B_EN = 11 #Motor_A_Pin1 = 8 #Motor_A_Pin2 = 10 Motor_B_Pin1 = 13 Motor_B_Pin2 = 12 Dir_forward = 0 Dir_backward = 1 #pwm_A = 0 pwm_B =...
normal
{ "blob_id": "7369d5a463b0f41c17d5648739d4730256e611f9", "index": 9612, "step-1": "<mask token>\n\n\ndef setup():\n global pwm_A, pwm_B\n GPIO.setwarnings(False)\n GPIO.setmode(GPIO.BOARD)\n GPIO.setup(Motor_B_EN, GPIO.OUT)\n GPIO.setup(Motor_B_Pin1, GPIO.OUT)\n GPIO.setup(Motor_B_Pin2, GPIO.OUT...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> table.write('\\begin{tabular}{|c|c|c|c|} \\hline\n') table.write( 'Hidden Neurons & Loss & Training Acc. & Valid. Acc. \\\\ \\hline\n') <|reserved_special_token_0|> for h in H: file = open('Out\\out-h' + str(h) + '.txt', '...
flexible
{ "blob_id": "3cace66ddf8484d285c2b2a8fabbb83778a2c4af", "index": 4352, "step-1": "<mask token>\n", "step-2": "<mask token>\ntable.write('\\\\begin{tabular}{|c|c|c|c|} \\\\hline\\n')\ntable.write(\n 'Hidden Neurons & Loss & Training Acc. & Valid. Acc. \\\\\\\\ \\\\hline\\n')\n<mask token>\nfor h in H:\n f...
[ 0, 1, 2, 3, 4 ]
from __future__ import division import torch import torch.nn as nn import math def conv_bn(inp, oup, stride): return nn.Sequential( nn.Conv2d(inp, oup, 3, stride, 1, bias=False), nn.BatchNorm2d(oup), nn.ReLU(inplace=True) ) def conv_1x1_bn(inp, oup): return nn.Sequential( ...
normal
{ "blob_id": "be1638638c70cf761bf5d2f0eb474b44684dfa47", "index": 4657, "step-1": "<mask token>\n\n\nclass SmallMobileNetV2(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SmallMobileNetV2Part(nn.Module):\n\n def __init__(self, widen_factor=1.0, num_classes=68 * 2):\n super(...
[ 7, 11, 13, 15, 17 ]
# Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
normal
{ "blob_id": "fc5b9117ecf56401a888e2b6a5e244f9ab115e41", "index": 3999, "step-1": "<mask token>\n\n\nclass SyncTestCase(tests.unittest.HomeserverTestCase):\n <mask token>\n servlets = [admin.register_servlets, knock.register_servlets, login.\n register_servlets, room.register_servlets]\n\n def pre...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> def int_installs(x): try: return int(x.replace(',', '').replace('+', '')) except: raise ValueError('Cannot transform to int.') def test_int_install_1(): """Unit test to showcase functionality of int of int """ expected_output_price = 65000 output_...
flexible
{ "blob_id": "b874bfe9590a3eaff4298d6f9cc72be92000dc30", "index": 1108, "step-1": "<mask token>\n\n\ndef int_installs(x):\n try:\n return int(x.replace(',', '').replace('+', ''))\n except:\n raise ValueError('Cannot transform to int.')\n\n\ndef test_int_install_1():\n \"\"\"Unit test to sho...
[ 2, 4, 5, 6, 7 ]
import numpy as np import pandas as pd import datetime import time from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.neighbors import KNeighborsRegressor from sklearn.model_selection import cross_val_score from sklearn import preprocessing from sklearn.model...
normal
{ "blob_id": "5172819da135600d0764033a85a4175098274806", "index": 7388, "step-1": "<mask token>\n\n\nclass ModelSelection:\n\n def __init__(self, user_data, movie_data, aggregated_data, train_data,\n output_train):\n self.train = train_data\n self.users = user_data\n self.aggregated...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Reminders(commands.Cog): def __init__(self, bot: Bot): self.bot = bot self.bot.loop.create_task(reminder_check(self.bot)) @commands.group(help=LONG_HELP_TEXT, brief=SHORT_HELP_TEXT) async def reminder(self, ctx: Context): if not ctx.invoked_subc...
flexible
{ "blob_id": "0f54853901a26b66fe35106593ded6c92785b8db", "index": 2682, "step-1": "<mask token>\n\n\nclass Reminders(commands.Cog):\n\n def __init__(self, bot: Bot):\n self.bot = bot\n self.bot.loop.create_task(reminder_check(self.bot))\n\n @commands.group(help=LONG_HELP_TEXT, brief=SHORT_HELP...
[ 3, 4, 5, 6, 7 ]
from django.contrib import admin from Evaluacion.models import Evaluacion admin.site.register(Evaluacion)
normal
{ "blob_id": "4ef4e302304ccf2dc92cdebe134e104af47aae20", "index": 3795, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Evaluacion)\n", "step-3": "from django.contrib import admin\nfrom Evaluacion.models import Evaluacion\nadmin.site.register(Evaluacion)\n", "step-4": null, "step-...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> Easy = [['4 + 12 = ?', 16], ['45 -34 = ?', 11], ['27 + 12 -18 = ?', 21], [ '25 - 5 * 4 = ?', 5], ['18 + 45 / 5 - 3 * 2 = ?', 21], ['5! = ?', 120], ['3! + 2! = ?', 8], ['7 + 5! / 4! - 6 / 3 = ?', 10], [ '(25 + 5) / 6 * 4 = ?', 20], ['4(3+c)+c=c+4;...
flexible
{ "blob_id": "66edf0d2f7e25e166563bdb1063a1ed45ecda0e6", "index": 541, "step-1": "<mask token>\n", "step-2": "Easy = [['4 + 12 = ?', 16], ['45 -34 = ?', 11], ['27 + 12 -18 = ?', 21], [\n '25 - 5 * 4 = ?', 5], ['18 + 45 / 5 - 3 * 2 = ?', 21], ['5! = ?', 120],\n ['3! + 2! = ?', 8], ['7 + 5! / 4! - 6 / 3 = ?...
[ 0, 1, 2 ]
import collections import copy import threading import typing as tp from ..decorators.decorators import wraps from ..typing import K, V, T class Monitor: """ Base utility class for creating monitors (the synchronization thingies!) These are NOT re-entrant! Use it like that: >>> class MyProtec...
normal
{ "blob_id": "0528d7761cbbf3dbe881ff05b81060f3d97e7f6c", "index": 742, "step-1": "<mask token>\n\n\nclass MonitorList(tp.Generic[T], collections.UserList, Monitor):\n <mask token>\n\n def __init__(self, *args):\n collections.UserList.__init__(self, *args)\n Monitor.__init__(self)\n <mask to...
[ 17, 20, 22, 23, 33 ]
<|reserved_special_token_0|> class AjaxableResponseMixin: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class EditorHomeView(LoginRequiredMixin, AjaxableResponseMixin, CreateView): form_class = EditorTextForm model = EditorText def get_context_data(s...
flexible
{ "blob_id": "87a4fcb26464925952dde57fecf4709f01e9fed7", "index": 9916, "step-1": "<mask token>\n\n\nclass AjaxableResponseMixin:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass EditorHomeView(LoginRequiredMixin, AjaxableResponseMixin, CreateView):\n form_class = EditorTextForm\n model = Ed...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> def get_certs_keys(kid): url = 'https://www.googleapis.com/oauth2/v3/certs' data = requests.get(url).json()['keys'] return next(filter(lambda e: kid == e['kid']), None) def get_redirect_link(realid=None): state = util.generate_id(50) certificate.register_state(state,...
flexible
{ "blob_id": "c75c69b006734e476352de1913fd4a58021bffd6", "index": 2704, "step-1": "<mask token>\n\n\ndef get_certs_keys(kid):\n url = 'https://www.googleapis.com/oauth2/v3/certs'\n data = requests.get(url).json()['keys']\n return next(filter(lambda e: kid == e['kid']), None)\n\n\ndef get_redirect_link(re...
[ 11, 12, 14, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Fun_hiraganas(): hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'h...
flexible
{ "blob_id": "1fe7d5db1b47ba082301d07d010c6796fbd7edb7", "index": 6859, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Fun_hiraganas():\n hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko',\n 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na',\n 'n...
[ 0, 2, 3, 4, 5 ]
from django.conf.urls import url from ..views import (buildings_upload, keytype_upload, key_upload, keystatus_upload, keyissue_upload) from django.contrib.auth.decorators import login_required urlpatterns = [ url(r'^buildings_csv/$', # NOQA buildings_upload, name="buildings_upload"), url(r'^ke...
normal
{ "blob_id": "4a0d8e6b6205fa57b8614857e1462203a2a7d2c5", "index": 3002, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^buildings_csv/$', buildings_upload, name=\n 'buildings_upload'), url('^keytype_csv/$', keytype_upload, name=\n 'keytype_upload'), url('^key_csv/$', key_upload, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CohortIdUserIdTestSuite(AdmissionsTestCase): <|reserved_special_token_0|> @patch(GOOGLE_CLOUD_PATH['client'], apply_google_cloud_client_mock()) @patch(GOOGLE_CLOUD_PATH['bucket'], apply_google_cloud_bucket_mock()) @patch(GOOGLE_CLOUD_PATH['blob'], apply_google_cloud...
flexible
{ "blob_id": "937711546271c145d0f0df2981bdd7d1e9297e3a", "index": 3788, "step-1": "<mask token>\n\n\nclass CohortIdUserIdTestSuite(AdmissionsTestCase):\n <mask token>\n\n @patch(GOOGLE_CLOUD_PATH['client'], apply_google_cloud_client_mock())\n @patch(GOOGLE_CLOUD_PATH['bucket'], apply_google_cloud_bucket_...
[ 9, 13, 14, 15, 16 ]
<|reserved_special_token_0|> class PickleTest(jtu.JaxTestCase): def testPickleOfDeviceArray(self): x = jnp.arange(10.0) s = pickle.dumps(x) y = pickle.loads(s) self.assertArraysEqual(x, y) self.assertIsInstance(y, type(x)) self.assertEqual(x.aval, y.aval) def ...
flexible
{ "blob_id": "79c8e87e1d247eef8dd1ca8e307bbe6d25bf48e2", "index": 8172, "step-1": "<mask token>\n\n\nclass PickleTest(jtu.JaxTestCase):\n\n def testPickleOfDeviceArray(self):\n x = jnp.arange(10.0)\n s = pickle.dumps(x)\n y = pickle.loads(s)\n self.assertArraysEqual(x, y)\n s...
[ 6, 9, 10, 11, 13 ]
import pandas as pd from pymongo import MongoClient import numpy as np mongo_client = MongoClient('localhost', 27018) mongo_db = mongo_client['ProjetoIN242'] mongo_collection = mongo_db['contadorpessoas'] query = mongo_collection.find({}) df = pd.DataFrame.from_records(query) df_filtro = df[['Entrada','Dia', 'Quant...
normal
{ "blob_id": "9d4559a363c4fd6f9a22dc493a7aaa0a22386c21", "index": 8071, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf_filtro.groupby('Dia')['Quantidade de pessoas'].mean().plot(x='Dia', y=\n 'Quantidade de pessoas')\n", "step-3": "<mask token>\nmongo_client = MongoClient('localhost', 27018)\nmong...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class AssetRepositoryView(BrowserView): <|reserved_special_token_0|> def contained_items(self, uid): stack = api.content.get(UID=uid) return stack.restrictedTraverse('@@folderListing')() def item_index(self, uid): return len(self.contained_items(uid))...
flexible
{ "blob_id": "70c20b38edb01552a8c7531b3e87a9302ffaf6c5", "index": 5062, "step-1": "<mask token>\n\n\nclass AssetRepositoryView(BrowserView):\n <mask token>\n\n def contained_items(self, uid):\n stack = api.content.get(UID=uid)\n return stack.restrictedTraverse('@@folderListing')()\n\n def i...
[ 3, 4, 5, 6, 7 ]
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) def fully_connected(prev_layer, num_units, batch_norm, is_training=False): layer = tf.layers.dense(prev_layer, num_units, use_bias=False, activation=None)...
normal
{ "blob_id": "17b3f51779bda5a48c4d77c35d6bbdd2aadb13cd", "index": 1432, "step-1": "<mask token>\n\n\ndef fully_connected(prev_layer, num_units, batch_norm, is_training=False):\n layer = tf.layers.dense(prev_layer, num_units, use_bias=False,\n activation=None)\n if batch_norm:\n layer = tf.laye...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class XPlaneDataOut: def __init__(self, host: str, port: int) ->None: self.address = host, port self.socket = socket.socket(family=socket.AF_INET, type=socket. SOCK_DGRAM) def write(self, data: Position) ->None: self.socket.sendto(_encode(data...
flexible
{ "blob_id": "68fa47e528e5c7c553c3c49ee5b7372b8a956302", "index": 3364, "step-1": "<mask token>\n\n\nclass XPlaneDataOut:\n\n def __init__(self, host: str, port: int) ->None:\n self.address = host, port\n self.socket = socket.socket(family=socket.AF_INET, type=socket.\n SOCK_DGRAM)\n\n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class RecursiveTest(TestCase): <|reserved_special_token_0|> def tearDown(self): ls = output_lines(['docker', 'ps', '-a']) images = [] for l in ls[1:]: ws = l.split() images.append(ws[-1]) assert self.docker_name not in image...
flexible
{ "blob_id": "4c63072b6242507c9b869c7fd38228488fda2771", "index": 6098, "step-1": "<mask token>\n\n\nclass RecursiveTest(TestCase):\n <mask token>\n\n def tearDown(self):\n ls = output_lines(['docker', 'ps', '-a'])\n images = []\n for l in ls[1:]:\n ws = l.split()\n ...
[ 4, 5, 7, 8, 9 ]
from base64 import b64decode import time from lampost.context.resource import m_requires from lampost.datastore.dbo import KeyDBO from lampost.datastore.dbofield import DBOField from lampost.datastore.exceptions import DataError from lampost.model.player import Player from lampost.util.encrypt import make_hash, check_...
normal
{ "blob_id": "210199ed217db0d7a05e280f20e33496c0795f06", "index": 9472, "step-1": "<mask token>\n\n\nclass UserManager:\n <mask token>\n\n def validate_user(self, user_name, password):\n user = self.find_user(user_name)\n if not user:\n raise ClientError()\n self.validate_pas...
[ 11, 17, 19, 21, 27 ]
r""" 测试dispatch >>> from url_router.map import Map >>> from url_router.rule import Rule >>> m = Map([ ... Rule('/', endpoint='index'), ... Rule('/foo', endpoint='foo'), ... Rule('/bar/', endpoint='bar'), ... Rule('/any/<name>', endpoint='any'), ... Rule('/string/<string:name>', endpoint='string'), ...
normal
{ "blob_id": "3cca7408eb88f91f295c581c29d3d1e95298f337", "index": 6445, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n import doctest\n doctest.testmod()\n", "step-3": "r\"\"\" 测试dispatch\n\n>>> from url_router.map import Map\n>>> from url_router.rule import Rule\n>>> ...
[ 0, 1, 2 ]
from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import messagebox import random import numpy as np import timeit def main(): root = tk.Tk() # root.geometry('800x500') root.resizable(width=False, height=False) root.title('Tugas Algoritma') canva...
normal
{ "blob_id": "8a9feae4ce209def2c98b7bed993f9b5c019a533", "index": 7480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n root = tk.Tk()\n root.resizable(width=False, height=False)\n root.title('Tugas Algoritma')\n canvas = tk.Canvas(root, height=500, width=800)\n canvas.pack...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if m % 20 == 0: m2 = m // 20 c = 20 else: m2 = m // 20 + 1 c = m % 20 <|reserved_special_token_0|> if f2 <= 0 or f2 - (20 - c) <= 0: print('Number of trains needed: ' + str(m2)) else: print('Number of train...
flexible
{ "blob_id": "3c6ef57501e01da79f894b36726a93a3a5e0a8f6", "index": 8068, "step-1": "<mask token>\n", "step-2": "<mask token>\nif m % 20 == 0:\n m2 = m // 20\n c = 20\nelse:\n m2 = m // 20 + 1\n c = m % 20\n<mask token>\nif f2 <= 0 or f2 - (20 - c) <= 0:\n print('Number of trains needed: ' + str(m2...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not os.path.exists(pb_path): os.makedirs(pb_path) if not os.path.exists(ckpt_path): os.makedirs(ckpt_path) <|reserved_special_token_0|> if __name__ == '__main__': first_shape = None anchor_placeholder = tf.place...
flexible
{ "blob_id": "97bbb181cbc0f5bfbf0b2298133fc226b6217d91", "index": 399, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.exists(pb_path):\n os.makedirs(pb_path)\nif not os.path.exists(ckpt_path):\n os.makedirs(ckpt_path)\n<mask token>\nif __name__ == '__main__':\n first_shape = None\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Runner: def __init__(self, appid='TJZHDJ01', username='', password=''): urllib3.disable_warnings() self.currentTime = datetime.datetime.now().strftime('%H:%M:%S') self.username = username self.password = password self.thumbedFilePath = '....
flexible
{ "blob_id": "55a26eb2625acb201677f5ff50fde809402c9b93", "index": 2630, "step-1": "<mask token>\n\n\nclass Runner:\n\n def __init__(self, appid='TJZHDJ01', username='', password=''):\n urllib3.disable_warnings()\n self.currentTime = datetime.datetime.now().strftime('%H:%M:%S')\n self.usern...
[ 17, 19, 20, 21, 24 ]
<|reserved_special_token_0|> class test(TestCase): <|reserved_special_token_0|> def test2(self): """ 标准验证:混凝土结构基本原理答案吕晓寅版第12章 """ b = 250 h = 350 l0 = 5 a = 40 a_ = 40 Ec = 30000.0 As = 1017 As_ = 1017 n = 10 ...
flexible
{ "blob_id": "acb9b6128a3432aecf3498e1d27bdff204fee0f4", "index": 8110, "step-1": "<mask token>\n\n\nclass test(TestCase):\n <mask token>\n\n def test2(self):\n \"\"\"\n 标准验证:混凝土结构基本原理答案吕晓寅版第12章\n \"\"\"\n b = 250\n h = 350\n l0 = 5\n a = 40\n a_ = 40\...
[ 4, 5, 6, 8, 9 ]
import sys sys.stdin = open("input.txt", "r") stick = input() cnt = 0 temp =[] for i,s in enumerate(stick): #'('나오면 무조건 추가 if s == '(': temp.append(s) else: #절단인 경우 if stick[i-1] == '(': temp.pop() cnt += len(temp) #길이가 짧아 아웃 els...
normal
{ "blob_id": "9f38148c19f0cb9522725d9eb27c91f70055cba1", "index": 4998, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i, s in enumerate(stick):\n if s == '(':\n temp.append(s)\n elif stick[i - 1] == '(':\n temp.pop()\n cnt += len(temp)\n else:\n temp.pop()\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class StaticDataDao(type): @property def delivery_statuses(cls): if getattr(cls, '_delivery_statuses', None) is None: cls._delivery_statuses = list(DeliveryStatus.objects.all()) return cls._delivery_statuses @property def calc_parameters(cls):...
flexible
{ "blob_id": "2e66a31638eb4e619f14a29d5d3847482d207003", "index": 3996, "step-1": "<mask token>\n\n\nclass StaticDataDao(type):\n\n @property\n def delivery_statuses(cls):\n if getattr(cls, '_delivery_statuses', None) is None:\n cls._delivery_statuses = list(DeliveryStatus.objects.all())\n...
[ 5, 6, 7, 8, 12 ]
from __future__ import print_function class StackQueue(object): """Queue implemented with two stacks""" def __init__(self): self.stack1 = [] self.stack2 = [] def enqueue(self, data): self.stack1.append(data) def dequeue(self): if self.stack2: return self.s...
normal
{ "blob_id": "24f6328d578b6145bf86d7b5378a081463936df3", "index": 9670, "step-1": "<mask token>\n\n\nclass StackQueue(object):\n <mask token>\n <mask token>\n\n def enqueue(self, data):\n self.stack1.append(data)\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n...
[ 2, 6, 8, 9, 11 ]
<|reserved_special_token_0|> class SonMenu(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: verbose_name = u'二级菜单' verbose_name_plural = u'二级菜单' <|reserved_special_token_0|> class Img(models.Model): tag = mode...
flexible
{ "blob_id": "49b007b723b9c43fb79d5dffa2546c856faf4937", "index": 8625, "step-1": "<mask token>\n\n\nclass SonMenu(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_name = u'二级菜单'\n verbose_name_plural = u'二级菜单'\n <mask token>\n\n\nclass Img(model...
[ 7, 8, 10, 11, 14 ]
"""Toggle the proof color. Like operating in the menu: **View** > **Proof Colors** (Ctrl + Y) """ # Import local modules from photoshop import Session with Session() as ps: ps.app.runMenuItem(ps.app.stringIDToTypeID("toggleProofColors"))
normal
{ "blob_id": "1db866ca73bc264d474d5e5086c4a047d7e46546", "index": 2299, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith Session() as ps:\n ps.app.runMenuItem(ps.app.stringIDToTypeID('toggleProofColors'))\n", "step-3": "<mask token>\nfrom photoshop import Session\nwith Session() as ps:\n ps.app...
[ 0, 1, 2, 3 ]
# Main Parameters FONTS_PATH = "media/battle_font.ttf" LEVELS_PATH = "media/levels" GAME_MUSIC_PATH = "media/sounds/DOOM.ogg" MENU_MUSIC_PATH = "media/sounds/ANewMorning.ogg" # GAME Parameters FONT_SIZE = 30 CELL_WIDTH = 13 * 2 CELL_HEIGHT = 13 * 2 CELL_SIZE = (CELL_WIDTH, CELL_HEIGHT) FPS = 30 DISPLAY_WIDTH = CELL_WI...
normal
{ "blob_id": "513d7e3c34cc9da030e2e018ad2db6972cf440dc", "index": 5100, "step-1": "<mask token>\n", "step-2": "FONTS_PATH = 'media/battle_font.ttf'\nLEVELS_PATH = 'media/levels'\nGAME_MUSIC_PATH = 'media/sounds/DOOM.ogg'\nMENU_MUSIC_PATH = 'media/sounds/ANewMorning.ogg'\nFONT_SIZE = 30\nCELL_WIDTH = 13 * 2\nCEL...
[ 0, 1, 2 ]
def calculaEuclidiana(obj1,obj2): soma = 0 for I in range(len(obj1)): soma += (obj1[I] - obj2[I])**2 return soma ** 0.5 def calculaMinkowski(obj1,obj2,p): # p = 2 => distancia Euclidiana # p = 1 => distancia de Manhattan soma = 0 for I in range(len(obj1)): soma += (abs(obj1[...
normal
{ "blob_id": "6c349b7b4d82b37ec1b1ff8e0d35a3557ed1af67", "index": 4613, "step-1": "<mask token>\n\n\ndef calculaMinkowski(obj1, obj2, p):\n soma = 0\n for I in range(len(obj1)):\n soma += abs(obj1[I] - obj2[I]) ** p\n return soma ** (1 / p)\n\n\n<mask token>\n\n\ndef calculaMinkowskiNormalizada(ob...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class FunctionAppDisallowCORS(BaseResourceNegativeValueCheck): def __init__(self): name = 'Ensure function apps are not accessible from all regions' id = 'CKV_AZURE_62' supported_resources = ['azurerm_function_app'] categories = [CheckCategories.GENERA...
flexible
{ "blob_id": "30c2d46d6587df3cbc3e83ecb7af787fcd86eb1f", "index": 7067, "step-1": "<mask token>\n\n\nclass FunctionAppDisallowCORS(BaseResourceNegativeValueCheck):\n\n def __init__(self):\n name = 'Ensure function apps are not accessible from all regions'\n id = 'CKV_AZURE_62'\n supported_...
[ 3, 4, 5, 6, 7 ]
class Circle(): def __init__(self, radius, color="white"): self.radius = radius self.color = color c1 = Circle(10, "black") print("半径:{}, 色: {}".format(c1.radius, c1.color))
normal
{ "blob_id": "6ce50552571594c7be77ac0bf3b5274f2f39e545", "index": 5086, "step-1": "class Circle:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Circle:\n\n def __init__(self, radius, color='white'):\n self.radius = radius\n self.color = color\n\n\n<mask token>\n", "step-3": "class C...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # staticbox.py import wx class StaticBox(wx.Dialog): def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title, size = (250, 230)) wx.StaticBox(self, -1, 'Personal Info', (5, 5), size = (240, 170)) wx.CheckBox(self, ...
normal
{ "blob_id": "96bf6220bfc884e3a19f70a63d9ecba449e2e7e2", "index": 6108, "step-1": "<mask token>\n\n\nclass StaticBox(wx.Dialog):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass StaticBox(wx.Dialog):\n\n def __init__(self, parent, id, title):\n wx.Dialog.__i...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def animationDisplay(): matrix.Clear() sonicRun = 0 sonicFrame = 0 y = 0 while y < 70: sonicFrame = 0 if sonicRun >= 100: sonicRun = 0 y = y + 15 while sonicFra...
flexible
{ "blob_id": "ede675c971ed233e93c14aa4d2ffb66fe7ba775a", "index": 5613, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef animationDisplay():\n matrix.Clear()\n sonicRun = 0\n sonicFrame = 0\n y = 0\n while y < 70:\n sonicFrame = 0\n if sonicRun >= 100:\n sonic...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_len_count_index_list(): print('=== get_len_count_index_list ===') l = ['a', 'b', 'c', 'd', 'e', 'e'] print(l[0]) print('len: {}'.format(len(l))) print('count d: {}'.format(l.count('d'))) print('count e: {}'.format(l.count('e'))) print('count f: {}'.form...
flexible
{ "blob_id": "1a710916461644a0676a3bd84926aeabb2aa3f71", "index": 7127, "step-1": "<mask token>\n\n\ndef get_len_count_index_list():\n print('=== get_len_count_index_list ===')\n l = ['a', 'b', 'c', 'd', 'e', 'e']\n print(l[0])\n print('len: {}'.format(len(l)))\n print('count d: {}'.format(l.count(...
[ 10, 11, 12, 14, 15 ]
from django.core.cache import cache from rest_framework import serializers from thenewboston.constants.crawl import ( CRAWL_COMMAND_START, CRAWL_COMMAND_STOP, CRAWL_STATUS_CRAWLING, CRAWL_STATUS_NOT_CRAWLING, CRAWL_STATUS_STOP_REQUESTED ) from v1.cache_tools.cache_keys import CRAWL_CACHE_LOCK_KEY, ...
normal
{ "blob_id": "cb32aa6a1c42e7bb417999f3f6f74ec22209c5a0", "index": 1230, "step-1": "<mask token>\n\n\nclass CrawlSerializer(serializers.Serializer):\n <mask token>\n <mask token>\n\n def create(self, validated_data):\n \"\"\"Start a network crawl\"\"\"\n crawl = validated_data['crawl']\n ...
[ 4, 5, 6, 7, 8 ]
print ("Welcome to the Guessing Game 2.0\n") print ("1 = Easy\t(1 - 10)") print ("2 = Medium\t(1 - 50)") print ("3 = Hard\t(1 - 100)") # Player: Input user's choice # while: Check if user enters 1 or 2 or 3 # CPU: Generate a random number # Player: Input user's number # Variable: Add a variable 'attempt...
normal
{ "blob_id": "7f2489aa440441568af153b231420aa2736716ca", "index": 4052, "step-1": "<mask token>\n", "step-2": "print('Welcome to the Guessing Game 2.0\\n')\nprint('1 = Easy\\t(1 - 10)')\nprint('2 = Medium\\t(1 - 50)')\nprint('3 = Hard\\t(1 - 100)')\n", "step-3": "print (\"Welcome to the Guessing Game 2.0\\n\"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class OutgoingNetworkInputBuffer(InputBuffer): <|reserved_special_token_0|> <|reserved_special_token_0|> class IncomingNetworkInputBuffer(InputBuffer): def __init__(self, frame_limit=12): super().__init__(left_action_name='', right_action_name='', weak_p...
flexible
{ "blob_id": "4789546128263bd298f8f5827734f8402747b9ac", "index": 67, "step-1": "<mask token>\n\n\nclass OutgoingNetworkInputBuffer(InputBuffer):\n <mask token>\n <mask token>\n\n\nclass IncomingNetworkInputBuffer(InputBuffer):\n\n def __init__(self, frame_limit=12):\n super().__init__(left_action...
[ 5, 12, 13, 15, 21 ]
<|reserved_special_token_0|> def First_page(root): global T1, T2, T3 frame = Frame(root, height=500, width=800, bg='ivory') frame.pack() label = Label(root, text='WELCOME TO AGRI MARKET', font=( 'Times new roman', 25)) label.place(x=200, y=50) button = Button(root, text='LogIn', font=(...
flexible
{ "blob_id": "9f3fcc6e097e37479e3ccf1385f20d70d7c3b6c7", "index": 8228, "step-1": "<mask token>\n\n\ndef First_page(root):\n global T1, T2, T3\n frame = Frame(root, height=500, width=800, bg='ivory')\n frame.pack()\n label = Label(root, text='WELCOME TO AGRI MARKET', font=(\n 'Times new roman',...
[ 46, 47, 52, 53, 66 ]
class WSCommand: handshake_hi = 'handshake_hi' ping = 'ping' pong = 'pong' http_call = 'http_call' http_return = 'http_return' class WSMessage: def __init__(self, command: str, data: any=None) ->None: self.command = command self.data = data def strData(self) ->str: ...
normal
{ "blob_id": "d4621ef378b89490278c09e569f781aef1fcef3f", "index": 7013, "step-1": "<mask token>\n\n\nclass WSMessage:\n\n def __init__(self, command: str, data: any=None) ->None:\n self.command = command\n self.data = data\n <mask token>\n\n def dictData(self) ->dict:\n return self.d...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> def normalize_signal(signal): signal = np.double(signal) signal = signal / 2.0 ** 15 signal = signal - signal.mean() return signal / (np.abs(signal).max() + 1e-10) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def normalize_s...
flexible
{ "blob_id": "cb40141eddce9ce11fbd8475fc7c3d37438208a6", "index": 6862, "step-1": "<mask token>\n\n\ndef normalize_signal(signal):\n signal = np.double(signal)\n signal = signal / 2.0 ** 15\n signal = signal - signal.mean()\n return signal / (np.abs(signal).max() + 1e-10)\n\n\n<mask token>\n", "step...
[ 1, 2, 3, 4, 5 ]
import inspect import threading from monitor.mutex import Mutex, mutex_hooks from monitor.condition import Condition, condition_hooks from monitor.shared_variables import SharedList, SharedDict, shared_auto, \ variable_hooks hooks = {} for h in [mutex_hooks, condition_hooks, variable_hooks]: hooks.update(...
normal
{ "blob_id": "80d49b24a2233569a340cee918393b1663c3d55d", "index": 4598, "step-1": "<mask token>\n\n\nclass ConditionWrapper:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MonitorBase(object, metaclass=MonitorMeta):\n _monitor_counter = 0\n _variable_counter = 0\n _condition_counter = 0...
[ 16, 17, 18, 23, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): app.run(host='0.0.0.0', port=5001) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): app.run(host='0.0.0.0', port=5001) if __name__ == '__main__': ...
flexible
{ "blob_id": "b49e5b40ce1e16f1b7c0bd9509daf94f36c51256", "index": 6726, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef main():\n app.run(host='0.0.0.0', port=5001)\n\n\nif __name__ == '__mai...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def getVlan(): session = Session() vlanport = [] for info in session.query(VlanInfo): a = [] a.append(info.nets) a.append(info.vlan_id) vlanport.append(a) interface = [] for i in range(len(vlanport)): nic = vlanport[i] a ...
flexible
{ "blob_id": "cd564ebb51cf91993d2ed1810707aead44c19a6b", "index": 6959, "step-1": "<mask token>\n\n\ndef getVlan():\n session = Session()\n vlanport = []\n for info in session.query(VlanInfo):\n a = []\n a.append(info.nets)\n a.append(info.vlan_id)\n vlanport.append(a)\n in...
[ 3, 4, 5, 6, 7 ]
from google.appengine.api import users from google.appengine.ext import ndb from datetime import datetime from datetime import timedelta import os import logging import webapp2 import jinja2 JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2....
normal
{ "blob_id": "309090167c2218c89494ce17f7a25bd89320a202", "index": 3855, "step-1": "<mask token>\n\n\nclass UserProfile(ndb.Model):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def query_profile(cls, ancestor_key):\n return cls.query(ancestor=ancestor_key).get()\n\n\nclass ...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class ControllerSC: <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def entrarSC(login, senha): resultado = Usuario.entrar(login, senha) return resultado <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved...
flexible
{ "blob_id": "39eecf1c7ec19f7c75721caa092c08569f53d3e5", "index": 9449, "step-1": "<mask token>\n\n\nclass ControllerSC:\n <mask token>\n <mask token>\n\n @staticmethod\n def entrarSC(login, senha):\n resultado = Usuario.entrar(login, senha)\n return resultado\n <mask token>\n <mas...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: print(l) s = len(l) if s > 5: raise TypeError print(d[2]) except TypeError: print('Error!!!length should be less than or equals to 5') except NameError: print('index out of range') else: fo...
flexible
{ "blob_id": "e59e60b0a4b7deca9c510bd6b9c58636c6d34c80", "index": 1027, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n print(l)\n s = len(l)\n if s > 5:\n raise TypeError\n print(d[2])\nexcept TypeError:\n print('Error!!!length should be less than or equals to 5')\nexcept Name...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def main(): data_set = pandas.read_csv('dataset.csv', index_col=False, encoding='gbk') print('数据集的shape:', data_set.shape) dnumpy_x, dnumpy_y = TrainTestProcesser.split_dframe_x_y(data_set) folds = TrainTestProcesser.split_dnumpy_train_test(dnumpy_x, dnumpy_y) model = ...
flexible
{ "blob_id": "b0bc55ab05d49605e2f42ea036f8405727c468d2", "index": 3504, "step-1": "<mask token>\n\n\ndef main():\n data_set = pandas.read_csv('dataset.csv', index_col=False, encoding='gbk')\n print('数据集的shape:', data_set.shape)\n dnumpy_x, dnumpy_y = TrainTestProcesser.split_dframe_x_y(data_set)\n fol...
[ 2, 3, 4, 5, 6 ]
from django.contrib.auth.mixins import LoginRequiredMixin from django.http import JsonResponse from django.views.generic import CreateView, UpdateView, ListView, \ DeleteView, TemplateView from example.forms import EditorTextForm from example.models import EdidorText class AjaxableResponseMixin: """ Mixi...
normal
{ "blob_id": "87a4fcb26464925952dde57fecf4709f01e9fed7", "index": 9916, "step-1": "<mask token>\n\n\nclass AjaxableResponseMixin:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass EditorHomeView(LoginRequiredMixin, AjaxableResponseMixin, CreateView):\n form_class = EditorTextForm\n model = Ed...
[ 7, 8, 9, 10, 12 ]
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 ]
from urllib import request import time import random from useragents import ua_list import re import os class MaoyanSpider(object): def __init__(self): self.url = 'https://maoyan.com/board/4?offset={}' # 请求功能函数 - html def get_html(self,url): headers = { 'User-Agent':random.choi...
normal
{ "blob_id": "7ef0bb3e8cbba4a29249a09cf7bc91e053411361", "index": 2225, "step-1": "<mask token>\n\n\nclass MaoyanSpider(object):\n\n def __init__(self):\n self.url = 'https://maoyan.com/board/4?offset={}'\n\n def get_html(self, url):\n headers = {'User-Agent': random.choice(ua_list)}\n ...
[ 6, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Codec: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Codec: <|reserved_special_token_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type...
flexible
{ "blob_id": "006e1088e72201fab7eebd1409c025b5dba69403", "index": 5938, "step-1": "<mask token>\n", "step-2": "class Codec:\n <mask token>\n <mask token>\n", "step-3": "class Codec:\n <mask token>\n\n def deserialize(self, data):\n \"\"\"Decodes your encoded data to tree.\n \n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def process_await(fn: Callable[..., Awaitable[TV]]) ->Callable[..., TV]: @wraps(fn) @click.pass_context def wrapper(ctx, *args, **kwargs): loop = ctx.obj['loop'] return loop.run_until_complete(fn(ctx, *args, **kwargs)) return wrapper @click.group() @clic...
flexible
{ "blob_id": "3da4896f368f067a339db5cc89201c93ba8166ce", "index": 6220, "step-1": "<mask token>\n\n\ndef process_await(fn: Callable[..., Awaitable[TV]]) ->Callable[..., TV]:\n\n @wraps(fn)\n @click.pass_context\n def wrapper(ctx, *args, **kwargs):\n loop = ctx.obj['loop']\n return loop.run_...
[ 3, 4, 5, 6, 7 ]