code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(' Début du projet covid-19 !! ') print(' test repository distant') <|reserved_special_token_1|> #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 1 11:06:35 2020 @author: fitec """ # version 1 pri...
flexible
{ "blob_id": "3657d02271a27c150f4c67d67a2a25886b00c593", "index": 3306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Début du projet covid-19 !! ')\nprint(' test repository distant')\n", "step-3": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Nov 1 11:06:35 2020\n\n...
[ 0, 1, 2 ]
# Generated by Django 3.1.3 on 2020-11-18 13:26 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
normal
{ "blob_id": "fa09937ce64952795ae27cb91bf2c52dfb3ef4da", "index": 4532, "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 ]
import importlib if __name__ == '__main__': module = importlib.import_module('UserFile') print(module.if_new_message) print(module.ID)
normal
{ "blob_id": "8a773448383a26610f4798e12fb514248e71dc4b", "index": 698, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n module = importlib.import_module('UserFile')\n print(module.if_new_message)\n print(module.ID)\n", "step-3": "import importlib\nif __name__ == '__ma...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv2.imshow('img', img) cv2.waitKey(0) cv2.destroyAllWindows() <|reserved_special_token_1|> <|reserved_special_token_0|> face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassi...
flexible
{ "blob_id": "759ff4cc123e85bdc8c1457bb521cd35841956cd", "index": 482, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('img', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nface_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')\neye_cascade = cv...
[ 0, 1, 2, 3, 4 ]
"""Tasks for managing Debug Information Files from Apple App Store Connect. Users can instruct Sentry to download dSYM from App Store Connect and put them into Sentry's debug files. These tasks enable this functionality. """ import logging import pathlib import tempfile from typing import List, Mapping, Tuple impor...
normal
{ "blob_id": "51bc2668a9f9f4425166f9e6da72b7a1c37baa01", "index": 9628, "step-1": "<mask token>\n\n\ndef inner_dsym_download(project_id: int, config_id: str) ->None:\n \"\"\"Downloads the dSYMs from App Store Connect and stores them in the Project's debug files.\"\"\"\n with sdk.configure_scope() as scope:\...
[ 3, 5, 7, 9, 10 ]
# coding=utf-8 # http://rate.tmall.com/list_detail_rate.htm?itemId=41464129793&sellerId=1652490016&currentPage=1 import requests, re from Tkinter import * import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import random import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] ...
normal
{ "blob_id": "123d3906ce040a4daa5309eae555bad5509f805e", "index": 671, "step-1": "# coding=utf-8\n# http://rate.tmall.com/list_detail_rate.htm?itemId=41464129793&sellerId=1652490016&currentPage=1\nimport requests, re\nfrom Tkinter import *\nimport numpy as np\nimport matplotlib as mpl\nimport matplotlib.pyplot as...
[ 0 ]
import qrcode def generate_qr(query): img = qrcode.make(query)
normal
{ "blob_id": "e97bcf31657317f33f4a138ede80bb9171337f52", "index": 4730, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_qr(query):\n img = qrcode.make(query)\n", "step-3": "import qrcode\n\n\ndef generate_qr(query):\n img = qrcode.make(query)\n", "step-4": null, "step-5": null,...
[ 0, 1, 2 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import annotations from typing import List, Dict, NamedTuple, Union, Optional import codecs import collections import enum import json import re import struct from refinery.lib.structures import StructReader from refinery.units.formats.office...
normal
{ "blob_id": "566dab589cdb04332a92138b1a1faf53cd0f58b8", "index": 5419, "step-1": "<mask token>\n\n\nclass MSITableColumnInfo(NamedTuple):\n <mask token>\n number: int\n attributes: int\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def length(self) ->int:\n...
[ 14, 21, 22, 26, 27 ]
import random responses = ['Seems so','Never','Untrue','Always no matter what','You decide your fate','Not sure','Yep','Nope','Maybe','Nein','Qui','Ask the person next to you','That question is not for me'] def answer(): question = input('Ask me anything: ') print(random.choice(responses)) answer() secondQues...
normal
{ "blob_id": "41eef711c79fb084c9780b6d2638d863266e569d", "index": 837, "step-1": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print(random.choice(responses))\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef answer():\n question = input('Ask me anything: ')\n print...
[ 1, 2, 3, 4, 5 ]
def simple_formatter(zipcode: str, address: str) ->str: return f'{zipcode}は「{address}」です'
normal
{ "blob_id": "b1dce573e6da81c688b338277af214838bbab9dd", "index": 8649, "step-1": "<mask token>\n", "step-2": "def simple_formatter(zipcode: str, address: str) ->str:\n return f'{zipcode}は「{address}」です'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from fgpio import GPIO import boards
normal
{ "blob_id": "f66f79cd4132b23c082149a3a1d887f661fd7ee5", "index": 7247, "step-1": "<mask token>\n", "step-2": "from fgpio import GPIO\nimport boards\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# 1 def transform_data(fn): print(fn(10)) # 2 transform_data(lambda data: data / 5) # 3 def transform_data2(fn, *args): for arg in args: print(fn(arg)) transform_data2(lambda data: data / 5, 10, 15, 22, 30) # 4 def transform_data2(fn, *args): for arg in args: print('Resu...
normal
{ "blob_id": "c87e6f8780bf8d9097f200c7f2f0faf55beb480c", "index": 52, "step-1": "<mask token>\n\n\ndef transform_data2(fn, *args):\n for arg in args:\n print(fn(arg))\n\n\n<mask token>\n", "step-2": "def transform_data(fn):\n print(fn(10))\n\n\n<mask token>\n\n\ndef transform_data2(fn, *args):\n ...
[ 1, 2, 3, 4, 5 ]
import onmt import torch.nn as nn import torch.nn.functional as F import torch import torch.cuda from torch.autograd import Variable class CopyGenerator(nn.Module): """ Generator module that additionally considers copying words directly from the source. """ def __init__(self, opt, src_dict, tgt_d...
normal
{ "blob_id": "704b3c57ca080862bed7a4caa65d1c8d5a32fa0b", "index": 168, "step-1": "<mask token>\n\n\nclass CopyGenerator(nn.Module):\n <mask token>\n\n def __init__(self, opt, src_dict, tgt_dict):\n super(CopyGenerator, self).__init__()\n self.linear = nn.Linear(opt.rnn_size, tgt_dict.size())\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TreeDrawer: <|reserved_special_token_0|> <|reserved_special_token_0|> def draw_tree(self, filename): tree_file = open('dnaml.tree') x = tree_file.read() tree = Phylo.read(StringIO(x[:-2]), 'newick') Phylo.draw(tree, do_show=False) ...
flexible
{ "blob_id": "5adb16c654a4e747f803590c42328fa6ba642e95", "index": 7599, "step-1": "<mask token>\n\n\nclass TreeDrawer:\n <mask token>\n <mask token>\n\n def draw_tree(self, filename):\n tree_file = open('dnaml.tree')\n x = tree_file.read()\n tree = Phylo.read(StringIO(x[:-2]), 'newic...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def filter_by_session(schedule_table, time_entity): subjects_of_day = filter_by_weekday(schedule_table, time_entity) start_session_hour = parser.parse(time_entity['value']['from']).hour schedule = [] for subject in subjects_of_day: subject_start_time = int(subject[...
flexible
{ "blob_id": "6339f5c980ab0c0fb778870196493ddd83963ae7", "index": 9203, "step-1": "<mask token>\n\n\ndef filter_by_session(schedule_table, time_entity):\n subjects_of_day = filter_by_weekday(schedule_table, time_entity)\n start_session_hour = parser.parse(time_entity['value']['from']).hour\n schedule = [...
[ 5, 6, 7, 10, 11 ]
from django.http import HttpResponse from rest_framework.decorators import api_view @api_view(['GET']) def get_status(request): if request.method == 'GET': return HttpResponse(content='Service is OK!')
normal
{ "blob_id": "f021940c16b7ed7fdf1088f2137d3ef724719c80", "index": 1726, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET'])\ndef get_status(request):\n if request.method == 'GET':\n return HttpResponse(content='Service is OK!')\n", "step-3": "from django.http import HttpRespo...
[ 0, 1, 2 ]
from django.shortcuts import render from django.views.generic import View from django.http import JsonResponse from django_redis import get_redis_connection from django.contrib.auth.mixins import LoginRequiredMixin from good.models import GoodsSKU class CartAddView(View): '''添加购物车''' def post(self,request): ...
normal
{ "blob_id": "5feea24d269409306338f772f01b0ee1d2736e2e", "index": 9246, "step-1": "<mask token>\n\n\nclass UpdateCartView(View):\n <mask token>\n\n def post(self, request):\n user = request.user\n if not user.is_authenticated:\n return JsonResponse({'res': 0, 'errmsg': '请先登录'})\n ...
[ 11, 14, 17, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solution(people, limit): people.sort() cnt = 0 left_idx = 0 right_idx = len(people) - 1 while left_idx <= right_idx: if people[left_idx] + people[right_idx] <= limit: cnt += 1 ...
flexible
{ "blob_id": "b0dbc4e8a2ce41dc9d2040890e3df4d078680fa1", "index": 5444, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(people, limit):\n people.sort()\n cnt = 0\n left_idx = 0\n right_idx = len(people) - 1\n while left_idx <= right_idx:\n if people[left_idx] + people...
[ 0, 1, 2 ]
""" losettings.py Contains a class for profiles and methods to save and load them from xml files. Author: Stonepaw Version 2.0 Rewrote pretty much everything. Much more modular and requires no maintence when a new attribute is added. No longer fully supports profiles from 1.6 and earlier. Copy...
normal
{ "blob_id": "b29c11b11fd357c7c4f774c3c6a857297ff0d021", "index": 3144, "step-1": "\"\"\"\r\nlosettings.py\r\n\r\nContains a class for profiles and methods to save and load them from xml files.\r\n\r\nAuthor: Stonepaw\r\n\r\nVersion 2.0\r\n\r\n Rewrote pretty much everything. Much more modular and requires no...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from plprofiler_tool import main from plprofiler import plprofiler
flexible
{ "blob_id": "6b616f5ee0a301b76ad3f7284b47f225a694d33c", "index": 1281, "step-1": "<mask token>\n", "step-2": "from plprofiler_tool import main\nfrom plprofiler import plprofiler\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- """ Created on Mon Nov 9 20:06:32 2020 @author: Supriyo """ import networkx as nx import matplotlib.pyplot as plt g=nx.Graph() #l=[1,2,3] # g.add_node(1) # g.add_node(2) # g.add_node(3) # g.add_nodes_from(l) # g.add_edge(1,2) # g.add_edge(2,3) #...
normal
{ "blob_id": "3bfa9d42e3fd61cf6b7ffaac687f66c2f4bc073e", "index": 3906, "step-1": "<mask token>\n", "step-2": "<mask token>\nnx.draw(g)\nnx.draw(h)\nplt.show()\nnx.write_gexf(g, 'test.gexf')\n", "step-3": "<mask token>\ng = nx.Graph()\ng = nx.complete_graph(10)\nh = nx.gnp_random_graph(10, 0.5)\nnx.draw(g)\nn...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DeepModel: <|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|> @deep_model('trivial') class DummyModel...
flexible
{ "blob_id": "36257340ebbc6bd2c7fa5995511b2c859f58f8e5", "index": 3232, "step-1": "<mask token>\n\n\nclass DeepModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n@deep_model('trivial')\nclass DummyModel(DeepModel):\n\n def b...
[ 7, 12, 13, 14, 18 ]
from django.db import models from orders.constants import OrderStatus from subscriptions.models import Subscription class Order(models.Model): subscription = models.OneToOneField( Subscription, on_delete=models.CASCADE, related_name='order', ) order_status = models.CharField( ...
normal
{ "blob_id": "78ddae64cc576ebaf7f2cfaa4553bddbabe474b7", "index": 6918, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Order(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Order(m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def hard_negative_loss_mining(c_loss, negative_mask, k): """Hard negative mining in classification loss.""" k = tf.maximum(k, 1) k = tf.minimum(k, c_loss.shape[-1]) neg_c_loss = c_loss * negative_mask neg_c_loss = tf.nn.top_k(neg_c_loss, k)[0] return tf.reduce_sum(...
flexible
{ "blob_id": "6e17fef4507c72190a77976e4a8b2f56880f2d6f", "index": 4895, "step-1": "<mask token>\n\n\ndef hard_negative_loss_mining(c_loss, negative_mask, k):\n \"\"\"Hard negative mining in classification loss.\"\"\"\n k = tf.maximum(k, 1)\n k = tf.minimum(k, c_loss.shape[-1])\n neg_c_loss = c_loss * ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # you can use print for debugging purposes, e.g. # print "this is a debug message" def solution(A): N = len (A) #min_avg = min( (A[0] + A[1]) / 2, (A[0] + A[1] + A[2]) / 3) min_avg = (A[0] + A[1]) / 2.0 min_idx = 0 now_avg = 0.0 for i in xra...
normal
{ "blob_id": "caa92eb5582135f60a6034cb83d364501361d00e", "index": 7726, "step-1": "<mask token>\n", "step-2": "def solution(A):\n N = len(A)\n min_avg = (A[0] + A[1]) / 2.0\n min_idx = 0\n now_avg = 0.0\n for i in xrange(1, N - 1):\n now_avg = (A[i] + A[i + 1]) / 2.0\n if now_avg < ...
[ 0, 1, 2 ]
from Get2Gether.api_routes.schedule import schedule_router from Get2Gether.api_routes.auth import auth_router from Get2Gether.api_routes.event import event_router
normal
{ "blob_id": "cd9d10a3ee3956762d88e76a951023dd77023942", "index": 6411, "step-1": "<mask token>\n", "step-2": "from Get2Gether.api_routes.schedule import schedule_router\nfrom Get2Gether.api_routes.auth import auth_router\nfrom Get2Gether.api_routes.event import event_router\n", "step-3": null, "step-4": nu...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def createRandomPhoneNumber(): phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '150', '151', '152', '153', '158', '159', '177', '180', '181', '182', '183', '186', '18...
flexible
{ "blob_id": "5e8f9a222fb2c35b4720e48f0277481e410aee47", "index": 2791, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef createRandomPhoneNumber():\n phoneNumberFront = ['130', '131', '132', '133', '134', '135', '136',\n '137', '138', '139', '150', '151', '152', '153', '158', '159',\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Task(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "e59bd92a94399d4a81687fc5e52e9ae04b9de768", "index": 7472, "step-1": "<mask token>\n\n\nclass Task(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>\n <m...
[ 7, 8, 9, 10, 11 ]
from src.basepages.BreadCrumbTicketInfoBasePage import * class BreadCrumbHomeBasePage: def __init__(self): "" def gotoTicketInfoBasePage(self,ticketInfoPage): self.driver.get(ticketInfoPage) breadCrumbTicketInfoBasePage = BreadCrumbTicketInfoBasePage() breadCrumbTicketInfoBasePage.driver = self.driver r...
normal
{ "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 ]
<|reserved_special_token_0|> class Client(Base): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TakenBook(Base): __tablename__ = 'taken_books' id = Col...
flexible
{ "blob_id": "a288e66e64d386afd13bfc7b5b13d4a47d15cd6d", "index": 1316, "step-1": "<mask token>\n\n\nclass Client(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TakenBook(Base):\n __tablename__ = 'taken_books'\n id = Column(Integ...
[ 3, 7, 8, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') file.write('\ntimestamp: %s ' % st) print('\ntimestamp: %s ' % st) print('Temperature: %0.1f C' % bme680.tempe...
flexible
{ "blob_id": "ae7fc034249b7dde6d6bca33e2e6c8f464284cfc", "index": 9718, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ts = time.time()\n st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')\n file.write('\\ntimestamp: %s ' % st)\n print('\\ntimestamp: %s ' % st...
[ 0, 1, 2, 3, 4 ]
import os # Set a single thread per process for numpy with MKL/BLAS os.environ['MKL_NUM_THREADS'] = '1' os.environ['OPENBLAS_NUM_THREADS'] = '1' os.environ['MKL_DEBUG_CPU_TYPE'] = '5' import numpy as np from matplotlib import pyplot as plt from copy import deepcopy from kadal.optim_tools.MOBO import MOBO from kadal.s...
normal
{ "blob_id": "ba289bcdc0aa7c2ad70dba7fac541900d0b55387", "index": 7585, "step-1": "<mask token>\n\n\ndef generate_kriging():\n nsample = 20\n nvar = 2\n nobj = 2\n lb = -1 * np.ones(shape=[nvar])\n ub = 1 * np.ones(shape=[nvar])\n sampoption = 'halton'\n samplenorm, sample = sampling(sampopti...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class BaseService: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class BaseService: <|reserved_special_token_0|> def post(self, path, body): result = self._context.http.post(path, body) ...
flexible
{ "blob_id": "5000663e3cde9c1a1100c9022707ccae13db0034", "index": 1426, "step-1": "<mask token>\n", "step-2": "class BaseService:\n <mask token>\n <mask token>\n", "step-3": "class BaseService:\n <mask token>\n\n def post(self, path, body):\n result = self._context.http.post(path, body)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class EditUserProfileView(LoginRequiredMixin, UpdateView): model = Profile form_class = UserProfileForm template_name = 'profile.html' <|reserved_special_token_1|> <|reserved_special_token_0|> @login_required def home(request): return render(request, 'home.html') <|...
flexible
{ "blob_id": "21d261dec6668a24030f37b7dcb87c0132e63528", "index": 1365, "step-1": "<mask token>\n\n\nclass EditUserProfileView(LoginRequiredMixin, UpdateView):\n model = Profile\n form_class = UserProfileForm\n template_name = 'profile.html'\n", "step-2": "<mask token>\n\n\n@login_required\ndef home(re...
[ 2, 3, 4, 5, 6 ]
"""Main application for FastAPI""" from typing import Dict from fastapi import FastAPI from fastapi.openapi.utils import get_openapi from cool_seq_tool.routers import default, mane, mappings, SERVICE_NAME from cool_seq_tool.version import __version__ app = FastAPI( docs_url=f"/{SERVICE_NAME}", openapi_url=...
normal
{ "blob_id": "c6fa8c33630fc2f7ffb08aace1a260e6805ddfa2", "index": 7670, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.include_router(default.router)\napp.include_router(mane.router)\napp.include_router(mappings.router)\n\n\ndef custom_openapi() ->Dict:\n \"\"\"Generate custom fields for OpenAPI re...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> DEBUG = True SECRET_KEY = os.environ['SECRET_KEY'] ROOT_URLCONF = 'floweryroad.urls.docker_production' ALLOWED_HOSTS = [os.environ['WEB_HOST']] CORS_ORIGIN_WHITELIST = [os.environ['CORS']] DATABASES = {'default': {'ENGINE': 'djang...
flexible
{ "blob_id": "ab35684166f07a3ab9e64f2ff98980e25a3fc576", "index": 1643, "step-1": "<mask token>\n", "step-2": "<mask token>\nDEBUG = True\nSECRET_KEY = os.environ['SECRET_KEY']\nROOT_URLCONF = 'floweryroad.urls.docker_production'\nALLOWED_HOSTS = [os.environ['WEB_HOST']]\nCORS_ORIGIN_WHITELIST = [os.environ['CO...
[ 0, 1, 2 ]
# Feito por Kelvin Schneider #12 numero = input("Digite um numero de telefone: ") numero = numero.replace("-","") if (len(numero) < 8): while len(numero) < 8: numero = "3" + numero numero = numero[:4] + "-" + numero[4:] print("Numero: ", numero) elif (len(numero) > 8): print("Numero invalido...
normal
{ "blob_id": "6297256bce1954f041915a1ce0aa0546689850f3", "index": 2256, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(numero) < 8:\n while len(numero) < 8:\n numero = '3' + numero\n numero = numero[:4] + '-' + numero[4:]\n print('Numero: ', numero)\nelif len(numero) > 8:\n print...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ openapi.schematics ~~~~~~~~~~~~~~~~~~ Schematics plugin for apispec based on ext.MarshmallowPlugin """ import warnings from apispec import BasePlugin from .common import resolve_schema_instance, make_schema_key from .openapi import OpenAPIConverter def resolver(schema): "...
normal
{ "blob_id": "1c5655563d05498f016fb2d41a07331b9e8de5e8", "index": 2019, "step-1": "<mask token>\n\n\nclass SchematicsPlugin(BasePlugin):\n <mask token>\n\n def __init__(self, schema_name_resolver=None):\n super().__init__()\n self.schema_name_resolver = schema_name_resolver or resolver\n ...
[ 9, 12, 13, 14, 16 ]
<|reserved_special_token_0|> class GridData: def __init__(self, datafile, labelfile): f = open(datafile, 'rb') f2 = open(labelfile, 'r') self.samples = [] self.labels = [] self.label_names = [] self.data_size = 30 self.source = datafile sample_size ...
flexible
{ "blob_id": "8475792cc2d55f030f0bd9e7d0240e3b59ed996b", "index": 7774, "step-1": "<mask token>\n\n\nclass GridData:\n\n def __init__(self, datafile, labelfile):\n f = open(datafile, 'rb')\n f2 = open(labelfile, 'r')\n self.samples = []\n self.labels = []\n self.label_names =...
[ 2, 4, 5, 7, 8 ]
# stdlib from typing import Any # third party import numpy as np # syft absolute import syft as sy from syft.core.common.uid import UID from syft.core.node.new.action_object import ActionObject from syft.core.node.new.action_store import DictActionStore from syft.core.node.new.context import AuthedServiceContext from...
normal
{ "blob_id": "b76d3b6a4c15833ee2b25fede5923e1fe1dc4dd7", "index": 5422, "step-1": "<mask token>\n\n\ndef test_signing_key() ->None:\n test_signing_key = SyftSigningKey.from_string(test_signing_key_string)\n assert isinstance(test_signing_key, SyftSigningKey)\n assert str(test_signing_key) == test_signing...
[ 3, 7, 10, 11, 12 ]
<|reserved_special_token_0|> def test_inject_at_timestep(): with tf.Graph().as_default(): with tf.Session() as sess: in_seq = tf.constant(np.array([[[1, 2, 3, 4], [5, 6, 7, 8]], [[ 9, 10, 11, 12], [13, 14, 15, 16]], [[17, 18, 19, 20], [21, 22, 23, 24]]], dtype=...
flexible
{ "blob_id": "958f6e539f9f68892d77b6becc387581c6adfa16", "index": 3366, "step-1": "<mask token>\n\n\ndef test_inject_at_timestep():\n with tf.Graph().as_default():\n with tf.Session() as sess:\n in_seq = tf.constant(np.array([[[1, 2, 3, 4], [5, 6, 7, 8]], [[\n 9, 10, 11, 12], [...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class TankDriveResetEncoders(Command): <|reserved_special_token_0|> def execute(self): subsystems.driveline.resetEncoders() print('CMD TankDriveResetEncoders: Reset Completed') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_tok...
flexible
{ "blob_id": "f73faabe955e3ae05039e58ebabe5c012e080f38", "index": 9906, "step-1": "<mask token>\n\n\nclass TankDriveResetEncoders(Command):\n <mask token>\n\n def execute(self):\n subsystems.driveline.resetEncoders()\n print('CMD TankDriveResetEncoders: Reset Completed')\n <mask token>\n", ...
[ 2, 3, 4, 5, 6 ]
#! /usr/bin/python2.7 # -*- coding: utf-8 -*- import numpy as np import pandas as pd import pylab as pl x = range(1, 19) d = pd.read_csv('data.csv') pl.clf() pl.plot(x, d['reelection'], 'o-', label='reelection') pl.plot(x, d['rerun'], 'o-', label='rerun') pl.plot(x, d['ratio'], 'o-', label='incumbent ratio') pl.fill...
normal
{ "blob_id": "156b3e09a65402d4f964c2886b8f5519168eb13a", "index": 2894, "step-1": "<mask token>\n", "step-2": "<mask token>\npl.clf()\npl.plot(x, d['reelection'], 'o-', label='reelection')\npl.plot(x, d['rerun'], 'o-', label='rerun')\npl.plot(x, d['ratio'], 'o-', label='incumbent ratio')\npl.fill_between(x, d['...
[ 0, 1, 2, 3, 4 ]
import itertools def sevens_in_a_row(arr,n): in_a_row={} for iteration in arr: if arr[iteration]==arr[iteration+1]: print blaaa def main(): n=3 arr=['1','1','1','2','3','-4'] print (sevens_in_a_row(arr,n)) if __name__== '__main__': main()
normal
{ "blob_id": "a2626b384d0b7320ee9bf7cd75b11925ccc00666", "index": 9399, "step-1": "import itertools\ndef sevens_in_a_row(arr,n):\n\tin_a_row={}\n\tfor iteration in arr:\n\t\tif arr[iteration]==arr[iteration+1]:\n\t\t\tprint blaaa\n\t\t\t\n\ndef main():\n\tn=3\n\tarr=['1','1','1','2','3','-4']\n\tprint (sevens_in_...
[ 0 ]
#!/usr/bin/env python # coding:utf-8 """ 200. 岛屿数量 难度 中等 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 示例 1: 输入: 11110 11010 11000 00000 输出: 1 示例 2: 输入: 11000 11000 00100 00011 输出: 3 """ # ===============================================================================...
normal
{ "blob_id": "b46f19708e9e2a1be2bbd001ca6341ee7468a60d", "index": 7147, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n directions = [(-1, 0), (0, 1), (1, 0), (0, -1)]\n\n def numIslands(self, grid):\n \"\"\"\n :type grid: List[List[str]]\n :rtype: int\n ...
[ 3, 5, 7, 10, 12 ]
""" 对自定义的类进行排序 """ import operator class User: def __init__(self, name, id): self.name = name self.id = id def __repr__(self): return 'User({},{})'.format(self.name, self.id) def run(): users = [User('wang', 1), User('zhao', 4), User('chen', 3), User('wang', 2)] # 这种方式相对速度快...
normal
{ "blob_id": "e8ef3a5e41e68b4d219aa1403be392c51cc010e6", "index": 7302, "step-1": "<mask token>\n\n\nclass User:\n\n def __init__(self, name, id):\n self.name = name\n self.id = id\n\n def __repr__(self):\n return 'User({},{})'.format(self.name, self.id)\n\n\n<mask token>\n", "step-2"...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.config.from_object('config') api.init_app(app) if __name__ == '__main__': app.run() <|reserved_special_token_1|> <|reserved_special_token_0|> app = Flask(__name__) app.config.from_object('config') api.init_app(app) if _...
flexible
{ "blob_id": "f4ea36c3154f65c85647da19cfcd8a058c507fe1", "index": 4992, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object('config')\napi.init_app(app)\nif __name__ == '__main__':\n app.run()\n", "step-3": "<mask token>\napp = Flask(__name__)\napp.config.from_object('config')\napi....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_last_argument(words): return ' '.join(words)[:-1] <|reserved_special_token_0|> def parse_what_is_the(words): question_number = None arg = None if words[3] == POPULATION_KEY: question_number = 3 arg = get_last_argument(words[5:]) elif words[3...
flexible
{ "blob_id": "18dce1ce683b15201dbb5436cbd4288a0df99c28", "index": 938, "step-1": "<mask token>\n\n\ndef get_last_argument(words):\n return ' '.join(words)[:-1]\n\n\n<mask token>\n\n\ndef parse_what_is_the(words):\n question_number = None\n arg = None\n if words[3] == POPULATION_KEY:\n question_...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def engparallelb2(MU, NU, b1, b2, x1, x2, y1, y2, eta, a): b1x = b1[0] b1y = b1[1] b1z = b1[2] b2x = b2[0] b2y = b2[1] b2z = b2[2] Rab = Rp(x2, y2, eta, a) - Rp(x2, y1, eta, a) - Rp(x1, y2, eta, a) + ...
flexible
{ "blob_id": "2611d7dd364f6a027da29c005754ac2465faa8be", "index": 8667, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef engparallelb2(MU, NU, b1, b2, x1, x2, y1, y2, eta, a):\n b1x = b1[0]\n b1y = b1[1]\n b1z = b1[2]\n b2x = b2[0]\n b2y = b2[1]\n b2z = b2[2]\n Rab = Rp(x2, y2, ...
[ 0, 2, 3, 4, 5 ]
from setuptools import setup setup(name='gym_asset_allocation', version='0.0.1', install_requires=['gym','numpy','pandas','quandl'] # And any other dependencies )
normal
{ "blob_id": "952f8341f0fcbe6f3f3d1075ce345e61967a4336", "index": 4381, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='gym_asset_allocation', version='0.0.1', install_requires=['gym',\n 'numpy', 'pandas', 'quandl'])\n", "step-3": "from setuptools import setup\nsetup(name='gym_asset_alloca...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('%.2f' % ukupanPut) <|reserved_special_token_1|> <|reserved_special_token_0|> r = float(input()) p = int(input()) obim = 2 * r * math.pi ukupanPut = p * obim ukupanPut = ukupanPut * 0.01 print('%.2f' % ukupanPut) <|rese...
flexible
{ "blob_id": "1f27b697985c7417e6d8d978703175a415c6c57d", "index": 327, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('%.2f' % ukupanPut)\n", "step-3": "<mask token>\nr = float(input())\np = int(input())\nobim = 2 * r * math.pi\nukupanPut = p * obim\nukupanPut = ukupanPut * 0.01\nprint('%.2f' % uk...
[ 0, 1, 2, 3, 4 ]
import sys, warnings if sys.version_info[0] < 3: warnings.warn("At least Python 3.0 is required to run this program", RuntimeWarning) else: print('Normal continuation')
normal
{ "blob_id": "a6d5552fa0648fcf9484a1498e4132eb80ecfc86", "index": 2304, "step-1": "<mask token>\n", "step-2": "<mask token>\nif sys.version_info[0] < 3:\n warnings.warn('At least Python 3.0 is required to run this program',\n RuntimeWarning)\nelse:\n print('Normal continuation')\n", "step-3": "im...
[ 0, 1, 2, 3 ]
from os import path from sklearn.model_selection import StratifiedShuffleSplit from sklearn.pipeline import Pipeline from sta211.datasets import load_train_dataset, load_test_dataset, find_best_train_dataset from sklearn.model_selection import GridSearchCV from sta211.selection import get_naive_bayes, get_mlp, get_svm,...
normal
{ "blob_id": "c99878dbd5610c8a58f00912e111b1eef9d3893e", "index": 7782, "step-1": "<mask token>\n", "step-2": "<mask token>\ngrid.fit(X, y)\n<mask token>\nprint('Result for {} configurations'.format(len(parameters)))\nfor p in parameters:\n print('{};{:.2f}%;{:.4f}%;±{:.4f}%'.format(', '.join(map(lambda k:\n...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf import settings import numpy as np slim = tf.contrib.slim class Model: def __init__(self, training = True): self.classes = settings.classes_name self.num_classes = len(settings.classes_name) self.image_size = settings.image_size self.cell_size = setting...
normal
{ "blob_id": "8ccec24e1a7060269ffbb376ba0c480da9eabe0a", "index": 819, "step-1": "<mask token>\n\n\nclass Model:\n\n def __init__(self, training=True):\n self.classes = settings.classes_name\n self.num_classes = len(settings.classes_name)\n self.image_size = settings.image_size\n se...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class DatasetLoader(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DatasetLoader(object): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "b668945820abe893b92fdf26ccd8563ccff804ee", "index": 1981, "step-1": "<mask token>\n\n\nclass DatasetLoader(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DatasetLoader(object):\n <mask token>\n\n def __init__(self, ds_i...
[ 1, 4, 5, 6, 7 ]
from binary_search_tree.gen_unique_bst import gen_unique_bst # The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. def max_depth(root): if not root: return 0 return max(max_depth(root.left), max_depth(root.right)) + 1 # The minimum depth...
normal
{ "blob_id": "3e54d2ddddf6f8186137e5801ca4ba40d1061987", "index": 2801, "step-1": "from binary_search_tree.gen_unique_bst import gen_unique_bst\n\n\n# The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.\ndef max_depth(root):\n if not root:\n ...
[ 0 ]
<|reserved_special_token_0|> class TestObs(unittest.TestCase): <|reserved_special_token_0|> def setUp(self): self.validator = Validator() self.validator.adata = examples.adata.copy() <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reser...
flexible
{ "blob_id": "f4306f80330850415b74d729384f360489644e39", "index": 354, "step-1": "<mask token>\n\n\nclass TestObs(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n self.validator = Validator()\n self.validator.adata = examples.adata.copy()\n <mask token>\n <mask token>\n <mask...
[ 43, 45, 50, 57, 75 ]
# Copyright 2016 Osvaldo Santana Neto # # 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 ...
normal
{ "blob_id": "09284a96467b09c2ad7b65530c015fdb64b198a4", "index": 2638, "step-1": "<mask token>\n\n\nclass ModelBuilder:\n <mask token>\n <mask token>\n <mask token>\n\n def build_user(self, user_data):\n user = User(name=user_data.nome, federal_tax_number=\n FederalTaxNumber(user_da...
[ 29, 30, 33, 37, 42 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Persona) <|reserved_special_token_1|> from django.contrib import admin from pharma_models.personas.models import Persona admin.site.register(Persona)
flexible
{ "blob_id": "59d04ebd9a45c6a179a2da1f88f728ba2af91c05", "index": 590, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Persona)\n", "step-3": "from django.contrib import admin\nfrom pharma_models.personas.models import Persona\nadmin.site.register(Persona)\n", "step-4": null, "ste...
[ 0, 1, 2 ]
from tkinter import * from tkinter.scrolledtext import ScrolledText def load(): with open(filename.get()) as file: # delete every between line 1 char 0 to END # INSERT is the current insertion point contents.delete('1.0', END) contents.insert(INSERT, file.read()) def save(): with open(filename.g...
normal
{ "blob_id": "fcf4cb5c47e4aa51d97b633ecdfec65246e82bd8", "index": 9011, "step-1": "<mask token>\n\n\ndef load():\n with open(filename.get()) as file:\n contents.delete('1.0', END)\n contents.insert(INSERT, file.read())\n\n\ndef save():\n with open(filename.get(), 'w') as file:\n file.wr...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class TestMacAddress(configure.NetTestCase, TestField): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_insert(self): self.base('08-00-2b-01-02-03') val = self.orm.new().insert(self.base) val = getattr(val, self.base.field_name) ...
flexible
{ "blob_id": "b5dba7c1566721f8bb4ec99bc2f13cae4ade4f0a", "index": 8713, "step-1": "<mask token>\n\n\nclass TestMacAddress(configure.NetTestCase, TestField):\n <mask token>\n <mask token>\n\n def test_insert(self):\n self.base('08-00-2b-01-02-03')\n val = self.orm.new().insert(self.base)\n ...
[ 8, 9, 11, 14, 15 ]
text = "I love Python Programming" for word in text.split(): print(word)
normal
{ "blob_id": "fdc8f9ff9a0e2cd8ad1990948036d9e420fdc074", "index": 4216, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in text.split():\n print(word)\n", "step-3": "text = 'I love Python Programming'\nfor word in text.split():\n print(word)\n", "step-4": "text = \"I love Python Programm...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Default organizer for bioinfoinformatics project directiories - RNA-Seq based model """ import os import sys #main path curr_path = os.getcwd() print("\nYour current directory is: " + curr_path + "\n\nIt contains the following files and directories:\n\n" + str(os.listdir("."))) # displays...
normal
{ "blob_id": "0131657a7675904ee2743448f514a9f11e0dc0ad", "index": 7561, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"\"\"\nYour current directory is: \"\"\" + curr_path +\n \"\"\"\n\nIt contains the following files and directories:\n\n\"\"\" + str(os.\n listdir('.')))\n<mask token>\nos.mkd...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_parse_redis_key(config_helper, ingestion_manager): im = ingestion_manager job_name = config_helper.nodes_ingestion_operation operation = config_helper.nodes_ingestion_operation labels = config_helper.tes...
flexible
{ "blob_id": "13451352e8dcdfe64771f9fc188b13a31b8109f5", "index": 4555, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_parse_redis_key(config_helper, ingestion_manager):\n im = ingestion_manager\n job_name = config_helper.nodes_ingestion_operation\n operation = config_helper.nodes_in...
[ 0, 2, 3, 4, 5 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "89d0d5d13c5106c504c6727c7784f048a30495dc", "index": 5560, "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 ]
<|reserved_special_token_0|> @pytest.mark.parametrize('data, parsed', REDIS_PARSE) def test_parse_redis_data(data, parsed): """Test to see if data dict in bytes is parsed.""" assert redis_data.parse_redis_data(data) == parsed def test_parse_redis_data_error(): """Test to see if parse redis raises value ...
flexible
{ "blob_id": "7f4a5779564efde7eaf08741d00254dd4aa37569", "index": 4218, "step-1": "<mask token>\n\n\n@pytest.mark.parametrize('data, parsed', REDIS_PARSE)\ndef test_parse_redis_data(data, parsed):\n \"\"\"Test to see if data dict in bytes is parsed.\"\"\"\n assert redis_data.parse_redis_data(data) == parsed...
[ 7, 8, 10, 11, 12 ]
import os import sqlite3 from typing import Any from direct_geocoder import get_table_columns from reverse_geocoder import is_point_in_polygon from utils import zip_table_columns_with_table_rows, get_average_point def get_organizations_by_address_border(city: str, nodes: list[...
normal
{ "blob_id": "79f945694f853e5886b590020bb661ecd418510d", "index": 4567, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_organizations_by_address_border(city: str, nodes: list[tuple[float,\n float]]) ->list[dict[str, Any]]:\n result = []\n radius = 0.0025\n with sqlite3.connect(os.pa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def nums(phrase, morph=pymorphy2.MorphAnalyzer()): """ согласование существительных с числительными, стоящими перед ними """ phrase = phrase.replace(' ', ' ').replace(',', ' ,') numeral = '' new_phrase = [] for word in phrase.split(' '): if 'NUMB' in morph.par...
flexible
{ "blob_id": "a98be930058269a6adbc9a28d1c0ad5d9abba136", "index": 35, "step-1": "<mask token>\n\n\ndef nums(phrase, morph=pymorphy2.MorphAnalyzer()):\n \"\"\" согласование существительных с числительными, стоящими перед ними \"\"\"\n phrase = phrase.replace(' ', ' ').replace(',', ' ,')\n numeral = ''\n ...
[ 10, 11, 13, 17, 18 ]
import os import tkinter as tk from tkinter import messagebox from os.path import join from pynput import keyboard from src.save_count import SaveCount class MainApplication(tk.Frame): def __init__(self, root: tk.Tk): super().__init__(root) self.root = root self.pack(padx=32, pady=32, e...
normal
{ "blob_id": "7e2bf898eb1c0118205042797e6dac535342979b", "index": 185, "step-1": "<mask token>\n\n\nclass MainApplication(tk.Frame):\n <mask token>\n\n def count_up(self):\n if self.var_count.get() == 0 and self.lst_counts.index(tk.END) == 0:\n SaveCount(tk.Toplevel(), self.save_to_listbox...
[ 6, 9, 14, 15, 16 ]
# -*- coding:utf-8 -*- # author:Kyseng # file: cRandomString.py # time: 2018/11/8 11:41 PM # functhion: import random import sys reload(sys) sys.setdefaultencoding('utf-8') class cRandomString(): @staticmethod def RandomTitle(name): # name = name.decode('utf8') # print name platform =...
normal
{ "blob_id": "ed02cbf3ebef307d6209004e1e388312bfda0b50", "index": 2027, "step-1": "<mask token>\n\n\nclass cRandomString:\n\n @staticmethod\n def RandomTitle(name):\n platform = ['PS4', 'XBOX', 'PC', 'NS', 'IOS']\n random.shuffle(platform)\n platform = '/'.join(platform)\n firstW...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Post(db.Model): id = db.Column(db.Integer(), primary_key=True) title = db.Column(db.String(255)) text = db.Column(db.Text()) date = db.Column(db.DateTime()) user_id = db.Column(db.Integer(), db.ForeignKey('user.id')) comments = db.relationship('Comment', back...
flexible
{ "blob_id": "dd0e96a1f93cbffedc11262a883dda285f5c224c", "index": 9703, "step-1": "<mask token>\n\n\nclass Post(db.Model):\n id = db.Column(db.Integer(), primary_key=True)\n title = db.Column(db.String(255))\n text = db.Column(db.Text())\n date = db.Column(db.DateTime())\n user_id = db.Column(db.In...
[ 12, 17, 20, 21 ]
<|reserved_special_token_0|> def csv_parser(statement): import psycopg2 return_ls = [] try: connection = psycopg2.connect(user='icu_bot', password= '5B2xwP8h4Ln4Y8Xs', host='85.214.150.208', port='5432', database='ICU') cursor = connection.cursor() sql_Query...
flexible
{ "blob_id": "516ea681a55255e4c98e7106393180f9ad2e0250", "index": 8455, "step-1": "<mask token>\n\n\ndef csv_parser(statement):\n import psycopg2\n return_ls = []\n try:\n connection = psycopg2.connect(user='icu_bot', password=\n '5B2xwP8h4Ln4Y8Xs', host='85.214.150.208', port='5432',\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @admin.register(AuxiliaryTicket) class AuxiliaryTicketAdmin(admin.ModelAdmin): pass @admin.register(UserTicket) class UserTicketAdmin(admin.ModelAdmin): pass <|reserved_special_token_1|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "c73a199d1c1c1867f3d53ceebf614bc9b65c0d5e", "index": 280, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@admin.register(AuxiliaryTicket)\nclass AuxiliaryTicketAdmin(admin.ModelAdmin):\n pass\n\n\n@admin.register(UserTicket)\nclass UserTicketAdmin(admin.ModelAdmin):\n pass\n", "st...
[ 0, 2, 3, 4 ]
# Head start. # ask me for this solution: 6cb9ce6024b5fd41aebb86ccd40d8080 # this line is not needed, just for better output: from pprint import pprint # just remove the top line def count_or_add_trigrams(trigram, trigrams_so_far): ''' Takes a trigram, and a list of previously seen trigrams and ...
normal
{ "blob_id": "753cc532e4d049bacff33c97de4d80bb9ab8ece8", "index": 2655, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef count_or_add_trigrams(trigram, trigrams_so_far):\n \"\"\"\n Takes a trigram, and a list of previously seen trigrams\n and yields the same list with all discovered and cou...
[ 0, 2, 3, 4, 5 ]
import luigi import numpy as np import tqdm import os from scipy import spatial from kq import wordmat_distance class QuestionVectorTask(luigi.Task): resources = {'cpu': 1} dataset = luigi.Parameter() def requires(self): #yield wordmat_distance.WeightedSentenceVecs() yield wordmat_distan...
normal
{ "blob_id": "ae6a6f7622bf98c094879efb1b9362a915a051b8", "index": 1175, "step-1": "<mask token>\n\n\nclass QuestionVectorTask(luigi.Task):\n <mask token>\n <mask token>\n <mask token>\n\n def output(self):\n return luigi.LocalTarget('./cache/question_distance/%s.npy' % self.\n datase...
[ 7, 8, 11, 12, 13 ]
import random import sys import math import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Flatten, Conv2D, Activation from snake_game import Snake from snake_game import Fruit import pygame from pygame.locals import * # Neural Network glo...
normal
{ "blob_id": "fc1b9ab1fb1ae71d70b3bf5c879a5f604ddef997", "index": 9969, "step-1": "<mask token>\n\n\ndef save_pool():\n for i in range(total_models):\n current_pool[i].save_weights(save_location + str(i) + '.keras')\n print('Pool saved')\n\n\ndef create_model():\n \"\"\"\n Create Neural Network...
[ 13, 15, 16, 20, 21 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: """ @param: start: start value. @param: end: end value. @return: The root of Segment Tree. """ def buil...
flexible
{ "blob_id": "5e20a517131f7a372d701548e4f370766a84ba52", "index": 6134, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n \"\"\"\n @param: start: start value.\n @param: end: end value.\n @return: The root of Segment Tr...
[ 1, 3, 4, 5, 6 ]
class Solution: def maxSideLength(self, mat: List[List[int]], threshold: int) -> int: def squareSum(r1: int, c1: int, r2: int, c2: int) -> int: return prefixSum[r2 + 1][c2 + 1] - prefixSum[r1][c2 + 1] - prefixSum[r2 + 1][c1] + prefixSum[r1][c1] m = len(mat) n = len(mat[0]) ...
normal
{ "blob_id": "c8f2df1471a9581d245d52437470b6c67b341ece", "index": 7297, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def maxSideLength(self, mat: List[List[int]], threshold: int) ->int:\n\n def squareSum(r1: int, c1: int, r2: int, c2: in...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Post(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: ordering = ['parent_id', 'created_at'] <|reserved_special_token_0|> ...
flexible
{ "blob_id": "5c4a48de94cf5bfe67e6a74c33a317fa1da8d2fa", "index": 7330, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = ['parent_id', 'created_at']\n <mask token>\n <mask...
[ 3, 7, 8, 9, 10 ]
import pytest from moa.primitives import NDArray, UnaryOperation, BinaryOperation, Function from moa.yaccer import build_parser @pytest.mark.parametrize("expression,result", [ ("< 1 2 3>", NDArray(shape=(3,), data=[1, 2, 3], constant=False)), ]) def test_parse_vector(expression, result): parser = build_parse...
normal
{ "blob_id": "a8b5cf45e5f75ae4b493f5fc9bb4555319f1a725", "index": 5294, "step-1": "<mask token>\n\n\n@pytest.mark.parametrize('expression,result', [('< 1 2 3>', NDArray(shape=(\n 3,), data=[1, 2, 3], constant=False))])\ndef test_parse_vector(expression, result):\n parser = build_parser(start='vector')\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( 'Bienvenido a este programa para que introduzcas una frase y un carácter, y decirte cuántas veces aparece ese carácter en tu frase.' ) print( """------------------------------------------------------------------...
flexible
{ "blob_id": "65301be73bb56147609a103a932266013c3c0bd6", "index": 1148, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Bienvenido a este programa para que introduzcas una frase y un carácter, y decirte cuántas veces aparece ese carácter en tu frase.'\n )\nprint(\n \"\"\"----------------...
[ 0, 1, 2, 3 ]
# # PySNMP MIB module CISCO-L2NAT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-L2NAT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:47:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
normal
{ "blob_id": "2fb95fa2b7062085f31c6b1dbb8c1336c3871e93", "index": 3271, "step-1": "<mask token>\n", "step-2": "<mask token>\nciscoL2natMIB.setRevisions(('2013-04-16 00:00',))\nif mibBuilder.loadTexts:\n ciscoL2natMIB.setLastUpdated('201304160000Z')\nif mibBuilder.loadTexts:\n ciscoL2natMIB.setOrganization...
[ 0, 1, 2, 3 ]
""" generalised behaviour for actors and vacancies """ from mesa import Agent from random import shuffle import numpy as np class Entity(Agent): """ superclass for vacancy and actor agents not intended to be used on its own, but to inherit its methods to multiple other agents """ def __init__(sel...
normal
{ "blob_id": "68b967ecf18d576758cf05e889919944cfc34dcd", "index": 250, "step-1": "<mask token>\n\n\nclass Entity(Agent):\n <mask token>\n\n def __init__(self, unique_id, model):\n super().__init__(unique_id, model)\n self.type = ''\n self.position = ''\n self.log = []\n se...
[ 5, 6, 7, 9, 10 ]
#!/bin/usr/python ''' Author: SaiKumar Immadi Basic DBSCAN clustering algorithm written in python 5th Semester @ IIIT Guwahati ''' # You can use this code for free. Just don't plagiarise it for your lab assignments import sys from math import sqrt from random import randint import matplotlib.pyplot as plt def main(a...
normal
{ "blob_id": "624ecf743d5be1acc33df14bd721b3103d232f0e", "index": 2444, "step-1": "#!/bin/usr/python\n'''\nAuthor: SaiKumar Immadi\nBasic DBSCAN clustering algorithm written in python\n5th Semester @ IIIT Guwahati\n'''\n\n# You can use this code for free. Just don't plagiarise it for your lab assignments\n\nimpor...
[ 0 ]
from Bio import SeqIO def flatten(l): return [j for i in l for j in i] def filter_sequences_by_len_from_fasta(file, max_len): with open(file) as handle: return [str(record.seq) for record in SeqIO.parse(handle, 'fasta') if len(record.seq) <= max_len]
normal
{ "blob_id": "1fdb9db4c1c8b83c72eeb34f10ef9d289b43b79f", "index": 3166, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef flatten(l):\n return [j for i in l for j in i]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef flatten(l):\n return [j for i in l for j in i]\n\n\ndef filter_sequen...
[ 0, 1, 2, 3 ]
#!/usr/bin/python #_*_ coding: utf-8 _*_ import MySQLdb as mdb import sys con = mdb.connect("localhost","testuser","testdB","testdb") with con: cur = con.cursor() cur.execute("UPDATE Writers SET Name = %s WHERE Id = %s ", ("Guy de manupassant", "4")) print "Number of rows updated: %d "% cur....
normal
{ "blob_id": "94a84c7143763c6b7ccea1049cdec8b7011798cd", "index": 6569, "step-1": "#!/usr/bin/python\n#_*_ coding: utf-8 _*_\n\nimport MySQLdb as mdb\nimport sys\n\ncon = mdb.connect(\"localhost\",\"testuser\",\"testdB\",\"testdb\")\n\nwith con:\n cur = con.cursor()\n\n cur.execute(\"UPDATE Writers SET Name...
[ 0 ]
# Generated by Django 3.1.7 on 2021-03-29 18:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("core", "0052_add_more_tags"), ] operations = [ migrations.RenameField( model_name="reporter", old_name="auth0_role_name", ...
normal
{ "blob_id": "c0cabf2b6f7190aefbaefa197a9008de3a344147", "index": 2082, "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 = [('core', '005...
[ 0, 1, 2, 3, 4 ]
import numpy as np import h5py def rotate_z(theta, x): theta = np.expand_dims(theta, 1) outz = np.expand_dims(x[:, :, 2], 2) sin_t = np.sin(theta) cos_t = np.cos(theta) xx = np.expand_dims(x[:, :, 0], 2) yy = np.expand_dims(x[:, :, 1], 2) outx = cos_t * xx - sin_t * yy outy = sin_t * x...
normal
{ "blob_id": "855bfc9420a5d5031cc673231cc7993ac67df076", "index": 5515, "step-1": "<mask token>\n\n\nclass ModelFetcher(object):\n <mask token>\n\n def train_data(self):\n rng_state = np.random.get_state()\n np.random.shuffle(self._train_data)\n np.random.set_state(rng_state)\n n...
[ 3, 6, 8, 10, 11 ]
columns = ['account', 'name', 'Death', 'archetype', 'profession', 'elite', 'phases.All.actual_boss.dps', 'phases.All.actual.dps', 'phases.All.actual_boss.flanking', 'phases.All.actual_boss.scholar', 'phases.All.actual_boss.condi_dps', 'phases.All.actual_boss.power_dps', 'phases.All.buffs.aegis', 'phases...
normal
{ "blob_id": "fa948838b5c2d688fe8c748166f23ffc8e677f93", "index": 9265, "step-1": "<mask token>\n", "step-2": "columns = ['account', 'name', 'Death', 'archetype', 'profession', 'elite',\n 'phases.All.actual_boss.dps', 'phases.All.actual.dps',\n 'phases.All.actual_boss.flanking', 'phases.All.actual_boss.sc...
[ 0, 1 ]
from utilidades import moeda p = float(input('Digite o preço: R$')) print(f'Metade de {moeda.moeda(p)} é {moeda.metade(p, show=True)}') print(f'O dobro de {moeda.moeda(p)} é {moeda.dobro(p, show=True)}') print(f'Aumentando 10%, temos {moeda.aumentar(p, 10, show=True)}') print(f'Reduzindo 13%, temos {moeda.diminuir(p, 1...
normal
{ "blob_id": "5a50ca64810c391231a00c6bfe5ae925ffe5ca7d", "index": 6332, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'Metade de {moeda.moeda(p)} é {moeda.metade(p, show=True)}')\nprint(f'O dobro de {moeda.moeda(p)} é {moeda.dobro(p, show=True)}')\nprint(f'Aumentando 10%, temos {moeda.aumentar(p, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ParticleSwarmOptimization: <|reserved_special_token_0|> def __init__(self, hyperparams, lower_bound, upper_bound): self.lower_bound = lower_bound self.upper_bound = upper_bound self.num_particles = hyperparams.num_particles self.w = hyperpara...
flexible
{ "blob_id": "096df1db4d8673ae7886a1b2022148c92f64a23e", "index": 1725, "step-1": "<mask token>\n\n\nclass ParticleSwarmOptimization:\n <mask token>\n\n def __init__(self, hyperparams, lower_bound, upper_bound):\n self.lower_bound = lower_bound\n self.upper_bound = upper_bound\n self.nu...
[ 5, 7, 9, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(a, b + 1): true_prime = True for num in range(2, i): if i % num == 0: true_prime = False if true_prime: count += 1 print(count) <|reserved_special_token_1|> <|reserved_spec...
flexible
{ "blob_id": "ed4c97913a9dba5cf6be56050a8d2ce24dbd6033", "index": 1870, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(a, b + 1):\n true_prime = True\n for num in range(2, i):\n if i % num == 0:\n true_prime = False\n if true_prime:\n count += 1\nprint(coun...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def qInitResources(): QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) def qCleanupResources(): QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) <|reserved_speci...
flexible
{ "blob_id": "dbf831540d11a994d5483dc97c7eab474f91f0d3", "index": 8118, "step-1": "<mask token>\n\n\ndef qInitResources():\n QtCore.qRegisterResourceData(rcc_version, qt_resource_struct,\n qt_resource_name, qt_resource_data)\n\n\ndef qCleanupResources():\n QtCore.qUnregisterResourceData(rcc_version, ...
[ 2, 3, 4, 5, 6 ]
from django.shortcuts import render from django.http import response, HttpResponse, Http404 from django.views.generic import TemplateView from django.db.models import Q # Create your views here. class Countries(TemplateView): template_name = 'home.html' def get_context_data(self, **kwargs): return Cou...
normal
{ "blob_id": "fd7fe2e4ffaa4de913931e83fd1de40f79b08d98", "index": 6222, "step-1": "<mask token>\n\n\nclass Countries(TemplateView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Countries(TemplateView):\n <mask token>\n\n def get_context_data(self, **kwargs):\n return C...
[ 1, 2, 3, 4, 5 ]
import sys def tackle_mandragora(health): health.sort() # for all tipping points, where we change over from eating to defeating defeating = defeating_cost_precompute(health) opt = 0 for i in range(0, len(health) + 1): opt = max(opt, defeating_cost(i, defeating)) return opt def defe...
normal
{ "blob_id": "24ad62342fb9e7759be8561eaf0292736c7dcb6d", "index": 6756, "step-1": "<mask token>\n\n\ndef defeating_cost(i, defeating):\n return (i + 1) * defeating[i]\n\n\ndef defeating_cost_precompute(health):\n n = len(health) + 1\n defeating = [(0) for x in range(n)]\n defeating[len(health)] = 0\n ...
[ 2, 4, 5, 6, 7 ]
# Python : Correct way to strip <p> and </p> from string? s = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')
normal
{ "blob_id": "7b6e73744d711188ab1a622c309b8ee55f3eb471", "index": 7427, "step-1": "<mask token>\n", "step-2": "s = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')\n", "step-3": "# Python : Correct way to strip <p> and </p> from string?\ns = s.replace('&lt;p&gt;', '').replace('&lt;/p&gt;', '')\n", "step...
[ 0, 1, 2 ]
#!/usr/bin/env python # -*-coding:utf-8-*- __author__ = '李晓波' from linux import sysinfo #调用相应收集处理函数 def LinuxSysInfo(): #print __file__ return sysinfo.collect() def WindowsSysInfo(): from windows import sysinfo as win_sysinfo return win_sysinfo.collect()
normal
{ "blob_id": "30a2e4aa88b286179e2870205e90fab4a7474e12", "index": 2969, "step-1": "<mask token>\n\n\ndef LinuxSysInfo():\n return sysinfo.collect()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef LinuxSysInfo():\n return sysinfo.collect()\n\n\ndef WindowsSysInfo():\n from windows import sysinfo ...
[ 1, 2, 3, 4, 5 ]
#Testing Operating System Descriptions #OS : LMDE 4 Debbie #Version: 4.6.7 #Kernal Version : 4.19.0-8-amd64 #Scripting Langages : Python3 #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...
normal
{ "blob_id": "422491852b80c2fc4a2e73c01fd01acaad4cf9c8", "index": 7573, "step-1": "<mask token>\n", "step-2": "<mask token>\nregr.fit(X_train, y_train)\nprint(regr.score(X_test, y_test))\n<mask token>\nprint('Mean Absolute Error:', metrics.mean_absolute_error(y_test, y_pred))\nprint('Mean Squared Error:', metri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in num: div = 0 while i > 0: if i % 2 == 0: i //= 2 div += 1 else: i -= 1 plus_cnt += 1 div_max = max(div_max, div) print(plus_cnt + div_max) <|re...
flexible
{ "blob_id": "9247896850e5282265cd08240f6f505e675ce5f0", "index": 5904, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in num:\n div = 0\n while i > 0:\n if i % 2 == 0:\n i //= 2\n div += 1\n else:\n i -= 1\n plus_cnt += 1\n div_max ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while months > 0: minimumMonPayment = monthlyPaymentRate * balance monthlyUnpaidBalan = balance - monthlyPaymentRate balance = monthlyUnpaidBalan + monthlyInterestRate * monthlyUnpaidBalan months -= 1 print('Remain...
flexible
{ "blob_id": "299b437c007d78c3d9a53205de96f04d2c6118e0", "index": 7662, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile months > 0:\n minimumMonPayment = monthlyPaymentRate * balance\n monthlyUnpaidBalan = balance - monthlyPaymentRate\n balance = monthlyUnpaidBalan + monthlyInterestRate * mo...
[ 0, 1, 2, 3 ]