code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
""" Unit Tests for endpoints.py """ import unittest import os # pylint: disable=unused-import from mock import patch, call from github_approval_checker.utils import util # pylint: disable=unused-import from github_approval_checker.utils.github_handler import GithubHandler # pylint: disable=unused-import from github...
normal
{ "blob_id": "7626202d1e3ec7321addbb028be2275b882efda2", "index": 6453, "step-1": "<mask token>\n\n\nclass EndpointsUnitTests(unittest.TestCase):\n <mask token>\n\n @patch('github_approval_checker.utils.util.verify_signature')\n @patch('github_approval_checker.api.endpoints.connexion')\n @patch('githu...
[ 5, 6, 7, 8, 9 ]
import sys def isPalin(s): result = True for i in range(len(s)/2): if s[i] != s[-(i + 1)]: result = False break return result def main(): curr_large = 0 for i in xrange(900, 1000): for j in xrange(900, 1000): prod = i * j # Turns out list comprehension is more succint, but I...
normal
{ "blob_id": "1c171c67ca5ef0e9b5f2941eec7a625a8823271f", "index": 8463, "step-1": "import sys\n\ndef isPalin(s):\n result = True\n for i in range(len(s)/2):\n if s[i] != s[-(i + 1)]:\n result = False\n break\n return result\n\n\ndef main():\n curr_large = 0\n for i in xrange(900, 1000):\n for...
[ 0 ]
import random firstNames = ("Thomas", "Daniel", "James", "Aaron", "Tommy", "Terrell", "Jack", "Joseph", "Samuel", "Quinn", "Hunter", "Vince", "Young", "Ian", "Erving", "Leo") lastNames = ("Smith", "Johnson", "Williams", "Kline","Brown", "Garcia", "Jones", "Miller", "Davis","Williams", "Alves", "Sobronsky", "Hall"...
normal
{ "blob_id": "5607d4fea315fa7bf87337453fbef90a93a66516", "index": 3968, "step-1": "<mask token>\n\n\nclass profile:\n\n def __init__(self):\n self.name = firstNames[random.randrange(0, len(firstNames))\n ] + ' ' + lastNames[random.randrange(0, len(lastNames))]\n self.years = 2020\n ...
[ 5, 6, 7, 8, 9 ]
from rest_framework import serializers from .models import data from django.contrib.auth.models import User class dataSerializer(serializers.ModelSerializer): class Meta: model = data fields = ['id', 'task', 'duedate', 'person', 'done', 'task_user'] class userSerializer(serializers.ModelSerial...
normal
{ "blob_id": "972c479ea40232e14fbf678ca2ccf9716e473fe8", "index": 9736, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass userSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = User\n fields = ['username', 'password', 'email']\n", "step-3": "<mask token>\n\n\ncl...
[ 0, 1, 2, 3 ]
#! /usr/bin/python3 print("content-type: text/html") print() import cgi import subprocess as sp import requests import xmltodict import json db = cgi.FieldStorage() ch=db.getvalue("ch") url =("http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber={}&username=<username>" .format(ch)) u...
normal
{ "blob_id": "87a62f76027e0653f6966f76a42def2ce2a26ba3", "index": 5893, "step-1": "<mask token>\n", "step-2": "print('content-type: text/html')\nprint()\n<mask token>\nprint(output)\n", "step-3": "print('content-type: text/html')\nprint()\n<mask token>\ndb = cgi.FieldStorage()\nch = db.getvalue('ch')\nurl = (...
[ 0, 1, 2, 3, 4 ]
from EdgeState import EdgeState from rest_framework import serializers from dzTrafico.BusinessLayer.TrafficAnalysis.TrafficAnalyzer import TrafficAnalyzer, VirtualRampMetering from dzTrafico.BusinessEntities.Location import LocationSerializer from dzTrafico.BusinessLayer.SimulationCreation.NetworkManager import Network...
normal
{ "blob_id": "892c363c247177deb3297af84a93819a69e16801", "index": 8907, "step-1": "from EdgeState import EdgeState\nfrom rest_framework import serializers\nfrom dzTrafico.BusinessLayer.TrafficAnalysis.TrafficAnalyzer import TrafficAnalyzer, VirtualRampMetering\nfrom dzTrafico.BusinessEntities.Location import Loca...
[ 0 ]
#!/usr/bin/env python # -*- coding:UTF-8 -*- ''' @Description: 数据库迁移 @Author: Zpp @Date: 2020-03-30 11:01:56 @LastEditors: Zpp @LastEditTime: 2020-04-28 09:55:26 ''' import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) from flask impor...
normal
{ "blob_id": "69ebdab4cd1f0b5154305410381db252205ff97d", "index": 9768, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(rootPath)\n<mask token>\nmanager.add_command('db', MigrateCommand)\nif __name__ == '__main__':\n manager.run()\n", "step-3": "<mask token>\ncurPath = os.path.abspath(...
[ 0, 1, 2, 3, 4 ]
from mesa import Model from mesa.space import SingleGrid from mesa.time import BaseScheduler, RandomActivation, SimultaneousActivation from pdpython_model.fixed_model.agents import PDAgent from mesa.datacollection import DataCollector class PDModel(Model): schedule_types = {"Sequential": BaseScheduler, ...
normal
{ "blob_id": "446c438b79f9957289fa85f21516c13d67e2cfaf", "index": 3270, "step-1": "<mask token>\n\n\nclass PDModel(Model):\n <mask token>\n <mask token>\n\n def make_agents(self):\n for i in range(self.number_of_agents):\n x, y = self.coordinates.pop(0)\n pdagent = PDAgent((x...
[ 3, 5, 6, 7, 8 ]
# Generated by Django 2.1.3 on 2019-01-06 06:53 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
normal
{ "blob_id": "a91d42764fa14111afca4551edd6c889903ed9bd", "index": 8056, "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 ]
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from keras.models import load_model from utils import resize_to_fit, clear_chunks, stack_windows from imutils import paths import numpy as np import imutils import cv2 as cv2 import pickle from tqdm import tqdm c1_correct = 0 c2_correct = 0 c3_correct = 0 c4_correct ...
normal
{ "blob_id": "c2ddf31bce4a5f3ae2b0d5455bbc9942f92bff40", "index": 275, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(MODEL_LABELS_FILENAME, 'rb') as f:\n lb = pickle.load(f)\n<mask token>\nfor root, dirs, files in os.walk(CAPTCHA_IMAGE_FOLDER):\n for name in tqdm(files, desc='Solving capt...
[ 0, 1, 2, 3, 4 ]
import aiohttp import asyncio import base64 import discord import json from discord.ext import commands class BasicMC(commands.Cog): def __init__(self, bot): self.bot = bot self.session = aiohttp.ClientSession() @commands.command(name="stealskin", aliases=["skinsteal", "skin"]) @command...
normal
{ "blob_id": "a6f242a0443ffbad835f86098b70ede41c03515b", "index": 7652, "step-1": "<mask token>\n\n\nclass BasicMC(commands.Cog):\n <mask token>\n\n @commands.command(name='stealskin', aliases=['skinsteal', 'skin'])\n @commands.cooldown(1, 4, commands.BucketType.user)\n async def skinner(self, ctx, ga...
[ 1, 2, 3, 4, 5 ]
""" Find two distinct numbers in values whose sum is equal to 100. Assign one of them to value1 and the other one to value2. If there are several solutions, any one will be marked as correct. Optional step to check your answer: Print the value of value1 and value2. """ values = [72, 50, 48, 50, 7, 66, 62...
normal
{ "blob_id": "c0ebf10b8c0cb4af11608cafcdb85dbff4abdf90", "index": 4755, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in values:\n for y in values:\n if x + y == 100 and x != y:\n value1 = x\n value2 = y\nprint(value1)\nprint(value2)\n", "step-3": "<mask token>\nva...
[ 0, 1, 2, 3 ]
import sys import json import eventlet import datetime import flask from flask import Flask from flask import render_template __version__ = 0.1 PORT = 8000 HOST = '0.0.0.0' DEBUG = False RELDR = False app = Flask(__name__) app.config['SECRET_KEY'] = 'secretkey' @app.route('/login/') def login(): return render_tem...
normal
{ "blob_id": "a945d7f673d009a59e597cd3c99a886094ea9e57", "index": 2639, "step-1": "<mask token>\n\n\n@app.route('/login/')\ndef login():\n return render_template('login.html', name=None)\n\n\n@app.route('/chat/')\ndef chat():\n return render_template('chat.html', name=None)\n\n\n@app.route('/messages/')\nde...
[ 3, 4, 5, 6 ]
''' Created on Dec 23, 2011 @author: boatkrap ''' import kombu from kombu.common import maybe_declare from . import queues import logging logger = logging.getLogger(__name__) import threading cc = threading.Condition() class Publisher: def __init__(self, exchange_name, channel, routing_key=None): s...
normal
{ "blob_id": "8205541dcdd4627a535b14c6775f04b80e7c0d15", "index": 3354, "step-1": "<mask token>\n\n\nclass Publisher:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TopicPublisher(Publisher):\n\n def __init__(self, exchange_name, channel, routing_key=None):...
[ 7, 9, 12, 13, 15 ]
import json import sys from pkg_resources import resource_string # Load a package data file resource as a string. This _conf = json.loads(resource_string(__name__, 'conf.json')) # Load a data file specified in "package_data" setup option for this pkg. _pkg_data = resource_string(__name__, 'data/pkg1.dat') # Load a d...
normal
{ "blob_id": "4689ee7f7178cef16ac1f5375481a9ee8a48f924", "index": 3780, "step-1": "<mask token>\n\n\ndef hello():\n print(_conf['greeting'])\n print(_pkg_data)\n print(_sys_data)\n\n\n<mask token>\n", "step-2": "<mask token>\ntry:\n _sys_data = open(sys.prefix + '/data/data1.dat').read()\nexcept Exc...
[ 1, 2, 3, 4, 5 ]
from app import db class OrgStaff(db.Model): __tablename__ = 'org_staff' id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id', ondelete="CASCADE")) invited_by = db.Column(db.Integer, db.ForeignKey('users.id', ondelete="CASCADE")) org_id = db.Column(...
normal
{ "blob_id": "b0f92b5e4cc972aca84a29b4568e85836f155273", "index": 3774, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass OrgStaff(db.Model):\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 to...
[ 0, 1, 2, 3, 4 ]
from access.ssh.session import Client from access.ssh.datachannel import DataChannel
normal
{ "blob_id": "967c8348352c805b926643617b88b03a62df2d16", "index": 2271, "step-1": "<mask token>\n", "step-2": "from access.ssh.session import Client\nfrom access.ssh.datachannel import DataChannel\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- pessoas=int(input('Digite o numero de pessoas que passa pela esada rolante:')) for i in range(1,n+1,1): tempo=int(input('Digite o tempo:')) if i==1: tempo1=tempo elif i==n: f=tempo+10 X=f-tempo1 print(x)
normal
{ "blob_id": "f98120d191e9e4b92984a6b59b25b1331b5d8c3a", "index": 1970, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1, 1):\n tempo = int(input('Digite o tempo:'))\n if i == 1:\n tempo1 = tempo\n elif i == n:\n f = tempo + 10\n<mask token>\nprint(x)\n", "st...
[ 0, 1, 2, 3 ]
"""Datasets, Dataloaders, and utils for dataloading""" from enum import Enum import torch from torch.utils.data import Dataset class Partition(Enum): """Names of dataset partitions""" TRAIN = 'train' VAL = 'val' TEST = 'test' class RandomClassData(Dataset): """Standard normal distributed feature...
normal
{ "blob_id": "4c0c88f46c2d4607d9ac00755bf122e847ea2f6a", "index": 6221, "step-1": "<mask token>\n\n\nclass Partition(Enum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass RandomClassData(Dataset):\n \"\"\"Standard normal distributed features and uniformly sampled discrete ta...
[ 6, 7, 8, 9, 10 ]
# Generated by Django 2.2.10 on 2020-05-06 14:43 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('planner', '0023_auto_20191226_1330'), ] operations = [ migrations.AddField( model_name='employee'...
normal
{ "blob_id": "c7558486fc50623f6e64b58668153b75bb6149b9", "index": 6613, "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 = [('planner', '...
[ 0, 1, 2, 3, 4 ]
import multiprocessing name = "flask_gunicorn" workers = multiprocessing.cpu_count() * 2 + 1 loglevel = "debug" bind = f"0.0.0.0:18080"
normal
{ "blob_id": "2ad326f739b42b9c7c252078b8c28e90da17b95d", "index": 1802, "step-1": "<mask token>\n", "step-2": "<mask token>\nname = 'flask_gunicorn'\nworkers = multiprocessing.cpu_count() * 2 + 1\nloglevel = 'debug'\nbind = f'0.0.0.0:18080'\n", "step-3": "import multiprocessing\nname = 'flask_gunicorn'\nworke...
[ 0, 1, 2, 3 ]
from .. import dataclass # trigger the register in the dataclass package
normal
{ "blob_id": "681750dbf489a6a32e9ef1d6f64d493cc252b272", "index": 6386, "step-1": "<mask token>\n", "step-2": "from .. import dataclass\n", "step-3": "from .. import dataclass # trigger the register in the dataclass package\r\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# 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 writing, software # d...
normal
{ "blob_id": "9fa1dab7cb0debf363ae0864af1407c87aad063a", "index": 4926, "step-1": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestUtils(test.NoDBTestCase):\n <mask token>\n\n def test_compare_multiple(s...
[ 1, 2, 4, 5, 6 ]
from django import forms from django.forms import inlineformset_factory from django.utils.translation import ugettext, ugettext_lazy as _ from django.contrib.auth.models import User from django.conf import settings from django.db.models import Max from auction.models import * from datetime import * from decimal import ...
normal
{ "blob_id": "5215b5e4efe2e126f18b3c4457dc3e3902923d49", "index": 6360, "step-1": "<mask token>\n\n\nclass UserForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'first_name', 'last_name', 'email'\n <mask token>\n <mask t...
[ 10, 11, 15, 16, 17 ]
#!/usr/bin/python3 """Unittest for max_integer([..]) """ import unittest max_integer = __import__('6-max_integer').max_integer class TestMaxInteger(unittest.TestCase): """ Interactive tests """ def test_max(self): """Tests max_integer""" self.assertEqual(max_integer([1, 2, 3]), 3) self...
normal
{ "blob_id": "f799fdfde537bbe8f6c49a5e1a15cf6f910a0d45", "index": 889, "step-1": "<mask token>\n\n\nclass TestMaxInteger(unittest.TestCase):\n <mask token>\n\n def test_max(self):\n \"\"\"Tests max_integer\"\"\"\n self.assertEqual(max_integer([1, 2, 3]), 3)\n self.assertEqual(max_intege...
[ 2, 3, 5, 6, 7 ]
#!/usr/bin/python # # @name = 'fmsrutil.py' # # @description = "F-MSR utilities module." # # @author = ['YU Chiu Man', 'HU Yuchong', 'TANG Yang'] # import sys import os import random from finitefield import GF256int from coeffvector import CoeffVector from coeffvector import CoeffMatrix import common #Check if C l...
normal
{ "blob_id": "0ebd19079a16a6e3da34da2ecfda0d159b8580b2", "index": 9527, "step-1": "<mask token>\n\n\ndef getNativeBlockNum(n, k):\n \"\"\"Get number of native blocks.\"\"\"\n return k * (n - k)\n\n\n<mask token>\n\n\ndef getNodeIdList(n, k):\n \"\"\"Find the node id for a segment of blocks.\"\"\"\n \"...
[ 10, 12, 13, 15, 16 ]
botName = "firstBot" username = "mrthemafia" password = "oblivion" client_id = "Y3LQwponbEp07w" client_secret = "R4oyCEj6hSTJWHfWMwb-DGUOBm8"
normal
{ "blob_id": "3031f695d57492cf3b29694fecd0a41c469a3e00", "index": 7481, "step-1": "<mask token>\n", "step-2": "botName = 'firstBot'\nusername = 'mrthemafia'\npassword = 'oblivion'\nclient_id = 'Y3LQwponbEp07w'\nclient_secret = 'R4oyCEj6hSTJWHfWMwb-DGUOBm8'\n", "step-3": "botName = \"firstBot\"\nusername = \"m...
[ 0, 1, 2 ]
# orm/relationships.py # Copyright (C) 2005-2023 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php """Heuristics related to join conditions as used in :func:`_orm.relationship`....
normal
{ "blob_id": "5f8303ce91c5de779bbddbaafb3fb828596babe5", "index": 8669, "step-1": "<mask token>\n\n\nclass JoinCondition:\n primaryjoin_initial: Optional[ColumnElement[bool]]\n primaryjoin: ColumnElement[bool]\n secondaryjoin: Optional[ColumnElement[bool]]\n secondary: Optional[FromClause]\n prop: ...
[ 44, 79, 88, 99, 100 ]
"""tables Revision ID: 35f6815c3112 Revises: None Create Date: 2013-07-28 21:15:38.385006 """ # revision identifiers, used by Alembic. revision = '35f6815c3112' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### op...
normal
{ "blob_id": "9989d31dfe13809d67f629cc283cd02ce354a74e", "index": 115, "step-1": "<mask token>\n\n\ndef upgrade():\n op.create_table('users', sa.Column('id', sa.Integer(), nullable=False),\n sa.Column('firstname', sa.String(length=64), nullable=True), sa.\n Column('lastname', sa.String(length=64)...
[ 1, 2, 3, 4, 5 ]
# 总管buffer和policy from os import path import torch import torch.nn as nn import torch.optim as optim import torch.distributions as distributions import numpy as np from torch.serialization import load import global_var as gv torch.set_default_dtype(gv.torch_default_type) class PG_Agent(object): def __init__( ...
normal
{ "blob_id": "b2cfd397e48213a540608fc232db2eab282935bb", "index": 1481, "step-1": "<mask token>\n\n\nclass PG_Agent(object):\n\n def __init__(self, env, policy: torch.nn.modules.container.Sequential,\n learning_rate: float, n_policy: int, n_episode: int, max_timesteps: int\n ) ->None:\n su...
[ 6, 7, 8, 10, 11 ]
from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from rest_framework.response import Response from django.contrib.auth import logout from rest_framework import status from rest_framework.authtoken.models import Token from .serilizer import UserSerializer class RegistrationView(AP...
normal
{ "blob_id": "6a5a6bdb0740d51426aa8b36dd3cc317103412b1", "index": 641, "step-1": "<mask token>\n\n\nclass LogoutView(APIView):\n\n def get(self, request):\n logout(request)\n return Response({'response': 'logged out'}, status=status.HTTP_200_OK)\n", "step-2": "<mask token>\n\n\nclass Registrati...
[ 2, 4, 5, 6, 7 ]
import numpy as np import mysql.connector from mysql.connector import Error import matplotlib.pyplot as plt def readData(): connection = mysql.connector.connect(host='localhost',database='cad_ultrasound',user='root',password='') sql_select_Query = "SELECT id_pasien,nama,pathdata FROM datasets" cu...
normal
{ "blob_id": "4d7696c832f9255fbc68040b61fde12e057c06fa", "index": 3899, "step-1": "<mask token>\n\n\ndef getFiturEkstraksi():\n connection = mysql.connector.connect(host='localhost', database=\n 'cad_ultrasound', user='root', password='')\n cursor = connection.cursor()\n sql_select_Query = 'SELECT...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # # RPi.Spark KeyButton Demo # # Author: Kunpeng Zhang # 2018.6.6 # # See LICENSE for details. from time import sleep import RPi.GPIO as GPIO from JMRPiSpark.Drives.Key.RPiKeyButtons import RPiKeyButtons from JMRPiSpark.Drives.Key.RPiKeyButtons import DEF_BOUNCE_TIME_SHORT_MON from JMRPiSpark....
normal
{ "blob_id": "50c274e0365f2556a46eb58edcd1f0a7301e89db", "index": 8716, "step-1": "<mask token>\n\n\nclass demo:\n <mask token>\n\n def __init__(self):\n self._myKey = RPiKeyButtons()\n\n def _getKeyButtonName(self, keyBtn):\n if keyBtn == CONFIG_KEY.BUTTON_ACT_A:\n return 'BUTTO...
[ 6, 12, 15, 16, 17 ]
import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import QIcon, QFont from PyQt5.QtCore import QCoreApplication import pymysql import requests from twisted.internet import reactor, defer from scrapy.crawler import CrawlerRunner, CrawlerProcess from scrapy.utils.project import get_project_settings from spider....
normal
{ "blob_id": "889d465ceeac57a600b2fa3bd26632edcd90a655", "index": 2911, "step-1": "<mask token>\n\n\nclass Example(QWidget):\n\n\n class A(QWidget):\n\n def __init__(self):\n super().__init__()\n self.initUI()\n\n def initUI(self):\n self.setGeometry(300, 300, 300...
[ 7, 8, 11, 16, 17 ]
from django import forms class PasswordChangeForm(forms.Form): password = forms.CharField(min_length=8, label="New Password*", strip=False, widget=forms.PasswordInput( attrs={'autocomple...
normal
{ "blob_id": "85fff1f6e1f69dd0e2e9b5acc90db31d27329c7c", "index": 3352, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n password = forms.CharField(min_length=8, label='N...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('location', '0005_auto_20170303_1625'), ] operations = [ migrations.RemoveField( ...
normal
{ "blob_id": "ca7b3b5df860d3c3fb0953857ad950affdcc671d", "index": 9311, "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 = [('location', ...
[ 0, 1, 2, 3, 4 ]
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 ]
from torch import nn class MNIST3dModel(nn.Module): def __init__(self, input_c=3, num_filters=8, num_classes=10): super().__init__() self.conv1 = nn.Conv3d(in_channels=input_c, out_channels= num_filters, kernel_size=3, stride=1, padding=1) self.conv2 = nn.Conv3d(in_channels=nu...
normal
{ "blob_id": "f6838906c961a9ca7d91d2ab02fd2af72797b880", "index": 4628, "step-1": "<mask token>\n\n\nclass MNIST3dModel(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MNIST3dModel(nn.Module):\n <mask token>\n\n def forward(self, x):\n x = self.conv1(x)\n ...
[ 1, 2, 3, 4 ]
#!/usr/bin/env python # # Copyright (C) 2016 The Android Open Source Project # # 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 req...
normal
{ "blob_id": "2ea335dd8d879731aad7713499440db6d1f60d36", "index": 2427, "step-1": "<mask token>\n\n\nclass ArchiveParserTest(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def testReadFile(self):\n \"\"\"Tests that file is read correctly.\n\n Tests that correctly fo...
[ 2, 3, 6, 7, 8 ]
from django.db import models from skills.models import skill from offres.models import Offer # Create your models here. class OfferRequirement(models.Model): skill = models.ForeignKey(skill, on_delete=models.DO_NOTHING ,default="") offer = models.ForeignKey(Offer , on_delete=models.CASCADE, default="")
normal
{ "blob_id": "3640f1df412b43b42fb4e856604508f698a208ad", "index": 6385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass OfferRequirement(models.Model):\n skill = models.ForeignKey(skill...
[ 0, 1, 2, 3, 4 ]
from AStar import astar def main(): grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0,...
normal
{ "blob_id": "ba483c7eaf2f2ced7f70a14b53c781f190585024", "index": 1257, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n grid = [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0],\n [0, 0, 1, 0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 0, 0], [0,\n 0, 0, 0,...
[ 0, 1, 2, 3, 4 ]
"""helloworld URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ https://docs.djangoproject.com/zh-hans/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add ...
normal
{ "blob_id": "a470aad80e47b244811e4d9aed4a630ba36a8daf", "index": 4112, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', include(\n 'blog.urls', namespace='blog')), url('^hello/([0-9]{4})/$', view.hello),\n url('^ifor/', view.ifor)]\n<mask token...
[ 0, 1, 2, 3 ]
__author__ = 'tcaruso' # !/usr/bin/env python # -*- coding: utf-8 -*- import glob import fnmatch import os import sys import warnings from shutil import rmtree from setuptools import find_packages, setup, Command from collections import namedtuple try: from pip._internal.req import parse_requirements except Impo...
normal
{ "blob_id": "58438a1fb0b9e620717ba262c25a43bfbf6b8824", "index": 8100, "step-1": "<mask token>\n\n\nclass UploadCommand(Command):\n <mask token>\n description = 'Build and publish the package.'\n user_options = []\n\n def initialize_options(self):\n pass\n\n def finalize_options(self):\n ...
[ 6, 7, 9, 10, 11 ]
a = 2 while a == 1: b = source() c = function(b)
normal
{ "blob_id": "56cae7b7a0338bd4a405cdc3cdcd9945a9df8823", "index": 5839, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile a == 1:\n b = source()\n<mask token>\n", "step-3": "a = 2\nwhile a == 1:\n b = source()\nc = function(b)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1...
[ 0, 1, 2 ]
from django.contrib import admin from pages.blog.models import Blog admin.site.register(Blog)
normal
{ "blob_id": "534aaf8371707089522af014a93f3ff6c4f913ff", "index": 8510, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Blog)\n", "step-3": "from django.contrib import admin\nfrom pages.blog.models import Blog\nadmin.site.register(Blog)\n", "step-4": null, "step-5": null, "step-...
[ 0, 1, 2 ]
# @description Exporting outline (boundary faces) of zsoil results to vtu # @input zsoil results # @output vtu unstructured grid # @author Matthias Preisig # @date 2017/10/10 import numpy as np from zsoil_tools import zsoil_results as zr from zsoil_tools import vtktools pathname = r'\\192.168.1.51\Mandats sur H RAI...
normal
{ "blob_id": "fb6dd9ec7d8dc80eace90dadc2112c7c27125efd", "index": 2055, "step-1": "<mask token>\n", "step-2": "<mask token>\nres.read_rcf()\nres.read_his()\n<mask token>\nfor kt, step in enumerate(res.steps):\n if step.conv_status in [-1]:\n if step.time in tx:\n tsteps.append(kt)\n<mask to...
[ 0, 1, 2, 3, 4 ]
"""Restaurant""" def main(): """Restaurant""" moeny = int(input()) service = moeny*0.1 vat = moeny*0.07 print("Service Charge : %.2f Baht" %service) print("VAT : %.2f Baht" %vat) print("Total : %.2f Baht" %(moeny+vat+service)) main()
normal
{ "blob_id": "ae6cbb181e024b8c0b222d14120b910919f8cc81", "index": 3811, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"Restaurant\"\"\"\n moeny = int(input())\n service = moeny * 0.1\n vat = moeny * 0.07\n print('Service Charge : %.2f Baht' % service)\n print('VAT...
[ 0, 1, 2, 3 ]
queries = [] for n in range(2, 51): for k in range(n, n * n + 1): queries.append((n, k)) print(len(queries)) for n, k in queries: print(n, k)
normal
{ "blob_id": "798d5c68a0aa2057c28d7f333905f20fef965d70", "index": 2850, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(2, 51):\n for k in range(n, n * n + 1):\n queries.append((n, k))\nprint(len(queries))\nfor n, k in queries:\n print(n, k)\n", "step-3": "queries = []\nfor n ...
[ 0, 1, 2 ]
import json import sqlite3 import time import shelve import os from constants import * VEC_TYPES = [ ''' CREATE TABLE "{}" (ID TEXT PRIMARY KEY NOT NULL, num TEXT NOT NULL); ''', ''' CREATE TABLE "{}" (ID INT PRIMARY KEY NOT NULL, num TEXT NOT NULL); ''...
normal
{ "blob_id": "0a6cb6d3fad09ab7f0e19b6c79965315c0e0d634", "index": 4793, "step-1": "<mask token>\n\n\nclass Vector:\n\n def __init__(self, name, type, url_path):\n self._name = name\n self._conn = sqlite3.connect(url_path)\n self._cur = self._conn.cursor()\n self._cur.execute(\"SELEC...
[ 3, 6, 8, 9, 10 ]
#1. Create a greeting for your program. print("Welcome to the Band Name Generator") #2. Ask the user for the city that they grew up in. city = input("Which city did you grew up in?\n") #3. Ask the user for the name of a pet. pet = input("What is the name of the pet?\n") #4. Combine the name of their city and pet an...
normal
{ "blob_id": "19962e94afdd3edf298b28b9954f479fefa3bba8", "index": 8656, "step-1": "<mask token>\n", "step-2": "print('Welcome to the Band Name Generator')\n<mask token>\nprint('Your band name could be ', Band_name)\n", "step-3": "print('Welcome to the Band Name Generator')\ncity = input('Which city did you ...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from .import views app_name='user' # user子路由 urlpatterns = [ # user首页 url(r'^$',views.index,name='index'), # 用户登录 url('login/', views.login, name='login'), # 用户注册 url('regist/', views.regist, name='regist'), # 根据id判断用户是否存在 url(r'^getuser\w*/(?P<id>\...
normal
{ "blob_id": "de7b5e44c5c213e4ab70b0f8c0c402edaf4926e0", "index": 211, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'user'\nurlpatterns = [url('^$', views.index, name='index'), url('login/', views.\n login, name='login'), url('regist/', views.regist, name='regist'), url(\n '^getuser\\\\...
[ 0, 1, 2, 3 ]
from flask import Blueprint, request, make_response from untils import restful, cacheuntil from untils.captcha import Captcha from exts import smsapi from .forms import SMSCaptchaForm from io import BytesIO bp = Blueprint('common', __name__, url_prefix='/c') # @bp.route('/sms_captcha/', methods=['post']) # def sms_c...
normal
{ "blob_id": "856beaf3b9dad333d5b48c1be3a8ad917f8d020c", "index": 3634, "step-1": "<mask token>\n\n\n@bp.route('/captcha/')\ndef CaptchaView():\n text, image = Captcha.gene_graph_captcha()\n cacheuntil.set(text.lower(), text.lower())\n out = BytesIO()\n image.save(out, 'png')\n out.seek(0)\n res...
[ 1, 2, 3, 4, 5 ]
#! /usr/bin/env python3 __all__ = [ 'FrameCorners', 'CornerStorage', 'build', 'dump', 'load', 'draw', 'without_short_tracks' ] import click import cv2 import numpy as np import pims from _corners import FrameCorners, CornerStorage, StorageImpl from _corners import dump, load, draw, withou...
normal
{ "blob_id": "0b5fb649dc421187820677ce75f3cd0e804c18a3", "index": 7055, "step-1": "<mask token>\n\n\nclass _CornerStorageBuilder:\n\n def __init__(self, progress_indicator=None):\n self._progress_indicator = progress_indicator\n self._corners = dict()\n\n def set_corners_at_frame(self, frame, ...
[ 10, 12, 14, 15, 17 ]
# Copyright (c) 2019 Jannika Lossner # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, dis...
normal
{ "blob_id": "e30bd33ae18881307e7cf4f60d3c60eae91573bc", "index": 181, "step-1": "<mask token>\n\n\nclass MultiSpeakerBRIR(SimpleFreeFieldHRIR):\n <mask token>\n <mask token>\n <mask token>\n\n def add_metadata(self, database):\n super().add_metadata(database)\n database.Data.Type = 'FIR...
[ 2, 3, 4, 5, 6 ]
import re import cgi import os import urllib import urllib2 from time import sleep from google.appengine.api import taskqueue from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db from google.appengine.api import urlfetch from google.ap...
normal
{ "blob_id": "c8a6a8633f863e0350157346106a747096d26939", "index": 9912, "step-1": "<mask token>\n\n\nclass lexicon0(db.Model):\n word = db.StringProperty(required=True)\n known = db.StringListProperty(indexed=False)\n\n\n<mask token>\n\n\ndef getjp(before, wordlist, after):\n global REQUESTURL\n wordl...
[ 13, 14, 17, 21, 22 ]
import pandas class _RegressionModelTable(object): def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None): if not isinstance(regression_models, list): regression_models = [regression_models] self._check_model_inputs(regression_models, fu...
normal
{ "blob_id": "94264e121bb31a08cbd9766be1ff16173d2838ed", "index": 5331, "step-1": "<mask token>\n\n\nclass _RegressionModelTable(object):\n\n def __init__(self, regression_models, function_to_evaluate_model=None,\n function_to_select_model=None):\n if not isinstance(regression_models, list):\n ...
[ 6, 7, 8, 13, 14 ]
def filter(txt): # can be improved using regular expression output = [] for t in txt: if t == "(" or t == ")" or t == "[" or t == "]": output.append(t) return output result = [] while True: raw_input = input() line = filter(raw_input) if raw_input != ".": stack = [] err = False for l in line: ...
normal
{ "blob_id": "9ca769ae8bbabee20b5dd4d75ab91d3c30e8d1bf", "index": 8387, "step-1": "<mask token>\n", "step-2": "def filter(txt):\n output = []\n for t in txt:\n if t == '(' or t == ')' or t == '[' or t == ']':\n output.append(t)\n return output\n\n\n<mask token>\n", "step-3": "def fi...
[ 0, 1, 2, 3, 4 ]
"""PriceTrail URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class...
normal
{ "blob_id": "06627821c09d02543974a3c90664e84e11c980ed", "index": 7631, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^admin/', admin.site.urls), url('^logout/$', auth_views\n .logout, {'next_page': '/'}, name='logout'), url('^$', index_view, name\n ='index'), url('^login/$', lo...
[ 0, 1, 2, 3 ]
from flask import Flask,Response,render_template,url_for,request,jsonify from flask_bootstrap import Bootstrap import pandas as pd import gpt_2_simple as gpt2 import json app = Flask(__name__) Bootstrap(app) #Main Page @app.route('/') def interactive_input(): return render_template('main.html') #Creating the diff...
normal
{ "blob_id": "1e41cc5d2661f1fb4f3a356318fabcb2b742cbdf", "index": 1826, "step-1": "<mask token>\n\n\n@app.route('/')\ndef interactive_input():\n return render_template('main.html')\n\n\n@app.route('/food_1_star')\ndef food_1_star():\n return render_template('food_1.html')\n\n\n<mask token>\n\n\n@app.route('...
[ 6, 7, 9, 11, 13 ]
#!/usr/bin/env python #coding:utf-8 """ Author: Wusf --<wushifan221@gmail.com> Purpose: Created: 2016/2/29 """ import os,sys,sqlite3 MyQtLibPath = os.path.abspath("D:\\MyQuantLib\\") sys.path.append(MyQtLibPath) import PCA.PCA_For_Stat_Arb2 as pca import pandas as pd import numpy as np import time def Compu...
normal
{ "blob_id": "70cda2d6d3928cd8008daf221cd78665a9b05eea", "index": 7064, "step-1": "#!/usr/bin/env python\n#coding:utf-8\n\"\"\"\n Author: Wusf --<wushifan221@gmail.com>\n Purpose: \n Created: 2016/2/29\n\"\"\"\n\nimport os,sys,sqlite3\nMyQtLibPath = os.path.abspath(\"D:\\\\MyQuantLib\\\\\")\nsys.path.append(M...
[ 0 ]
try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET import data_helpers def write_to_file(file,line): file.write(line+"\n") def cat_map(): catmap={} id=1 f=open("cat") cat=set([s.strip() for s in list(f.readlines())]) for i in cat: catmap[i]=id id=id+1 return c...
normal
{ "blob_id": "04538cc5c9c68582cc9aa2959faae2d7547ab2ee", "index": 302, "step-1": "<mask token>\n\n\ndef write_to_file(file, line):\n file.write(line + '\\n')\n\n\n<mask token>\n", "step-2": "try:\n import xml.etree.cElementTree as ET\nexcept ImportError:\n import xml.etree.ElementTree as ET\n<mask toke...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # ユークリッド距離 # http://en.wikipedia.org/wiki/Euclidean_space # 多次元空間中での 2 点間の距離を探索する def euclidean(p,q): sumSq=0.0 # 差の平方を加算 for i in range(len(p)): sumSq+=(p[i]-q[i])**2 # 平方根 return (sumSq**0.5) #print euclidean([3,4,5],[4,5,6])
normal
{ "blob_id": "11a7ebac3dad1f91a6d46b62f557b51ded8e3d7a", "index": 1271, "step-1": "<mask token>\n", "step-2": "def euclidean(p, q):\n sumSq = 0.0\n for i in range(len(p)):\n sumSq += (p[i] - q[i]) ** 2\n return sumSq ** 0.5\n", "step-3": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# ユーク...
[ 0, 1, 2 ]
import torch class Activation(torch.nn.Module): def __init__(self): super().__init__() self.swish = lambda x: x * torch.sigmoid(x) self.linear = lambda x: x self.sigmoid = lambda x: torch.sigmoid(x) self.neg = lambda x: -x self.sine = lambda x: torch.sin(x) self.params = torch.nn.Parameter(torch.zero...
normal
{ "blob_id": "850310b6c431981a246832e8a6f5417a88587b99", "index": 3151, "step-1": "<mask token>\n\n\nclass ResizableConv2d(torch.nn.Module):\n <mask token>\n\n def forward(self, x):\n y = self.conv(x)\n y = self.conv2(y)\n y = self.resize(y)\n y = y + self.resize(self.residual_co...
[ 10, 11, 12, 14, 16 ]
import numpy as np import scipy.io as sio import os import torch from torchvision.utils import save_image from tools import * def test(config, base, loaders, brief): compute_and_save_features(base, loaders) results = evalutate(config, base, brief) return results def evalutate(config, base, brief=False): re...
normal
{ "blob_id": "b21796a9e10314f80cac3151d1fdbb139966303f", "index": 5555, "step-1": "<mask token>\n\n\ndef test(config, base, loaders, brief):\n compute_and_save_features(base, loaders)\n results = evalutate(config, base, brief)\n return results\n\n\ndef evalutate(config, base, brief=False):\n results =...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from django.db import models from backend.models.account import Account from string import Template out = Template("$account: $parts") class Group(models.Model): name = models.CharField(max_length=100) class GroupParticipation(models.Model): account = models.ForeignKey(Account, r...
normal
{ "blob_id": "11337f6f9cf22ba6fbed68dfcb7a07fb6368e94e", "index": 6350, "step-1": "<mask token>\n\n\nclass GroupParticipation(models.Model):\n account = models.ForeignKey(Account, related_name='groups')\n parts = models.FloatField(default=1.0)\n group = models.ForeignKey(Group, related_name='participants...
[ 3, 4, 6, 7, 8 ]
from collections import defaultdict def k_most_frequent(arr:list, k:int): ''' ''' counts = defaultdict(int) for n in nums: counts[n] += 1 counts = [(k,v) for k,v in counts.items()] ordered = list(reversed(sorted(counts, key=lambda d: d[1]))) return [o[0] for o in ordered[:k]] num...
normal
{ "blob_id": "1298c2abae519a5365cc0d9d406196db987eb219", "index": 5923, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef k_most_frequent(arr: list, k: int):\n \"\"\" \"\"\"\n counts = defaultdict(int)\n for n in nums:\n counts[n] += 1\n counts = [(k, v) for k, v in counts.items()]...
[ 0, 2, 3, 4, 5 ]
from django.conf.urls import patterns, url from riskDashboard2 import views urlpatterns = patterns('', #url(r'getdata', views.vulnData, name='getdata'), url(r'appmanagement', views.appmanagement, name='appmanagement'), url(r'^.*', views.index, name='index'), )
normal
{ "blob_id": "3372d98ff91d90558a87293d4032820b1662d60b", "index": 298, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('appmanagement', views.appmanagement, name=\n 'appmanagement'), url('^.*', views.index, name='index'))\n", "step-3": "from django.conf.urls import patte...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Sat Nov 2 08:04:11 2019 @author: yocoy """ import serial, time arduino = serial.Serial('COM7', 9600) time.sleep(4) lectura = [] for i in range(100): lectura.append(arduino.readline()) arduino.close() print(lectura)
normal
{ "blob_id": "d514413c303dd174d8f56685158780a1681e1aba", "index": 7925, "step-1": "<mask token>\n", "step-2": "<mask token>\ntime.sleep(4)\n<mask token>\nfor i in range(100):\n lectura.append(arduino.readline())\narduino.close()\nprint(lectura)\n", "step-3": "<mask token>\narduino = serial.Serial('COM7', 9...
[ 0, 1, 2, 3, 4 ]
# Copyright (c) 2016, the GPyOpt Authors # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from scipy.special import erfc import time from ..core.errors import InvalidConfigError def compute_integrated_acquisition(acquisition,x): ''' Used to compute the acquisition function when s...
normal
{ "blob_id": "4e7cfbf51ec9bad691d8dd9f103f22728cf5e952", "index": 1229, "step-1": "<mask token>\n\n\ndef compute_integrated_acquisition(acquisition, x):\n \"\"\"\n Used to compute the acquisition function when samples of the hyper-parameters have been generated (used in GP_MCMC model).\n\n :param acquisi...
[ 7, 9, 12, 15, 16 ]
import math def is_prime(n): # Based on the Sieve of Eratosthenes if n == 1: return False if n < 4: # 2 and 3 are prime return True if n % 2 == 0: return False if n < 9: # 5 and 7 are prime (we have already excluded 4, 6 and 8) return True if n %...
normal
{ "blob_id": "3970c7768e892ad217c193b1d967c1203b7e9a25", "index": 6512, "step-1": "<mask token>\n\n\ndef is_prime(n):\n if n == 1:\n return False\n if n < 4:\n return True\n if n % 2 == 0:\n return False\n if n < 9:\n return True\n if n % 3 == 0:\n return False\n ...
[ 1, 2, 3, 4, 5 ]
# coding: utf-8 import re import numpy as np from sklearn.manifold import TSNE import word2vec from matplotlib import pyplot as plt from adjustText import adjust_text import nltk ''' word2vec.word2phrase('all.txt', 'phrases.txt', verbose=True) word2vec.word2vec('phrases.txt', 'text.bin', size=100, verbose=True) word2ve...
normal
{ "blob_id": "31996699bec6507d941eb8a7aaacffbd6248d79c", "index": 7112, "step-1": "<mask token>\n\n\ndef plot_scatter(x, y, texts, adjust=False):\n fig, ax = plt.subplots()\n ax.plot(x, y, 'bo')\n texts = [plt.text(x[i], y[i], texts[i]) for i in range(len(x))]\n if adjust:\n plt.title(str(adjus...
[ 1, 2, 3, 4, 5 ]
#################################################################### # a COM client coded in Python: talk to MS-Word via its COM object # model; uses either dynamic dispatch (run-time lookup/binding), # or the static and faster type-library dispatch if makepy.py has # been run; install the windows win32all extensions...
normal
{ "blob_id": "df19aa720993c2385a6d025cf7ec8f3935ee4191", "index": 9343, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(argv) == 2:\n docdir = argv[1]\n<mask token>\nspot.InsertBefore('Hello COM client world!')\nnewdoc.SaveAs(docdir + 'pycom.doc')\nnewdoc.SaveAs(docdir + 'copy.doc')\nnewdoc.Close...
[ 0, 1, 2, 3, 4 ]
"""Config for a linear regression model evaluated on a diabetes dataset.""" from dbispipeline.evaluators import GridEvaluator import dbispipeline.result_handlers as result_handlers from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from nlp4musa2020.dataloaders.alf200k import ALF200...
normal
{ "blob_id": "473c653da54ebdb7fe8a9eefc166cab167f43357", "index": 3994, "step-1": "<mask token>\n", "step-2": "<mask token>\ndataloader = ALF200KLoader(path='data/processed/dataset-lfm-genres.pickle',\n load_feature_groups=['rhymes', 'statistical', 'statistical_time',\n 'explicitness', 'audio'], text_vect...
[ 0, 1, 2, 3 ]
from abc import ABCMeta, abstractmethod from datetime import datetime from enum import Enum from application.response import ResponseError class ModelBase: __metaclass__ = ABCMeta @classmethod @abstractmethod def _get_cls_schema(cls): pass def __new__(cls, schema): if schema is ...
normal
{ "blob_id": "5917c891d2885f779dc33f189f1a875efbd0c302", "index": 163, "step-1": "<mask token>\n\n\nclass ModelBase:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, schema):\n self.schema = schema\n <mask token>\n\n @property\n def uid(self):\n return self.sc...
[ 6, 8, 9, 12, 13 ]
from django.db import models from django.contrib.auth.models import User # Create your models here. class Post(models.Model): title = models.CharField(max_length=40) content = models.TextField() date_published = models.DateTimeField(auto_now=True) author = models.ForeignKey(User, on_delete=models.CASCA...
normal
{ "blob_id": "1257b90781a213ca8e07f67a33b8e847d0525653", "index": 9354, "step-1": "<mask token>\n\n\nclass Comment(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.user.username\n\n\nclass Comment_to_comment(models.Model):\n u...
[ 7, 10, 11, 12, 13 ]
''' Написати програму, що визначає, яка з двох точок знаходиться ближче до початку координат. ''' import re re_number = re.compile("^[-+]?\d+\.?\d*$") def validator(pattern,promt): text=input(promt) while not bool(pattern.match(text)): text = input(promt) return text def number_validator(promt)...
normal
{ "blob_id": "2d5993489ff3120d980d29edbb53422110a5c039", "index": 3561, "step-1": "<mask token>\n\n\ndef validator(pattern, promt):\n text = input(promt)\n while not bool(pattern.match(text)):\n text = input(promt)\n return text\n\n\ndef number_validator(promt):\n number = float(validator(re_nu...
[ 3, 4, 5, 6, 7 ]
import json import tempfile import zipfile from contextlib import contextmanager from utils import ( codepipeline_lambda_handler, create_zip_file, get_artifact_s3_client, get_cloudformation_template, get_input_artifact_location, get_output_artifact_location, get_session, get_user_parame...
normal
{ "blob_id": "4c59e5fab2469af3f40cafaac226a993f6628290", "index": 3624, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@codepipeline_lambda_handler\ndef lambda_handler(event, context):\n \"\"\"\n Prepares for an AMI deployment.\n\n \"\"\"\n job = event['CodePipeline.job']\n input_bucket...
[ 0, 1, 2, 3, 4 ]
import struct def parse(message): return IGENMessage.from_bytes(message) class IGENMessage(object): def __init__(self): self.serial = None self.temperature = None self.pv1 = 0 self.pv2 = 0 self.pv3 = 0 self.pa1 = 0 self.pa2 = 0 self.pa3 = 0 ...
normal
{ "blob_id": "5df42a024e1edbe5cc977a814efe580db04b8b76", "index": 2386, "step-1": "<mask token>\n\n\nclass IGENMessage(object):\n\n def __init__(self):\n self.serial = None\n self.temperature = None\n self.pv1 = 0\n self.pv2 = 0\n self.pv3 = 0\n self.pa1 = 0\n s...
[ 6, 7, 8, 9, 10 ]
from django.db import models from NavigantAnalyzer.common import convert_datetime_string import json # A custom view-based model for flat outputs - RÖ - 2018-10-24 # Don't add, change or delete fields without editing the view in the Db class Results_flat(models.Model): race_id = models.IntegerField() race_name...
normal
{ "blob_id": "802eb0502c5eddcabd41b2d438bf53a5d6fb2c82", "index": 8368, "step-1": "<mask token>\n\n\nclass Results_flat(models.Model):\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>...
[ 1, 2, 3, 4, 5 ]
import sys sys.path.append("/home/mccann/bin/python/obsolete") from minuit import * execfile("/home/mccann/antithesis/utilities.py") nobeam = getsb("cos") ebeam = getsb("bge") pbeam = getsb("bgp") import gbwkf import gbwkftau runstart = pickle.load(open("/home/mccann/antithesis/old_dotps/runstart.p")) runend = pickle....
normal
{ "blob_id": "51cd74bff5a0883a7bee2b61b152aecb2c5ccc66", "index": 6263, "step-1": "import sys\nsys.path.append(\"/home/mccann/bin/python/obsolete\")\n\nfrom minuit import *\nexecfile(\"/home/mccann/antithesis/utilities.py\")\nnobeam = getsb(\"cos\")\nebeam = getsb(\"bge\")\npbeam = getsb(\"bgp\")\nimport gbwkf\ni...
[ 0 ]
# -*- coding: utf-8 -*- """ Created on Sat Jul 1 10:18:11 2017 @author: Duong """ import pandas as pd import matplotlib.pyplot as plt import psycopg2 from pandas.core.frame import DataFrame # DBS verbinden database = psycopg2.connect(database="TeamYellow_election", user="student", password="pas...
normal
{ "blob_id": "076b852010ddcea69a294f9f2a653bb2fa2f2676", "index": 3531, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(\n 'SELECT tweet_date, COUNT(*) FROM projekt_election.tweet as tweet , projekt_election.hashtag_use as use WHERE tweet.tweet_id = use.tweet_id GROUP BY tweet_date ORDER ...
[ 0, 1, 2, 3, 4 ]
__author__ = 'Administrator' import unittest class CouchTests2(unittest.TestCase): def test_foo(self): self.assertEqual(1, 1) def test_bar(self): self.assertEqual(1, 1)
normal
{ "blob_id": "cd4f22b8e2188e8019e7324e80d64a7b95f8f956", "index": 1961, "step-1": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n <mask token>\n\n def test_bar(self):\n self.assertEqual(1, 1)\n", "step-2": "<mask token>\n\n\nclass CouchTests2(unittest.TestCase):\n\n def test_foo(self)...
[ 2, 3, 4, 5 ]
# KeyLogger.py # show a character key when pressed without using Enter key # hide the Tkinter GUI window, only console shows import Tkinter as tk def key(event): if event.keysym == 'Escape': root.destroy() print event.char, event.keysym root = tk.Tk() print "Press a key (Escape key to exit):" root.bi...
normal
{ "blob_id": "368151a134f987ed78c8048521137672530b5cce", "index": 1022, "step-1": "# KeyLogger.py\n# show a character key when pressed without using Enter key\n# hide the Tkinter GUI window, only console shows\n\nimport Tkinter as tk\n\ndef key(event):\n if event.keysym == 'Escape':\n root.destroy()\n ...
[ 0 ]
import os import pytest from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver import Firefox from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.comm...
normal
{ "blob_id": "b6e28f29edd0c4659ab992b45861c4c31a57e7fd", "index": 8920, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_gecko_driver():\n home_dir = os.getenv('HOME')\n return Firefox(executable_path=os.path.join(home_dir, 'bin', 'geckodriver')\n )\n\n\n@pytest.fixture\ndef driv...
[ 0, 2, 3, 4, 5 ]
a=int(input()) s=0 t=0 while(a!=0): t=a%10 s=s+t a=a//10 print(s)
normal
{ "blob_id": "6050e83e73faaf40cbd5455efd3ad01e4e131188", "index": 2587, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile a != 0:\n t = a % 10\n s = s + t\n a = a // 10\nprint(s)\n", "step-3": "a = int(input())\ns = 0\nt = 0\nwhile a != 0:\n t = a % 10\n s = s + t\n a = a // 10\npri...
[ 0, 1, 2, 3 ]
""" Class for manage tables in Storage and Big Query """ # pylint: disable=invalid-name, too-many-locals, too-many-branches, too-many-arguments,line-too-long,R0801,consider-using-f-string from pathlib import Path import json from copy import deepcopy import textwrap import inspect from io import StringIO from loguru i...
normal
{ "blob_id": "da218e6d9ee311eefb8e9ae4dac5053793eb5514", "index": 9369, "step-1": "<mask token>\n\n\nclass Table(Base):\n <mask token>\n\n def __init__(self, dataset_id, table_id, **kwargs):\n super().__init__(**kwargs)\n self.table_id = table_id.replace('-', '_')\n self.dataset_id = da...
[ 8, 12, 15, 16, 20 ]
class Image: def __init__(self, **kwargs): self.ClientID = kwargs['ClientID'] self.DealerID = kwargs['DealerID'] self.VIN = kwargs['VIN'] self.UrlVdp = None self.PhotoURL = kwargs['PhotoURL'] self.VdpActive = None def __repr__(self): return f"{se...
normal
{ "blob_id": "3dc4e10145ad42c0168fec3462da0f87c1e661a5", "index": 8701, "step-1": "<mask token>\n\n\nclass VehiclePhoto:\n <mask token>\n\n def __repr__(self):\n return f'{self.VehiclePhotoID} {self.VIN} {self.UrlVdp}'\n", "step-2": "class Image:\n <mask token>\n <mask token>\n\n\nclass Vehic...
[ 2, 4, 5, 6, 7 ]
import sys def main(): lines = [line.strip() for line in sys.stdin.readlines()] h = lines.index("") w = len(lines[0].split()[0]) start = 0 grids = set() while start < len(lines): grid = tuple(x.split()[0] for x in lines[start:start + h]) if len(grid) == h: grids.add(grid) start += h + 1 ...
normal
{ "blob_id": "6ef8a174dcce633b526ce7d6fdb6ceb11089b177", "index": 3652, "step-1": "import sys\n\ndef main():\n lines = [line.strip() for line in sys.stdin.readlines()]\n h = lines.index(\"\")\n w = len(lines[0].split()[0])\n start = 0\n grids = set()\n while start < len(lines):\n grid = tuple(x.split()[0...
[ 0 ]
import unittest from unittest.mock import patch from fsqlfly.db_helper import * from fsqlfly.tests.base_test import FSQLFlyTestCase class MyTestCase(FSQLFlyTestCase): def test_positive_delete(self): namespace = Namespace(name='iii') self.session.add(namespace) self.session.commit() ...
normal
{ "blob_id": "abbefb1e426408b32fa9e125c78b572de22dbb8c", "index": 7493, "step-1": "<mask token>\n\n\nclass MyTestCase(FSQLFlyTestCase):\n\n def test_positive_delete(self):\n namespace = Namespace(name='iii')\n self.session.add(namespace)\n self.session.commit()\n t = Transform(name=...
[ 4, 5, 7, 9, 10 ]
################################################################################ # run_experiment.py # # Ian Marci 2017 # # Defines knn classifier and runs 4-fold cross validation on data in ...
normal
{ "blob_id": "dbc599a03d91f369d862f6cc90c31221747ead80", "index": 2811, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n predictions = []\n labels = []\n accuracies = []\n for i in range(4):\n sess.run(init)\n choice = i + 1\n choose_test_set(str...
[ 0, 1, 2, 3, 4 ]
from pet import Pet class Ninja: def __init__(self, first_name, last_name, treats, pet_food, pet): self.first_name = first_name self.last_name = last_name self.treats = treats self.pet_food = pet_food self.pet = pet def walk(self): self.pet.play() def fe...
normal
{ "blob_id": "b210784a198eaa3e57b5a65ec182a746aecc0e2b", "index": 1695, "step-1": "<mask token>\n\n\nclass Ninja:\n\n def __init__(self, first_name, last_name, treats, pet_food, pet):\n self.first_name = first_name\n self.last_name = last_name\n self.treats = treats\n self.pet_food ...
[ 3, 5, 6, 7, 9 ]
#!/usr/bin/python import glob import pandas as pd import numpy as np manifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0]) mailTypes = pd.read_csv('./mail_types.csv', sep=',', names=['typeId','typeName'], skiprows=[0]) #----- mailTypes['typeId'] = pd.to_numeric(mailTypes['ty...
normal
{ "blob_id": "2ea33fd06be888db5cda86b345f535532d2a05b5", "index": 4268, "step-1": "#!/usr/bin/python \n\nimport glob\nimport pandas as pd\nimport numpy as np\n\nmanifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0])\nmailTypes = pd.read_csv('./mail_types.csv', sep=',', name...
[ 0 ]
class Tienda: def __init__(self, nombre_tienda, lista_productos = []): self.nombre_tienda = nombre_tienda self.lista_productos = lista_productos def __str__(self): return f"Nombre de la Tienda: {self.nombre_tienda}\nLista de Productos: {self.lista_productos}\n" def anhadir_prod...
normal
{ "blob_id": "0ae5d20b78bf7c23418de55ffd4d81cd5284c6d5", "index": 8912, "step-1": "class Tienda:\n\n def __init__(self, nombre_tienda, lista_productos=[]):\n self.nombre_tienda = nombre_tienda\n self.lista_productos = lista_productos\n <mask token>\n\n def anhadir_producto(self, producto_nu...
[ 4, 5, 6, 7, 8 ]
from colander_validators import ( email, url) def test_url(): assert url("ixmat.us") == True assert url("http://bleh.net") == True assert type(url("://ixmat.us")) == str assert type(url("ixmat")) == str def test_email(): assert email("barney@purpledino.com") == True assert email("b...
normal
{ "blob_id": "40637c7a5e45d0fe4184478a1be2e08e5040c93b", "index": 8931, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_email():\n assert email('barney@purpledino.com') == True\n assert email('barney.10.WHATDINO@purple.com') == True\n assert type(email('barney')) == str\n assert ty...
[ 0, 1, 2, 3, 4 ]
from .hacker import HackerRegistrationPage from .judge import JudgeRegistrationPage from .mentor import MentorRegistrationPage from .organizer import OrganizerRegistrationPage from .user import UserRegistrationPage
normal
{ "blob_id": "34f3212b0254cbcb5e1ca535a29d4fe820dcaad8", "index": 2978, "step-1": "<mask token>\n", "step-2": "from .hacker import HackerRegistrationPage\nfrom .judge import JudgeRegistrationPage\nfrom .mentor import MentorRegistrationPage\nfrom .organizer import OrganizerRegistrationPage\nfrom .user import Use...
[ 0, 1 ]
from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper from typing import Any, Optional def wrap_oracle_errors() -> None: ... class _UninitializedOperatorsDescriptor: def __get__(self, instance: Any, cls: Optional[Any] = ...): ... class DatabaseWrapper(BaseDatabaseWrapper): vendo...
normal
{ "blob_id": "829b8cd0b648d39c07c20fd1c401bf717ed5b9c4", "index": 9682, "step-1": "<mask token>\n\n\nclass OracleParam:\n force_bytes: Any = ...\n input_size: Any = ...\n\n def __init__(self, param: Any, cursor: Any, strings_only: bool=...) ->None:\n ...\n\n\nclass VariableWrapper:\n var: Any =...
[ 16, 20, 25, 27, 31 ]
class Solution(object): def maxDistToClosest(self, seats): """ :type seats: List[int] :rtype: int """ start = 0 end = 0 length = len(seats) max_distance = 0 for i in range(len(seats)): seat = seats[i] if seat == 1: ...
normal
{ "blob_id": "2b8b502381e35ef8e56bc150114a8a4831782c5a", "index": 3819, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def maxDistToClosest(self, seats):\n \"\"\"\n :type seats: List[int]\n :rtype: int\n ...
[ 0, 1, 2 ]
str = 'Hello world' print ("字符串长度 : %d" %(len(str))) print("字符串的长度 444:",len(str)) print (str) print (str[0]) print (str[1:5]) print (str[:len(str)]) print (str[1:]*3) print (str[1:]*5) print ('字符串拼接') print ("Hello" + "world") #print ("python : str.join Test") str1 = "-" print (str1.join(str)) list = [1,2,3...
normal
{ "blob_id": "77b7a0ae115aa063512ea7d6e91811470a4cf9d0", "index": 2187, "step-1": "\nstr = 'Hello world'\n\nprint (\"字符串长度 : %d\" %(len(str)))\nprint(\"字符串的长度 444:\",len(str))\nprint (str)\nprint (str[0])\nprint (str[1:5])\nprint (str[:len(str)])\nprint (str[1:]*3)\nprint (str[1:]*5)\n\nprint ('字符串拼接')\n\nprint (...
[ 0 ]
import json import requests import itertools import logging from shared_code.config.setting import Settings from TailwindTraderFunc.cognitiveservices import CognitiveServices from shared_code.storage.storage import BlobStorageService class TailwindTraders(): def __init__(self, req): self._settings = Sett...
normal
{ "blob_id": "75ba2448897bed8388a7b8d876827461e1bc9dd7", "index": 2809, "step-1": "<mask token>\n\n\nclass TailwindTraders:\n\n def __init__(self, req):\n self._settings = Settings()\n self._cs = CognitiveServices()\n self._storage = BlobStorageService(self._settings.\n get_stor...
[ 5, 6, 7, 8, 9 ]
# 001. 웹 서버에 요청하고 응답받기 # 학습 내용 : 웹 서버에 접속하여 웹 페이지 정보를 요청하고 서버로부터 응답 객체를 받는 과정을 이해한다. # 힌트 내용 : requests 모듈의 get() 함수에 접속하려는 웹 페이지의 주소(URL)를 입력한다. import requests url = "https://www.python.org/" resp = requests.get(url) print(resp) # 200, 정상 동작 url2 = "https://www.python.org/1" resp2 = requests.get(url2) print(resp2)...
normal
{ "blob_id": "1af73c0ca38ea32119f622dc14741c0bb0aa08fd", "index": 6344, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(resp)\n<mask token>\nprint(resp2)\n", "step-3": "<mask token>\nurl = 'https://www.python.org/'\nresp = requests.get(url)\nprint(resp)\nurl2 = 'https://www.python.org/1'\nresp2 = r...
[ 0, 1, 2, 3, 4 ]