code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
"""added personal collection Revision ID: 43eabda1d630 Revises: 9cad4dfb5125 Create Date: 2018-03-28 13:55:03.557872 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '43eabda1d630' down_revision = '9cad4dfb5125' branch_labels = None depends_on = None def upgra...
normal
{ "blob_id": "21bdf315c98a4cf69482cc7db41bc30d44781596", "index": 816, "step-1": "<mask token>\n\n\ndef upgrade():\n op.add_column('Gifs', sa.Column('personal_collections', sa.Integer(),\n nullable=True))\n op.create_foreign_key(None, 'Gifs', 'PersonalGifCollections', [\n 'personal_collections...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(b) <|reserved_special_token_1|> <|reserved_special_token_0|> a = np.array([1, 2, 3]) b = np.r_[np.repeat(a, 3), np.tile(a, 3)] print(b) <|reserved_special_token_1|> import numpy as np a = np.array([1, 2, 3]) b = np.r_[...
flexible
{ "blob_id": "f39945f35b13c0918c3ef06224bca65ae6166ebc", "index": 5892, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(b)\n", "step-3": "<mask token>\na = np.array([1, 2, 3])\nb = np.r_[np.repeat(a, 3), np.tile(a, 3)]\nprint(b)\n", "step-4": "import numpy as np\na = np.array([1, 2, 3])\nb = np.r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: ant_pos = dict(pickle.load(open(data_prefix + 'ant_dict.pk', 'rb'))) def baselength(ant_ID1, ant_ID2): """ (Convenience function) Return the norm of the baseline between antennae #...
flexible
{ "blob_id": "c455263b82c04fe2c5cc1e614f10a9962795f87e", "index": 4349, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n ant_pos = dict(pickle.load(open(data_prefix + 'ant_dict.pk', 'rb')))\n\n def baselength(ant_ID1, ant_ID2):\n \"\"\"\n (Convenience function)\n Return the...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Game) admin.site.register(Scrap) <|reserved_special_token_1|> from django.contrib import admin from .models import Game, Scrap admin.site.register(Game) admin.site.register(Scrap)
flexible
{ "blob_id": "7e328992392a4ff2b0e23920a8907e38f63fcff0", "index": 7168, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Game)\nadmin.site.register(Scrap)\n", "step-3": "from django.contrib import admin\nfrom .models import Game, Scrap\nadmin.site.register(Game)\nadmin.site.register(Sc...
[ 0, 1, 2 ]
import datetime from flask import Flask, render_template, request import database import database1 import database2 import getYoutubeVideoLinks as getYT import os os.environ["EAI_USERNAME"] = 'pitabi1360@pashter.com' os.environ["EAI_PASSWORD"] = 'Testqwerty1!' from expertai.nlapi.cloud.client import ExpertAiClient cl...
normal
{ "blob_id": "d0f2d47a786b85367f96897e7cd8c2ef8c577e2b", "index": 2961, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\ndef home():\n if request.method == 'POST':\n entry_content = request.form.get('content')\n output = client.specific_resource_analysis(body={'document': {\...
[ 5, 6, 7, 8, 9 ]
from knox.models import AuthToken from rest_framework import generics, permissions, status from rest_framework.response import Response from accounts.serializers import UserSerializer, RegisterSerializer, LoginSerializer, ChangePasswordSerializer # Register API class RegisterAPI(generics.CreateAPIView): permiss...
normal
{ "blob_id": "5d6ec1b23dcbc935fe80dd09a2e967eb7e37a363", "index": 5645, "step-1": "<mask token>\n\n\nclass LoginAPI(generics.GenericAPIView):\n <mask token>\n <mask token>\n\n\nclass ChangePasswordAPI(generics.UpdateAPIView):\n permission_classes = [permissions.IsAuthenticated]\n serializer_class = Ch...
[ 8, 9, 10, 14, 15 ]
import pytest import torch from homura.utils.containers import Map, TensorTuple def test_map(): map = Map(a=1, b=2) map["c"] = 3 for k, v in map.items(): assert map[k] == getattr(map, k) for k in ["update", "keys", "items", "values", "clear", "copy", "get", "pop"]: with pytest.raises...
normal
{ "blob_id": "c70b4ff26abe3d85e41bfc7a32cf6e1ce4c48d07", "index": 6291, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_tensortuple():\n a = torch.randn(3, 3), torch.randn(3, 3)\n t = TensorTuple(a)\n assert t[0].dtype == torch.float32\n assert t.to(torch.int32)[0].dtype == torch.i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def change_brightness(image, max_delta): """brightness an image""" img = tf.image.adjust_brightness(image, max_delta) return img <|reserved_special_token_1|> <|reserved_special_token_0|> import tensorflow as tf ...
flexible
{ "blob_id": "07e068dbc1ba1bcb85121ee49f2f9337cae188ba", "index": 9388, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef change_brightness(image, max_delta):\n \"\"\"brightness an image\"\"\"\n img = tf.image.adjust_brightness(image, max_delta)\n return img\n", "step-3": "<mask token>\nim...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(type(funs)) print(type(funs.add)) print('Result: ', funs.add(10, 20)) print('Result: ', fba.add(10, 20)) print(type(fba)) print(a) print(m.pi) <|reserved_special_token_0|> print(p) print(bps.happy(10, 20)) <|reserved_speci...
flexible
{ "blob_id": "b53b0e6ff14750bbba3c2e5e2ea2fc5bb1abccec", "index": 3135, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(type(funs))\nprint(type(funs.add))\nprint('Result: ', funs.add(10, 20))\nprint('Result: ', fba.add(10, 20))\nprint(type(fba))\nprint(a)\nprint(m.pi)\n<mask token>\nprint(p)\nprint(b...
[ 0, 1, 2, 3, 4 ]
# views which respond to ajax requests from django.contrib import messages from django.conf import settings from django.contrib.auth.models import User from social.models import Like, Post, Comment, Notification from social.notifications import Notify from social.forms import CommentForm from django.http impor...
normal
{ "blob_id": "0b4f070d30642449536118accffa371a89dd3075", "index": 8857, "step-1": "<mask token>\n\n\ndef follow(request):\n action = request.POST.get('action')\n followed_user_id = request.POST.get('followedUserId')\n followed_user = User.objects.get(id=followed_user_id)\n if followed_user == request....
[ 6, 9, 11, 12, 16 ]
#!/usr/bin/env python ########################################################################### # 1) connect to the MQTT broker # 2) subscribe to the available data streams # 3) log to google sheets # 4) notify on critical events on the telegram channel ###############################################################...
normal
{ "blob_id": "0295d6ba962d099e76110c7a0e39748e3163e300", "index": 5541, "step-1": "<mask token>\n\n\ndef getUTC_TIME():\n return datetime.datetime.utcnow()\n\n\ndef pushSample(sample, topic):\n global client\n client.publish(topic, str(sample))\n\n\n<mask token>\n\n\ndef on_connect(client, userdata, flag...
[ 13, 15, 16, 17, 18 ]
from bacalhau.tei_document import TEIDocument import nltk import unittest class TestDocument(unittest.TestCase): def setUp(self): self.filepath = 'tests/corpus/a.xml' self.doc = TEIDocument(self.filepath, nltk.tokenize.regexp. WordPunctTokenizer(), nltk.corpus.stopwords.words('english...
normal
{ "blob_id": "f86d01c4b980ac44dcdb1b0008493e1dbda25971", "index": 4544, "step-1": "<mask token>\n\n\nclass TestDocument(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_get_texts(self):\n texts = self.doc.get_texts()\n self.assertEqual(2, len(texts))\n\n def test_get_term_d...
[ 3, 5, 6, 7 ]
# -*- coding: utf-8 -*- from handlers.base import Base class Home(Base): def start(self): from movuca import DataBase, User from datamodel.article import Article, ContentType, Category from datamodel.ads import Ads self.db = DataBase([User, ContentType, Category, Article, Ads]) ...
normal
{ "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 ]
# Copyright 2020 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """This module implements helpers for GN SDK e2e tests. """ # Note, this is run on bots, which only support python2.7. # Be sure to only use python2.7 feature...
normal
{ "blob_id": "bbb3d27ce8f4c1943ecc7ab542346c9f41cbd30e", "index": 1256, "step-1": "<mask token>\n\n\nclass popen:\n <mask token>\n\n def __init__(self, command):\n self._command = command\n self._process = None\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass popen:...
[ 2, 4, 5, 6, 7 ]
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 ]
from flask import request, Flask import lock, shelve app = Flask(__name__) @app.route("/unlock") def web_unlock(): if not (request.args.get("token") and request.args.get("state")): return "Error" else: with shelve.open("Settings.conf") as settings: if "token" in settings: ...
normal
{ "blob_id": "ee0f90b84df73ae5783ca0b8a52fe6fe9c979f15", "index": 2576, "step-1": "<mask token>\n\n\n@app.route('/unlock')\ndef web_unlock():\n if not (request.args.get('token') and request.args.get('state')):\n return 'Error'\n else:\n with shelve.open('Settings.conf') as settings:\n ...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.0 on 2020-05-04 16:15 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('game_skeleton', '0001_initial'), ('contenttypes', '0002_remove_content_type_name'), ('clas...
normal
{ "blob_id": "a718d82713503c4ce3d94225ff0db04991ad4094", "index": 9744, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
from django.db import models # Create your models here. class Task(models.Model): level = models.PositiveSmallIntegerField() topic = models.CharField(max_length=100) content = models.TextField() correct_answer = models.CharField(max_length=50) class Answer(models.Model): content = models.TextField...
normal
{ "blob_id": "06e01dce7e2342be994569099ed51d1fe28eea1c", "index": 5784, "step-1": "<mask token>\n\n\nclass Answer(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Task(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token...
[ 1, 3, 4, 5, 6 ]
from __future__ import annotations from .base import * # noqa SECRET_KEY = "django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn" DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "puka-test", "USER": "jeff", "PASSWORD": "", "HOST...
normal
{ "blob_id": "2432e2b4da8af284055e7edf6e0bd94b7b293f0b", "index": 8601, "step-1": "<mask token>\n", "step-2": "<mask token>\nSECRET_KEY = (\n 'django-insecure-usp0sg081f=9+_j95j@-k^sfp+9c*!qrwh-m17%=_9^xot#9fn')\nDATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME':\n 'puka-test', 'U...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> numpy.random.seed(2) <|reserved_special_token_0|> plt.scatter(x, y) plt.title('Original dataset') plt.xlabel('Minutes') plt.ylabel('Spent money') plt.show() <|reserved_special_token_0|> plt.scatter(train_x, train_y) plt.title('Tra...
flexible
{ "blob_id": "9fd985e9675514f6c8f3ac5b91962eb744e0e82c", "index": 6514, "step-1": "<mask token>\n", "step-2": "<mask token>\nnumpy.random.seed(2)\n<mask token>\nplt.scatter(x, y)\nplt.title('Original dataset')\nplt.xlabel('Minutes')\nplt.ylabel('Spent money')\nplt.show()\n<mask token>\nplt.scatter(train_x, trai...
[ 0, 1, 2, 3, 4 ]
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 ]
#!/usr/bin/env python3 # # Display all tags in the specified file for neoview. # Author: Andrew Pyatkov <mrbiggfoot@gmail.com> # License: MIT # """ Display all tags in the specified file for neoview. Output: {file_name}\t{tag_address}\t{displayable_tag_info} """ import argparse #import os #import re import subprocess ...
normal
{ "blob_id": "b220cacc2530ca62b5599a9c1894e979bcfd5109", "index": 9633, "step-1": "<mask token>\n\n\ndef displayable_info(tagname, comment):\n cs = comment.split('\\t', 1)\n return ('{}{:<' + str(max_tag_len) + '}{} {}|{}{}{}|{} {}{}{}').format(\n COLOR_TAGNAME, tagname, COLOR_RESET, COLOR_BAR, COLOR...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """ Created on Sat Jul 18 20:24:53 2020 @author: filip """ import re texto = "Muito além, nos confins inexplorados da região mais brega da Borda Ocidental desta Galáxia, há um pequeno sol amarelo e esquecido. Girando em torno deste sol, a uma distancia de cerca de 148 milhões de quil...
normal
{ "blob_id": "e207063eb3eb1929e0e24b62e6b77a8924a80489", "index": 1001, "step-1": "<mask token>\n\n\ndef separa_sentencas(texto):\n \"\"\"A funcao recebe um texto e devolve uma lista das sentencas dentro do texto\"\"\"\n sentencas = re.split('[.!?]+', texto)\n if sentencas[-1] == '':\n del sentenc...
[ 6, 17, 19, 22, 23 ]
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import numpy as np import pandas as pd import lightgbm as lgb from typing import List, Text, Tuple, Union from ...model.base import ModelFT from ...data.dataset import DatasetH from ...data.dataset.handler import DataHandlerLP from ...model.inter...
normal
{ "blob_id": "d37187f067ddff94015e639a1759dddced817945", "index": 6205, "step-1": "<mask token>\n\n\nclass LGBModel(ModelFT, LightGBMFInt):\n <mask token>\n\n def __init__(self, loss='mse', early_stopping_rounds=50,\n num_boost_round=1000, **kwargs):\n if loss not in {'mse', 'binary'}:\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.skincare, name='skin'), path('productSearch/', views.productSearch, name='productSearch'), path('detail/', views. detail, name='detail')] <|reserved_special_token_1|> from django.contrib im...
flexible
{ "blob_id": "c31c59d172b2b23ca4676be0690603f33b56f557", "index": 4867, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.skincare, name='skin'), path('productSearch/',\n views.productSearch, name='productSearch'), path('detail/', views.\n detail, name='detail')]\n", "st...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MyTestCase(FSQLFlyTestCase): def test_positive_delete(self): namespace = Namespace(name='iii') self.session.add(namespace) self.session.commit() t = Transform(name='test', sql='select 1;', namespace=namespace) self.session.add(t) ...
flexible
{ "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 ]
<|reserved_special_token_0|> class Bottleneck(nn.Module): expansion = 4 def __init__(self, in_planes, planes, stride=1): super(Bottleneck, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = nn.Co...
flexible
{ "blob_id": "d3f42f329246164cdb6113df3da0eb2d3203b2a9", "index": 7114, "step-1": "<mask token>\n\n\nclass Bottleneck(nn.Module):\n expansion = 4\n\n def __init__(self, in_planes, planes, stride=1):\n super(Bottleneck, self).__init__()\n self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1,...
[ 13, 15, 18, 22, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "671a7ee3fabee6ed8dfafe1bddefb1f94322b0e5", "index": 2477, "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 = [('articles', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> RABBITMQ_IP = '172.23.105.82' OBJECT_CACHE_IP = '172.23.105.69' OBJECT_CACHE_PORT = '11911' SERIESLY_IP = '' COUCHBASE_IP = '172.23.105.54' COUCHBASE_PORT = '8091' COUCHBASE_USER = 'Administrator' COUCHBASE_PWD = 'password' SSH_USER = 'root' SSH_PASSWORD = 'p...
flexible
{ "blob_id": "e70ebd9bb9cd7027772ec117cb91349afba7ab10", "index": 6390, "step-1": "<mask token>\n", "step-2": "RABBITMQ_IP = '172.23.105.82'\nOBJECT_CACHE_IP = '172.23.105.69'\nOBJECT_CACHE_PORT = '11911'\nSERIESLY_IP = ''\nCOUCHBASE_IP = '172.23.105.54'\nCOUCHBASE_PORT = '8091'\nCOUCHBASE_USER = 'Administrator...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class HTTPMethodView: <|reserved_special_token_0|> <|reserved_special_token_0|> def dispatch_request(self, request, *args, **kwargs): handler = getattr(self, request.method.lower(), None) if handler: return handler(request, *args, **kwargs) ...
flexible
{ "blob_id": "4948fd2062bdbd32bfa32d2b0e24587f0872132d", "index": 4686, "step-1": "<mask token>\n\n\nclass HTTPMethodView:\n <mask token>\n <mask token>\n\n def dispatch_request(self, request, *args, **kwargs):\n handler = getattr(self, request.method.lower(), None)\n if handler:\n ...
[ 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def fonct(valeur, a=None): if type(a) is list: a.append(valeur) elif type(a) is tuple: a += tuple((valeur,)) elif type(a) is str: a += str(valeur) elif type(a) is set: a.add(valeur) else: a += valeur...
flexible
{ "blob_id": "2a13fffa105a5dd546c30c892e59888eb6ead996", "index": 4645, "step-1": "<mask token>\n", "step-2": "def fonct(valeur, a=None):\n if type(a) is list:\n a.append(valeur)\n elif type(a) is tuple:\n a += tuple((valeur,))\n elif type(a) is str:\n a += str(valeur)\n elif ty...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if current_abpath[-12:] == 'library.zip/': current_abpath = current_abpath[:-12] <|reserved_special_token_0|> def get_item_colors(): """ >>> get_item_colors() """ result = [] if not PICKITEMSP: re...
flexible
{ "blob_id": "927b42326ad62f5e484fd7016c42a44b93609f83", "index": 1296, "step-1": "<mask token>\n", "step-2": "<mask token>\nif current_abpath[-12:] == 'library.zip/':\n current_abpath = current_abpath[:-12]\n<mask token>\n\n\ndef get_item_colors():\n \"\"\"\n >>> get_item_colors()\n \"\"\"\n res...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if search_match_object: print(search_match_object.span()) print(search_match_object.start()) print(search_match_object.end()) print(search_match_object.group()) print(search_pattern.findall(text)) print(search_patt...
flexible
{ "blob_id": "ef5d235f09eea827b240290218c397f880f1046d", "index": 4433, "step-1": "<mask token>\n", "step-2": "<mask token>\nif search_match_object:\n print(search_match_object.span())\n print(search_match_object.start())\n print(search_match_object.end())\n print(search_match_object.group())\nprint...
[ 0, 1, 2, 3, 4 ]
default_app_config = "assistant.additionalpage.apps.AdditionalPageAppConfig"
normal
{ "blob_id": "0e2c71ab4f194af3c2ee65c2cbd6f36921eb587e", "index": 2079, "step-1": "<mask token>\n", "step-2": "default_app_config = 'assistant.additionalpage.apps.AdditionalPageAppConfig'\n", "step-3": "default_app_config = \"assistant.additionalpage.apps.AdditionalPageAppConfig\"\n", "step-4": null, "ste...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(int(input())): b.append(A > set(map(int, input().split()))) print(all(b)) <|reserved_special_token_1|> A = set(map(int, input().split())) b = [] for _ in range(int(input())): b.append(A > set(map(int, inp...
flexible
{ "blob_id": "a9eb2b3f26396918c792de3f126e51bde334b709", "index": 7777, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(int(input())):\n b.append(A > set(map(int, input().split())))\nprint(all(b))\n", "step-3": "A = set(map(int, input().split()))\nb = []\nfor _ in range(int(input())):\n...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Fri Jul 19 13:42:09 2019 @author: Administrator """ from config.path_config import * import GV def ReadTxtName(rootdir): #读取文件中的每一行,转为list lines = [] with open(rootdir, 'r') as file_to_read: while True: line = file_to_read.read...
normal
{ "blob_id": "92bbccfbfebf905965c9cb0f1a85ffaa7d0cf6b5", "index": 3796, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef project_query_lz_main(question):\n txt_line = ReadTxtName(PROJECT_NAMES)\n for project_name in txt_line:\n if project_name in question:\n GV.SHOW = True\n ...
[ 0, 1, 2, 3, 4 ]
import unittest from datetime import datetime from models import * class Test_PlaceModel(unittest.TestCase): """ Test the place model class """ def setUp(self): self.model = Place() self.model.save() def test_var_initialization(self): self.assertTrue(hasattr(self.model, "...
normal
{ "blob_id": "c7881c0d06600a43bdc01f5e464127c596db6713", "index": 7993, "step-1": "<mask token>\n\n\nclass Test_PlaceModel(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_var_initialization(self):\n self.assertTrue(hasattr(self.model, 'city_id'))\n self.assertTrue(hasattr(sel...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def thresholding(img): imgHSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lowerWhite = np.array([80, 0, 0]) upperWhite = np.array([255, 160, 255]) maskWhite = cv2.inRange(imgHSV, lowerWhite, upperWhite) return maskWhite <|reserved_special_token_0|> def nothing(a): p...
flexible
{ "blob_id": "44175d2559f9c7d6171b6e45d24719d50dc80fb7", "index": 7221, "step-1": "<mask token>\n\n\ndef thresholding(img):\n imgHSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)\n lowerWhite = np.array([80, 0, 0])\n upperWhite = np.array([255, 160, 255])\n maskWhite = cv2.inRange(imgHSV, lowerWhite, upperWh...
[ 4, 7, 8, 9, 10 ]
from django.urls import path,include from .import views urlpatterns = [ path('',views.home,name='home'), path('category/',include('api.category.urls')), path('product/',include('api.product.urls')), path('user/',include('api.user.urls')), path('order/',include('api.order.urls')), path('payment...
normal
{ "blob_id": "fe12f6d3408ab115c5c440c5b45a9014cfee6539", "index": 564, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home, name='home'), path('category/', include\n ('api.category.urls')), path('product/', include('api.product.urls')),\n path('user/', include('api.user...
[ 0, 1, 2, 3 ]
# -*- coding:utf-8 -*- #随机森林调参 #RandomizedSearchCV 随机最佳 #GridSearchCV 地毯式最佳 import pandas as pd features = pd.read_csv('data/temps_extended.csv') features = pd.get_dummies(features) labels = features['actual'] features = features.drop('actual', axis = 1) feature_list = list(features.columns) import numpy as np...
normal
{ "blob_id": "de4e14a4fa8520c1aae60805084224337dd9620c", "index": 9009, "step-1": "<mask token>\n\n\ndef evaluate(model, test_features, test_labels):\n predictions = model.predict(test_features)\n errors = abs(predictions - test_labels)\n mape = 100 * np.mean(errors / test_labels)\n accuracy = 100 - m...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def numIdenticalPairs(self, nums: List[int]) ->int: count = 0 inputLength = len(nums) for i in range(0, inputLength): for...
flexible
{ "blob_id": "d7570bbea1e8c7674d507f8e86ce04d22058b21b", "index": 7595, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def numIdenticalPairs(self, nums: List[int]) ->int:\n count = 0\n inputLength = len(nums)\n for i in range...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PhysicianRobot(Robot): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Robot: def __init__(self, name): self.name = name def say_hi(self): print("Hi, I'm from class Robot") print('Hi, Ich bin ' +...
flexible
{ "blob_id": "6b24c438ca7bb4c37ae356c18c562831767f0569", "index": 9961, "step-1": "<mask token>\n\n\nclass PhysicianRobot(Robot):\n <mask token>\n\n\n<mask token>\n", "step-2": "class Robot:\n\n def __init__(self, name):\n self.name = name\n\n def say_hi(self):\n print(\"Hi, I'm from clas...
[ 1, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def t_tm_tM__a__g(db, anno): cmd = ( "\nSELECT data, t, tmin, tmax\nFROM Giornaliero\nWHERE strftime('%Y') = '{}'\n " .format(anno)) dati = db.cur.execute(cmd).fetchall() ldate = [] lt = [] ...
flexible
{ "blob_id": "26b0a762b8eb30f0ef3c5a914f032c2a7d24f750", "index": 5606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef t_tm_tM__a__g(db, anno):\n cmd = (\n \"\\nSELECT data, t, tmin, tmax\\nFROM Giornaliero\\nWHERE strftime('%Y') = '{}'\\n \"\n .format(anno))\n dati = db.cur...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def normalize(f, lammatize=False): f = [x.lower() for x in f] f = [x.replace('\\n', ' ') for x in f] f = [x.replace('\\t', ' ') for x in f] f = [x.replace('\\xa0', ' ') for x in f] f = [x.replace('\\xc2', ' ') for x in f] f = [x.replace(' u ', ' you ') for x in f] ...
flexible
{ "blob_id": "91eb0ae8e59f24aeefdabd46546bc8fb7a0b6f6c", "index": 3833, "step-1": "<mask token>\n\n\ndef normalize(f, lammatize=False):\n f = [x.lower() for x in f]\n f = [x.replace('\\\\n', ' ') for x in f]\n f = [x.replace('\\\\t', ' ') for x in f]\n f = [x.replace('\\\\xa0', ' ') for x in f]\n f...
[ 7, 8, 9, 10, 12 ]
from zeus import auth, factories from zeus.constants import Result, Status from zeus.models import FailureReason from zeus.tasks import aggregate_build_stats_for_job def test_unfinished_job(mocker, db_session, default_source): auth.set_current_tenant(auth.Tenant(repository_ids=[default_source. repository_...
normal
{ "blob_id": "71b78b1347456420c3fc29605887d20ba5bff06e", "index": 4313, "step-1": "<mask token>\n\n\ndef test_unfinished_job(mocker, db_session, default_source):\n auth.set_current_tenant(auth.Tenant(repository_ids=[default_source.\n repository_id]))\n build = factories.BuildFactory(source=default_so...
[ 1, 2, 3, 4 ]
import pandas as pd; import time; import matplotlib.pyplot as plt; import matplotlib.cm as cm import matplotlib.patches as mpatch; import numpy as np; import sys; sys.path.append("/uufs/chpc.utah.edu/common/home/u0403692/prog/prism/test") import bettersankey as bsk; datapath = "/uufs/chpc.utah.edu/common/home/u04036...
normal
{ "blob_id": "07b6ded9b4841bdba62d481664a399f0b125fcbf", "index": 7876, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('/uufs/chpc.utah.edu/common/home/u0403692/prog/prism/test')\n<mask token>\nprint('reading...')\n<mask token>\nprint('joining...')\n<mask token>\nprint('processing...')\n<m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def map_density(ax, syst, psi_sqrd, colormap='Reds'): kwant.plotter.map(syst, psi_sqrd, ax=ax, fig_size=(7, 3), cmap=colormap, vmax=0.99 * max(psi_sqrd)) tools.edit_axis(ax, 'dens') return 0 def density_in_line(syst, states, Op=np.eye(6)): y_stack = [] def l...
flexible
{ "blob_id": "a012055d11202c68d9eddf5cf2a17043f9bbaf0a", "index": 6851, "step-1": "<mask token>\n\n\ndef map_density(ax, syst, psi_sqrd, colormap='Reds'):\n kwant.plotter.map(syst, psi_sqrd, ax=ax, fig_size=(7, 3), cmap=colormap,\n vmax=0.99 * max(psi_sqrd))\n tools.edit_axis(ax, 'dens')\n return ...
[ 4, 5, 7, 8, 9 ]
import os, sys import math import argparse import shutil import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import KFold from keras.models import Sequential from keras.layers import Dense, Dropout, Loc...
normal
{ "blob_id": "ed35a9bc3dd267c9a5fe76ccbb1b4ac5261fc3c8", "index": 1993, "step-1": "<mask token>\n\n\ndef get_model(num_feat=294, lr=0.001, drop_out=0.1, layer_dims=''):\n model = Sequential()\n act_fn = 'relu'\n if len(layer_dims) == 0:\n layer_dims = [10, 5, 0.2]\n else:\n layer_dims = ...
[ 1, 3, 4, 5, 6 ]
"""A utility for outputting graphs as pickle files. To test, run ``openbiolink generate --no-download --no-input --output-format pickle --qual hq``. """ import os import pickle from typing import Mapping from openbiolink.edge import Edge from openbiolink.graph_creation.graph_writer.base import GraphWriter __all__ =...
normal
{ "blob_id": "58d069f6700149793c3446bdd4677f08eaf301ee", "index": 670, "step-1": "<mask token>\n\n\nclass GraphPickleWriter(GraphWriter):\n <mask token>\n\n def write(self, *, tp_nodes, tp_edges: Mapping[str, Edge],\n tp_namespaces, tn_nodes, tn_edges, tn_namespaces):\n \"\"\"Write the graph a...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 2.1.7 on 2019-03-24 07:08 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('adminsite', '0005_auto_20190324_0706'), ] operations = [ migrations.RenameField( model_name='district', old_name='District',...
normal
{ "blob_id": "6e56c7792d88385cc28c48a7d6dd32b9d6917c64", "index": 2913, "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 = [('adminsite',...
[ 0, 1, 2, 3, 4 ]
import datetime, time, threading, os from . import queues logLevels = ["none", "info", "debug"] level = "none" def write(message): queues.logger_queue.put(message) def runLogger(): while True: # The log path should be read from config. Pass into logger? log_path = "/home/pi/Desktop/Projects/r...
normal
{ "blob_id": "91188b55b0f5d8277812d82711f5bcde82819b30", "index": 9563, "step-1": "<mask token>\n\n\ndef runLogger():\n while True:\n log_path = '/home/pi/Desktop/Projects/rose/robot_code/logs/'\n try:\n os.makedirs(log_path)\n except FileExistsError:\n pass\n ...
[ 3, 4, 5, 6, 7 ]
import numpy as np import tensorflow as tf K_model = tf.keras.models.load_model('K_model.h5') K_model.summary() features, labels = [], [] # k_file = open('dataset_20200409.tab') k_file = open('ts.tab') for line in k_file.readlines(): line = line.rstrip() contents = line.split("\t") label = contents.pop()...
normal
{ "blob_id": "1c2a862f995869e3241dd835edb69399141bfb64", "index": 8926, "step-1": "<mask token>\n", "step-2": "<mask token>\nK_model.summary()\n<mask token>\nfor line in k_file.readlines():\n line = line.rstrip()\n contents = line.split('\\t')\n label = contents.pop()\n labels.append([float(label)])...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import requests import Queue import codecs import os import urllib import base64 from threading import Thread from Crypto.Cipher import AES requests.packages.urllib3.disable_warnings() def check(q): while True: try: c = q.get() user = c.split(':')[0] ...
normal
{ "blob_id": "b8ab6b8c111876d6a781c82438f79307a849c47a", "index": 1353, "step-1": "# -*- coding: utf-8 -*-\nimport requests\nimport Queue\nimport codecs\nimport os\nimport urllib\nimport base64\nfrom threading import Thread\nfrom Crypto.Cipher import AES\n\nrequests.packages.urllib3.disable_warnings()\n\n\ndef ch...
[ 0 ]
#! /usr/bin/python # # convert the swig -debug-lsymbols output text file format into # a simple list of lua module names and classes # # Dan Wilcox <danomatika@gmail.com> 2017 # import sys import re if len(sys.argv) < 2: print("USAGE: lua_syntax.py MODULENAME INFILE") exit(0) module = sys.argv[1] infile = sys...
normal
{ "blob_id": "c712875273f988a3aa6dab61f79e99a077823060", "index": 807, "step-1": "<mask token>\n\n\ndef matches(needle, haystack):\n for straw in haystack:\n if needle == straw:\n return True\n return False\n\n\ndef appendSection(section):\n if len(section) < 2:\n return\n if ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class RosEnvImg(RosEnvAbs): <|reserved_special_token_0|> <|reserved_special_token_0|> def get_observation_(self): """ Function returns state that will be fed to the rl-agent It includes the laserscan and the waypoint information stored in an im...
flexible
{ "blob_id": "1a979933eb02e9d12dc034021448cbade59abc48", "index": 2585, "step-1": "<mask token>\n\n\nclass RosEnvImg(RosEnvAbs):\n <mask token>\n <mask token>\n\n def get_observation_(self):\n \"\"\"\n Function returns state that will be fed to the rl-agent\n It includes\n the...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('contract_abi.json') as f: info_json = json.load(f) <|reserved_special_token_0|> print(abi) print(myfilter) <|reserved_special_token_1|> <|reserved_special_token_0|> with open('contract_abi.json') as f: info_j...
flexible
{ "blob_id": "8921c0a17e90f7113d1e0be630a15fc9d74d1780", "index": 8519, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('contract_abi.json') as f:\n info_json = json.load(f)\n<mask token>\nprint(abi)\nprint(myfilter)\n", "step-3": "<mask token>\nwith open('contract_abi.json') as f:\n info...
[ 0, 1, 2, 3, 4 ]
import asyncio from . import edit_or_reply, udy plugin_category = "utils" @udy.cod_cmd( pattern="as$", command=("as", plugin_category), info={ "header": "salam.", "usage": "{tr}as", }, ) async def _(event): "animation command" event = await edit_or_reply(event, "as") awai...
normal
{ "blob_id": "a78bbb85f4912e5f7ea23f689de65cb16a38d814", "index": 9787, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@udy.cod_cmd(pattern='as$', command=('as', plugin_category), info={'header':\n 'salam.', 'usage': '{tr}as'})\nasync def _(event):\n \"\"\"animation command\"\"\"\n event = aw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(n): if n % 2 == 0: sum = 0 for x in range(2, n + 1, 2): sum += 1 / x print(sum) if n % 2 != 0: sum = 0 for x in range(1, n + 1, 2): sum += 1 / x ...
flexible
{ "blob_id": "69cf28d32e6543271a0855d61a76808b03c06891", "index": 4805, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f(n):\n if n % 2 == 0:\n sum = 0\n for x in range(2, n + 1, 2):\n sum += 1 / x\n print(sum)\n if n % 2 != 0:\n sum = 0\n for x ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(s + 2 - s % 2) <|reserved_special_token_1|> s = int(input()) print(s + 2 - s % 2) <|reserved_special_token_1|> s=int(input()) print(s+2-(s%2))
flexible
{ "blob_id": "0412369f89842e2f55aa115e63f46a1b71a0f322", "index": 2685, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s + 2 - s % 2)\n", "step-3": "s = int(input())\nprint(s + 2 - s % 2)\n", "step-4": "s=int(input())\nprint(s+2-(s%2))", "step-5": null, "step-ids": [ 0, 1, 2, ...
[ 0, 1, 2, 3 ]
if __name__ == '__main__': import sys import os.path srcpath = sys.argv[1] if len(sys.argv) >= 1 else './' verfn = sys.argv[2] if len(sys.argv) >= 2 else None try : with open(os.path.join(srcpath,'.svn/entries'),'r') as fp: x = fp.read().s...
normal
{ "blob_id": "1ebf92cf40053e561b04a666eb1dd36f54999e2c", "index": 7324, "step-1": "\r\n\r\n\r\nif __name__ == '__main__':\r\n \r\n import sys\r\n import os.path\r\n \r\n srcpath = sys.argv[1] if len(sys.argv) >= 1 else './'\r\n verfn = sys.argv[2] if len(sys.argv) >= 2 else None\r\n \r\n t...
[ 0 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-08-26 21:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('exchange', '0004_auto_20170826_2120'), ] operations = [ migrations.AlterMod...
normal
{ "blob_id": "264896da4d92797b9f31e28c19a2e315efff815a", "index": 138, "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 = [('exchange', '...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from trips.models import Post admin.site.register(Post)
normal
{ "blob_id": "a8197a4f0bb84e734696bf43fa976c76732d75b8", "index": 9863, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Post)\n", "step-3": "from django.contrib import admin\nfrom trips.models import Post\nadmin.site.register(Post)\n", "step-4": null, "step-5": null, "step-ids":...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def _format_addr(s): name, addr = parseaddr(s) return formataddr((Header(name, 'UTF-8').encode(), addr)) <|reserved_special_token_0|> server.set_debuglevel(1) server.login() server.sendmail(from_addr, [to_addr], msg.as...
flexible
{ "blob_id": "4dd71d01e499f3d0ee49d3bf5204fb3bbb03ede5", "index": 2976, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef _format_addr(s):\n name, addr = parseaddr(s)\n return formataddr((Header(name, 'UTF-8').encode(), addr))\n\n\n<mask token>\nserver.set_debuglevel(1)\nserver.login()\nserver....
[ 0, 2, 3, 4 ]
from simple_avk.AVK import SimpleAVK from simple_avk.exceptions import MethodError, LongpollError
normal
{ "blob_id": "2bccfba2448059a41185b117b224813e344b50f8", "index": 5673, "step-1": "<mask token>\n", "step-2": "from simple_avk.AVK import SimpleAVK\nfrom simple_avk.exceptions import MethodError, LongpollError\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class FssFuzzHash: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FssFuzzHash: @staticmethod def insert_node(agent_id, data): return FssFuzzHashDao.insert_node(agent_id, data) <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "398f9f52b83ffddfb452abbeaad2e83610580fee", "index": 9763, "step-1": "<mask token>\n\n\nclass FssFuzzHash:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FssFuzzHash:\n\n @staticmethod\n def insert_node(agent_id, data):\n return FssFuzzHashDao.insert_node(agent_id, data)\n", ...
[ 1, 2, 3, 4, 5 ]
sentence = "Practice Problems to Drill List Comprehension in Your Head." sentence = sentence.split() sentence = [i.replace(".", "") for i in sentence] [print(i) for i in sentence if len(i)<5]
normal
{ "blob_id": "c0e349be45cd964e8e398baaed64eae792189dd1", "index": 5723, "step-1": "<mask token>\n", "step-2": "<mask token>\n[print(i) for i in sentence if len(i) < 5]\n", "step-3": "sentence = 'Practice Problems to Drill List Comprehension in Your Head.'\nsentence = sentence.split()\nsentence = [i.replace('....
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
normal
{ "blob_id": "ab5400f4b44a53cb5cc2f6394bcdb8f55fd218f0", "index": 1813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
class Solution: def jump(self, nums: List[int]) ->int: l = len(nums) jump = 0 curEnd = 0 curFarthest = 0 for i in range(l - 1): curFarthest = max(curFarthest, i + nums[i]) if i == curEnd: jump += 1 curEnd = curFarthest ...
normal
{ "blob_id": "763d448bc447b88d5f2de777a475a1dd50906527", "index": 7491, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def jump(self, nums: List[int]) ->int:\n l = len(nums)\n jump = 0\n curEnd = 0\n curFarthest = 0\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def config_from_env(config): username = os.getenv('OSF_USERNAME') if username is not None: config['username'] = username project = os.getenv('OSF_PROJECT') if project is not None: config['project'] = project return config def _get_username(args, confi...
flexible
{ "blob_id": "ca551d8e55ebb15a03077af5695782c6d72ff2fd", "index": 8091, "step-1": "<mask token>\n\n\ndef config_from_env(config):\n username = os.getenv('OSF_USERNAME')\n if username is not None:\n config['username'] = username\n project = os.getenv('OSF_PROJECT')\n if project is not None:\n ...
[ 7, 9, 10, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: st...
flexible
{ "blob_id": "a4f932a8566afe0265dc1057d0f6534a608697f7", "index": 365, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution(object):\n\n def isAnagram(self, s, t):\n \"\"\"\n :type s: str\n :t...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @print_run_time def dbscan(train_x, train_y): db = cluster.DBSCAN(eps=0.2, min_samples=3) db.fit(train_x) fmi = metrics.fowlkes_mallows_score(train_y, db.labels_) return fmi <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def s...
flexible
{ "blob_id": "aaebd9eba8a5c51c64baaf60224720b87a6364e1", "index": 1388, "step-1": "<mask token>\n\n\n@print_run_time\ndef dbscan(train_x, train_y):\n db = cluster.DBSCAN(eps=0.2, min_samples=3)\n db.fit(train_x)\n fmi = metrics.fowlkes_mallows_score(train_y, db.labels_)\n return fmi\n\n\n<mask token>\...
[ 1, 7, 8, 9, 10 ]
from slacker import Slacker import vk_api import time import logging from settings import SLACK_TOKEN, VK_LOGIN, VK_PASSWORD, GROUP_ID, TOPIC_ID, ICON_URL slack = Slacker(SLACK_TOKEN) class Vts: def __init__(self): self.last_comment_id = 0 self.vk = None def update_vk(self): if s...
normal
{ "blob_id": "885e02cbf78412d77bd17eba64a8a1a52aaed0df", "index": 5837, "step-1": "<mask token>\n\n\nclass Vts:\n\n def __init__(self):\n self.last_comment_id = 0\n self.vk = None\n\n def update_vk(self):\n if self.vk is not None:\n return\n vk_session = vk_api.VkApi(V...
[ 7, 8, 9, 10, 11 ]
# Generated by Django 3.0.5 on 2020-04-30 06:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('products_app', '0003_auto_20200429_0739'), ] operations = [ migrations.CreateModel( name='User'...
normal
{ "blob_id": "cdc8c8aba384b7b1b5e741ffe4309eaee30aaada", "index": 5405, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('products_ap...
[ 0, 1, 2, 3, 4 ]
from collections import deque s = list(input().upper()) new = list(set(s)) # 중복 제거 한 알파벳 리스트로 카운트 해줘야 시간초과 안남 n = {} for i in new: n[i] = s.count(i) cnt = deque() for k, v in n.items(): cnt.append(v) if cnt.count(max(cnt)) >1: print('?') else: print(max(n, key=n.get))
normal
{ "blob_id": "5dcb20f52b5041d5f9ea028b383e0f2f10104af9", "index": 9486, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in new:\n n[i] = s.count(i)\n<mask token>\nfor k, v in n.items():\n cnt.append(v)\nif cnt.count(max(cnt)) > 1:\n print('?')\nelse:\n print(max(n, key=n.get))\n", "step...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BaseTask(object): <|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|> ...
flexible
{ "blob_id": "cc23eeed44ff66d68c700163cca8b9f4986d497d", "index": 7681, "step-1": "<mask token>\n\n\nclass BaseTask(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mas...
[ 14, 17, 18, 20, 26 ]
from django.core import serializers from django.db import models from uuid import uuid4 from django.utils import timezone from django.contrib.auth.models import User class Message(models.Model): uuid=models.CharField(max_length=50) user=models.CharField(max_length=20) message=models.CharField(max_length=20...
normal
{ "blob_id": "1476d4f488e6c55234a34dc5b6182e3b8ad4f702", "index": 6201, "step-1": "<mask token>\n\n\nclass Message(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Message(models.Mo...
[ 1, 4, 5, 6, 7 ]
def slices(series, length): if length <= 0: raise ValueError("Length has to be at least 1") elif length > len(series) or len(series) == 0: raise ValueError("Length has to be larger than len of series") elif length == len(series): return [series] else: result = [] ...
normal
{ "blob_id": "207bb7c79de069ad5d980d18cdfc5c4ab86c5197", "index": 6544, "step-1": "<mask token>\n", "step-2": "def slices(series, length):\n if length <= 0:\n raise ValueError('Length has to be at least 1')\n elif length > len(series) or len(series) == 0:\n raise ValueError('Length has to be...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @pulumi.output_type class ApplicationCredential(dict): <|reserved_special_token_0|> def __getitem__(self, key: str) ->Any: ApplicationCredential.__key_warning(key) return super().__getitem__(key) <|reserved_special_token_0|> def __init__(__self__, *, cred...
flexible
{ "blob_id": "8535020e7157699310b3412fe6c5a28ee8e61f49", "index": 6911, "step-1": "<mask token>\n\n\n@pulumi.output_type\nclass ApplicationCredential(dict):\n <mask token>\n\n def __getitem__(self, key: str) ->Any:\n ApplicationCredential.__key_warning(key)\n return super().__getitem__(key)\n ...
[ 10, 11, 12, 13, 16 ]
#Q7. Write a program to calculate the sum of digits of a given number. n=int(input("Enter a number:\n")) sum=0 while(n>0): r=n%10 sum=sum+r n=n//10 print("The total sum of digits is:",sum)
normal
{ "blob_id": "78e3750a1bbe9f2f6680937729c1a810bd29fd4d", "index": 4232, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile n > 0:\n r = n % 10\n sum = sum + r\n n = n // 10\nprint('The total sum of digits is:', sum)\n", "step-3": "n = int(input('Enter a number:\\n'))\nsum = 0\nwhile n > 0:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def symetrisch(x, y): """ bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind :param x: ein Element der Liste :param y: ein Element der Liste :return: True- wenn x und y symetrisch Fal...
flexible
{ "blob_id": "2c6dc4d55f64d7c3c01b3f504a72904451cb4610", "index": 6532, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef symetrisch(x, y):\n \"\"\"\n bestimmt weder zwei zweistellige Zahlen x und y symetrisch sind\n :param x: ein Element der Liste\n :param y: ein Element der Liste\n :...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PyHookableTests(PyHookableMixin, unittest.TestCase): def test_pure_python(self): from zope.hookable import _PURE_PYTHON from zope.hookable import _c_hookable from zope.hookable import _py_hookable from zope.hookable import hookable self.a...
flexible
{ "blob_id": "13c0af340c4fff815919d7cbb1cfd3116be13771", "index": 7907, "step-1": "<mask token>\n\n\nclass PyHookableTests(PyHookableMixin, unittest.TestCase):\n\n def test_pure_python(self):\n from zope.hookable import _PURE_PYTHON\n from zope.hookable import _c_hookable\n from zope.hooka...
[ 20, 24, 28, 30, 35 ]
<|reserved_special_token_0|> def compare(mystring): def usd_to_ngn(): print('Getting USD to NGN Rate') req = requests.get( 'http://free.currconv.com/api/v7/convert?q=USD_NGN&apiKey=5029a99b396929294f63' ) req.raise_for_status() res = str(req.content)[2:-1] ...
flexible
{ "blob_id": "d96038a715406388b4de4611391dee18fc559d5a", "index": 2693, "step-1": "<mask token>\n\n\ndef compare(mystring):\n\n def usd_to_ngn():\n print('Getting USD to NGN Rate')\n req = requests.get(\n 'http://free.currconv.com/api/v7/convert?q=USD_NGN&apiKey=5029a99b396929294f63'\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('healthviolations.csv', 'w') as fp: with open('Restaurant_Inspections.csv', 'rb') as csvfile: reader = csv.reader(csvfile) header = next(reader, None) writer = csv.writer(fp, delimiter=',') ...
flexible
{ "blob_id": "1825b365032a224ed56a1814d7f6457e2add8fdd", "index": 8008, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('healthviolations.csv', 'w') as fp:\n with open('Restaurant_Inspections.csv', 'rb') as csvfile:\n reader = csv.reader(csvfile)\n header = next(reader, None)\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_key(name_of_key): print('Discovering API Key') response = api.get_api_keys(includeValues=True) items = response['items'] for item in items: if name_of_key in item['name']: return item['value'] def get_url(name_of_stack): print('Discovering...
flexible
{ "blob_id": "10fda09f47c292cb3dc901f42d38ead7757460f5", "index": 3699, "step-1": "<mask token>\n\n\ndef get_key(name_of_key):\n print('Discovering API Key')\n response = api.get_api_keys(includeValues=True)\n items = response['items']\n for item in items:\n if name_of_key in item['name']:\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class ConfigTestcase(unittest.TestCase): <|reserved_special_token_0|> def test_generate_zone_neighbours_one_country_one_subzone(self): exchanges = {'DE->SE-SE4': {'parsers': {'exchange': 'source'}}} zones = {'DE': {}, 'SE': {'subZoneNames': ['SE-SE4']}, 'SE-SE4': ...
flexible
{ "blob_id": "22b8ecfecc0e76d758f14dea865a426db56c6343", "index": 3538, "step-1": "<mask token>\n\n\nclass ConfigTestcase(unittest.TestCase):\n <mask token>\n\n def test_generate_zone_neighbours_one_country_one_subzone(self):\n exchanges = {'DE->SE-SE4': {'parsers': {'exchange': 'source'}}}\n ...
[ 7, 8, 10, 11, 12 ]
""" """ import os from alert_triage.util import filelock MODIFIED_ALERTS_FILE = "/tmp/alert_triage_modified_alerts" def read_modified_alert_ids(): """ Read modified alert IDs from file, then remove them from the file.""" # Return an empty list if the file doesn't exist. if not os.path.exists(MODIFIED_AL...
normal
{ "blob_id": "90ae14d8af163343520365a5565a7c44de57059d", "index": 5662, "step-1": "<mask token>\n\n\ndef read_modified_alert_ids():\n \"\"\" Read modified alert IDs from file, then remove them from the file.\"\"\"\n if not os.path.exists(MODIFIED_ALERTS_FILE):\n return []\n lock = filelock.FileLoc...
[ 1, 2, 3, 4, 5 ]
def say_hi(argument): return f"Hello {argument}" def call_func(some_func, argument): return some_func(argument) def main(argument): """docstring""" return call_func(say_hi, argument) if __name__ == "__main__": print(main(1))
normal
{ "blob_id": "2a3c3112122dee5574a1569155287ea3e5f8c7b2", "index": 6120, "step-1": "<mask token>\n\n\ndef call_func(some_func, argument):\n return some_func(argument)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef call_func(some_func, argument):\n return some_func(argument)\n\n\ndef main(argument):...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getOzoneData(): data = bus.read_i2c_block_data(80, 0, 2) raw_adc = (data[0] & 15) * 256 + data[1] ppm = 1.99 * raw_adc / 4096.0 + 0.01 return ppm <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getOzoneData(): data ...
flexible
{ "blob_id": "678189ac5b0105c90178647843335f9d4402dc66", "index": 1416, "step-1": "<mask token>\n\n\ndef getOzoneData():\n data = bus.read_i2c_block_data(80, 0, 2)\n raw_adc = (data[0] & 15) * 256 + data[1]\n ppm = 1.99 * raw_adc / 4096.0 + 0.01\n return ppm\n\n\n<mask token>\n", "step-2": "<mask to...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def deploy(): """deploys the project to the server""" with prefix('source /srv/django-envs/tweetset/bin/activate'): with shell_env(DJANGO_SETTINGS_MODULE='tweetset.settings.production'): with cd('/srv...
flexible
{ "blob_id": "6111c9730c556ab3ab95f7685ffa135a2bbeb2ca", "index": 5950, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef deploy():\n \"\"\"deploys the project to the server\"\"\"\n with prefix('source /srv/django-envs/tweetset/bin/activate'):\n with shell_env(DJANGO_SETTINGS_MODULE='twe...
[ 0, 1, 2, 3, 4 ]
__author__ = 'GazouillisTeam' import numpy as np import os import sys import time from keras.callbacks import Callback def save_architecture(model, path_out): """ Based on the keras utils 'model.summary()' """ # Redirect the print output the a textfile orig_stdout = sys.stdout # and store the...
normal
{ "blob_id": "f8635c815b375dc77e971d4ea0f86547215ab2f9", "index": 7987, "step-1": "<mask token>\n\n\nclass ModelSaver(Callback):\n \"\"\"\n Keras callback subclass which defines a saving procedure of the model being trained : after each epoch,\n the last model is saved under the name 'after_random.cnn'. ...
[ 6, 7, 8, 10, 13 ]
# Counts number of dumbbell curls in the video import cv2 import mediapipe as mp import base import math import numpy as np class PoseEstimator(base.PoseDetector): def __init__(self, mode=False, upperBody = False, smooth=True, detectConf=.5, trackConf=.5, outFile="output.mp4", outWidth=720, outHe...
normal
{ "blob_id": "4a886437727ed6b48206e12b686a59a1d2a1c489", "index": 4948, "step-1": "<mask token>\n\n\nclass PoseEstimator(base.PoseDetector):\n <mask token>\n\n def findAngle(self, img, p1, p2, p3, draw=True):\n x1, y1 = self.lms[p1][1:]\n x2, y2 = self.lms[p2][1:]\n x3, y3 = self.lms[p3...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Page: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def background(self, color=None, image=None, position=None, size=None, repeat=None, origin=None, clip=None, attachment=None): """Configures the page backgrou...
flexible
{ "blob_id": "2c2ad4b6e8c5055afa3dfb3b540a44bda65fa004", "index": 5991, "step-1": "<mask token>\n\n\nclass Page:\n <mask token>\n <mask token>\n <mask token>\n\n def background(self, color=None, image=None, position=None, size=None,\n repeat=None, origin=None, clip=None, attachment=None):\n ...
[ 3, 5, 6, 7, 8 ]
import pandas as pd import numpy as np import random import csv import pprint import datamake import dafunc_H def simulation(cnt, a, b): df, df_collist = datamake.make_df( '/Users/masato/Desktop/UTTdata/prog/PyProgramming/DA_algorithm/Mavo/csvdata/sinhuri2018.csv' ) n, m, k = datamake.stu_num() ...
normal
{ "blob_id": "cad00f80afa142b69ced880de000b6b5b230640c", "index": 6228, "step-1": "<mask token>\n\n\ndef simulation(cnt, a, b):\n df, df_collist = datamake.make_df(\n '/Users/masato/Desktop/UTTdata/prog/PyProgramming/DA_algorithm/Mavo/csvdata/sinhuri2018.csv'\n )\n n, m, k = datamake.stu_num()...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def collect_leaves(u: Union[dict, list]) ->list: flatten_list = [] if isinstance(u, dict): for item in u.values(): flatten_list.extend(collect_leaves(item)) return flatten_list return u <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "603cce951dd0f78ef3ca9dce587042b3b7f6b449", "index": 8001, "step-1": "<mask token>\n\n\ndef collect_leaves(u: Union[dict, list]) ->list:\n flatten_list = []\n if isinstance(u, dict):\n for item in u.values():\n flatten_list.extend(collect_leaves(item))\n return flatten_...
[ 1, 2, 3, 4, 5 ]
import hashlib a = hashlib.pbkdf2_hmac("sha256", b"hallo", b"salt", 1) b = hashlib.pbkdf2_hmac("sha256", a, b"salt", 1) c = hashlib.pbkdf2_hmac("sha256", b"hallo", b"salt", 2) print(b) print(c)
normal
{ "blob_id": "20ac73789fa7297a9230a6a2b814349d2b7da5fb", "index": 1851, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(b)\nprint(c)\n", "step-3": "<mask token>\na = hashlib.pbkdf2_hmac('sha256', b'hallo', b'salt', 1)\nb = hashlib.pbkdf2_hmac('sha256', a, b'salt', 1)\nc = hashlib.pbkdf2_hmac('sha25...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(3): ans += min(yuki[i], enemy[(i + 1) % 3]) * 3 yuki[i], enemy[(i + 1) % 3] = max(0, yuki[i] - enemy[(i + 1) % 3]), max( 0, enemy[(i + 1) % 3] - yuki[i]) for i in range(3): ans += min(yuki[i], en...
flexible
{ "blob_id": "ce98c13555c474de0a9cb12e99a97b2316312b00", "index": 979, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(3):\n ans += min(yuki[i], enemy[(i + 1) % 3]) * 3\n yuki[i], enemy[(i + 1) % 3] = max(0, yuki[i] - enemy[(i + 1) % 3]), max(\n 0, enemy[(i + 1) % 3] - yuki[i])\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class BreadCrumbHomeBasePage: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BreadCrumbHomeBasePage: <|reserved_special_token_0|> def gotoTicketInfoBasePage(self, ticketInfoPage): self...
flexible
{ "blob_id": "47c1746c2edfe4018decd59efbacc8be89a1f49e", "index": 3653, "step-1": "<mask token>\n\n\nclass BreadCrumbHomeBasePage:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BreadCrumbHomeBasePage:\n <mask token>\n\n def gotoTicketInfoBasePage(self, ticketInfoPage):\n ...
[ 1, 2, 3, 4, 5 ]
import pygame import serial import time ser1 = serial.Serial('/dev/ttyACM0', 115200) #Right ser1.write('?\n') time.sleep(0.5) if ser1.readline()[4] == 0: ser2 = serial.Serial('/dev/ttyACM1', 115200) #Left, negative speeds go forward else: ser1 = serial.Serial('/dev/ttyACM1', 115200) ser2 = serial.Serial('/...
normal
{ "blob_id": "e6d4d12d47391927364fdc9765c68690d42c5d8d", "index": 8950, "step-1": "<mask token>\n\n\ndef write_spd(write1, write2):\n ser1.write('sd' + str(write1) + '\\n')\n ser2.write('sd' + str(-write2) + '\\n')\n\n\n<mask token>\n", "step-2": "<mask token>\nser1.write('?\\n')\ntime.sleep(0.5)\nif ser1...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MockProto(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def create_mock_spout(self, spout_name, output_streams, spout_parallelism): spout = pr...
flexible
{ "blob_id": "002ef36bd132f1ac258b3f8baf8098accbd8a8f2", "index": 6839, "step-1": "<mask token>\n\n\nclass MockProto(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def create_mock_spout(self, spout_name, output_streams, spout_parallelism):\n spout ...
[ 9, 10, 12, 13, 14 ]
#!/usr/bin/env python import speech_recognition as sr from termcolor import colored as color import apiai import json from os import system import wikipedia as wiki from time import sleep import webbrowser as wb BOLD = "\033[1m" #use to bold the text END = "\033[0m" #use to close the bold text CLIENT_ACCESS_TOK...
normal
{ "blob_id": "d3e728bda85d2e72b8e477ab439d4dcffa23d63a", "index": 5448, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n r = sr.Recognizer()\n with sr.Microphone() as source:\n system('clear')\n print(color(BOLD + 'Hola!\\nAsk me anything.' + END, 'green'))\n while True:\n ...
[ 0, 1, 2, 3, 4 ]