code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ DIM Station Test ~~~~~~~~~~~~~~~~ Unit test for DIM Station """ import unittest from dimp import ID, NetworkID class StationTestCase(unittest.TestCase): def test_identifier(self): print('\n---------------- %s' % self) str1 = 'gsp...
normal
{ "blob_id": "533d0b883a0bbbb148f04826e4c0a2bcc31732e9", "index": 6702, "step-1": "<mask token>\n\n\nclass StationTestCase(unittest.TestCase):\n\n def test_identifier(self):\n print('\\n---------------- %s' % self)\n str1 = 'gsp-s001@x77uVYBT1G48CLzW9iwe2dr5jhUNEM772G'\n id1 = ID(str1)\n ...
[ 3, 4, 5, 6, 7 ]
""" \tSeja bem-vindo ao Admirável Mundo Novo! \tO objetivo do jogo é dar suporte ao desenvolvimento de Agentes Inteligentes que utilizam Deep Reinforcement Learning \tpara tarefas de Processamento de Linguagem Natural em língua portuguesa. \tAutor: Gabriel Pontes (@ograndoptimist) """ import random fr...
normal
{ "blob_id": "38ffbb6a66837e975a611a57579bb365ab69a32c", "index": 9504, "step-1": "<mask token>\n\n\nclass AdmiravelMundoNovo(object):\n <mask token>\n <mask token>\n\n def transicao_estado(self, acao):\n if self._valor_estado == 2 and acao == 0:\n self._estado_6()\n elif self._v...
[ 18, 21, 23, 25, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Content-Type:text/html\n\n') print( """ <html> <head> <link href="iconTech.png" rel="icon"/> <meta name="viewport" content="width=device-width,intial-scale=1.0"/> <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="...
flexible
{ "blob_id": "968cfcfe9d31adcd3a67a88a66e5ebe7b719be8d", "index": 2841, "step-1": "<mask token>\n", "step-2": "print('Content-Type:text/html\\n\\n')\nprint(\n \"\"\"\n<html>\n<head>\n<link href=\"iconTech.png\" rel=\"icon\"/>\n<meta name=\"viewport\" content=\"width=device-width,intial-scale=1.0\"/>\n<link h...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Carafe(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Carafe(object): def __init__(self): self.level = CarafeLevel() self.temp = CarafeTe...
flexible
{ "blob_id": "a0cce8d48f929dd63ba809a1e9bf02b172e8bc1b", "index": 2192, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Carafe(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Carafe(object):\n\n def __init__(self):\n self.level = CarafeLevel()\n self.temp = Ca...
[ 0, 1, 2, 3, 4 ]
#-------------------------------------------------------- # File------------project2.py # Developer-------Paige Weber # Course----------CS1213-03 # Project---------Project #1 # Due-------------September 26, 2017 # # This program uses Gregory-Leibniz series to compute # an approximate value of pi. #---------------------...
normal
{ "blob_id": "466148395a4141793b5f92c84513fd093876db76", "index": 9964, "step-1": "<mask token>\n", "step-2": "<mask token>\nif number_of_terms >= 1:\n add_approximation = 0\n for count in range(1, number_of_terms):\n approximation = (-1) ** (count + 1) / (2 * count - 1)\n add_approximation ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(PROJ_DIR) <|reserved_special_token_1|> <|reserved_special_token_0|> PROJ_DIR = os.path.dirname(os.path.dirname(__file__)) sys.path.append(PROJ_DIR) <|reserved_special_token_1|> import sys import os PROJ_DIR =...
flexible
{ "blob_id": "54276074d84e63e6418f8738bb7f910424f1c94d", "index": 9469, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(PROJ_DIR)\n", "step-3": "<mask token>\nPROJ_DIR = os.path.dirname(os.path.dirname(__file__))\nsys.path.append(PROJ_DIR)\n", "step-4": "import sys\nimport os\nPROJ_DIR ...
[ 0, 1, 2, 3 ]
import imp from django.shortcuts import render # ***************** API **************** from django.views.decorators.csrf import csrf_exempt from rest_framework.parsers import JSONParser,FileUploadParser,MultiPartParser,FormParser from .models import * from django.http import Http404 from .serializers import * from re...
normal
{ "blob_id": "aec5280869a780bbd93ef24b659d9959f7b81426", "index": 3545, "step-1": "<mask token>\n\n\nclass AddBlogs(generics.CreateAPIView):\n permission_classes = IsSuperUser,\n serializer_class = BlogSerializer\n queryset = BlogModel.objects.all()\n\n\nclass ViewBlog(generics.ListAPIView):\n permiss...
[ 182, 186, 190, 206, 212 ]
numbers = [3,4,6,7] # 0 1 2 3 print(numbers) print(numbers[1]) print(numbers[-1]) numbers[1] = 3 print(numbers) del numbers[1] print(numbers) numbers.append(17) print(numbers) numbers.insert(2,5) print(numbers) numbers.sort() print(numbers)
normal
{ "blob_id": "34d3eebf6ccb19f891ccbb16db47cd6412f1cb0f", "index": 1155, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(numbers)\nprint(numbers[1])\nprint(numbers[-1])\n<mask token>\nprint(numbers)\ndel numbers[1]\nprint(numbers)\nnumbers.append(17)\nprint(numbers)\nnumbers.insert(2, 5)\nprint(number...
[ 0, 1, 2, 3 ]
class Solution(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ left= 0 #for right in range(len(s)-1, -1, -1): for right in reversed(range(len(s))): if s[right] == s[left]: left += 1 ...
normal
{ "blob_id": "4d18c056845403adc9c4b5848fafa06d0fe4ff4c", "index": 3165, "step-1": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution(object):\n\n def shortestPalindrome(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n left =...
[ 1, 2, 3, 4, 5 ]
from fastapi import APIRouter, Depends, HTTPException, status from sqlalchemy.orm import Session from typing import List from sqlalchemy.sql.functions import current_date, current_user from db.session import get_db from db.models.jobs import Job from schemas.jobs import JobCreate, ShowJob from db.repository.jobs impo...
normal
{ "blob_id": "e8092faed22607f9c8f18a79709022037ff647bf", "index": 9625, "step-1": "<mask token>\n\n\n@router.post('/create-job', response_model=ShowJob)\ndef create_job(job: JobCreate, db: Session=Depends(get_db), current_user:\n User=Depends(get_current_user_from_token)):\n owner_id = current_user.id\n ...
[ 4, 5, 6, 7, 8 ]
from flask_sqlalchemy import SQLAlchemy from sqlalchemy.orm import backref db = SQLAlchemy() def connect_db(app): """Connect to database.""" db.app = app db.init_app(app) """Models for Blogly.""" class User(db.Model): __tablename__= "users" id = db.Column(db.Integer, primary_key=True, autoincre...
normal
{ "blob_id": "9ae92d6ee4b82f7ed335c47d53567b817140a51c", "index": 8922, "step-1": "<mask token>\n\n\nclass User(db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True, autoincrement=True)\n first_name = db.Column(db.String(50), nullable=False)\n last_name = db.Column(db.Str...
[ 4, 5, 6, 7, 8 ]
import requests from bs4 import BeautifulSoup import urllib.request url = 'http://www.dytt8.net/' user = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36' } html = urllib.request.urlopen(url) html.encoding = 'utf-8' soup = Beauti...
normal
{ "blob_id": "2e571e3412bf9f3a42bf87976ea9a5ec68d5815c", "index": 9056, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in soup.find_all('a'):\n if 'href' in i.attrs:\n print(i.attrs['href'])\n", "step-3": "<mask token>\nurl = 'http://www.dytt8.net/'\nuser = {'User-Agent':\n 'Mozilla/5...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AggregationTypes(Enum): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cla...
flexible
{ "blob_id": "436b89b91aed14525f847e6488b452b7ca0e1b70", "index": 5322, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AggregationTypes(Enum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AggregationTypes(Enum):\n NO_AGG = 'N...
[ 0, 1, 2, 3 ]
N, D = map(int, input().split()) ans = 0 D2 = D*D for i in range(N): x, y = map(int, input().split()) if (x*x+y*y) <= D2: ans += 1 print(ans)
normal
{ "blob_id": "947055d1d6acc50e1722d79ea30e327414cd9c41", "index": 8523, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n x, y = map(int, input().split())\n if x * x + y * y <= D2:\n ans += 1\nprint(ans)\n", "step-3": "N, D = map(int, input().split())\nans = 0\nD2 = D * D\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): img = cv2.imread('test_image.png', 0) res = np.zeros((img.shape[0], img.shape[1], 3), np.uint8) thresh = cv2.threshold(img, 50, 255, 0)[1] _, contours, _ = cv2.findContours(thresh, cv2.RETR_TREE, cv2....
flexible
{ "blob_id": "1babf9f27e6792d2a1c2545a1e3bcd08fefa0975", "index": 5639, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n img = cv2.imread('test_image.png', 0)\n res = np.zeros((img.shape[0], img.shape[1], 3), np.uint8)\n thresh = cv2.threshold(img, 50, 255, 0)[1]\n _, contours,...
[ 0, 1, 2, 3, 4 ]
print(4 / 2, 4 / 3, 4 / 4) print(5 / 2, 5 / 3, 5 / 4) print(4 // 2, 4 // 3, 4 // 4) print(5 // 2, 5 // 3, 5 // 4) print(4.0 / 2, 4 / 3.0, 4.0 / float(4)) print(5.0 / 2, 5 / 3.0, 5.0 / float(4)) print(4.0 // 2, 4 // 3.0, 4.0 // float(4)) print(5.0 // 2, 5 // 3.0, 5.0 // float(4))
normal
{ "blob_id": "988e1f0631c434cbbb6d6e973792a65ebbd9405e", "index": 9474, "step-1": "<mask token>\n", "step-2": "print(4 / 2, 4 / 3, 4 / 4)\nprint(5 / 2, 5 / 3, 5 / 4)\nprint(4 // 2, 4 // 3, 4 // 4)\nprint(5 // 2, 5 // 3, 5 // 4)\nprint(4.0 / 2, 4 / 3.0, 4.0 / float(4))\nprint(5.0 / 2, 5 / 3.0, 5.0 / float(4))\np...
[ 0, 1 ]
from . import utility from . import regular_gram_schmidt as RGSC from . import custom_gram_schmidt as CGSC def RegularGramSchmidt(): while True: vectors = utility.get_matrix_from_user(5) if len(vectors) > 0: calc = RGSC.RegularGramSchmidt() result_matrix = calc.calc(vectors...
normal
{ "blob_id": "b6b3d94db62b47aac9bf78e8224a38ccff9335e3", "index": 7591, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef RegularGramSchmidt():\n while True:\n vectors = utility.get_matrix_from_user(5)\n if len(vectors) > 0:\n calc = RGSC.RegularGramSchmidt()\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python2.7 from __future__ import print_function, division import numpy as np import matplotlib import os #checks if there is a display to use. if os.environ.get('DISPLAY') is None: matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors as clr import dtk import sys import ti...
normal
{ "blob_id": "3acbb37809462ee69ff8792b4ad86b31dba5d630", "index": 3821, "step-1": "<mask token>\n\n\ndef load_clusters(file_name):\n if file_name not in load_clusters._cache:\n cluster_data = ClusterData()\n cluster_data.load_file(file_name)\n else:\n cluster_data = load_clusters._cache...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> @contextlib.contextmanager def dummy_context(*args, **kwargs): yield <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @contextlib.contextmanager def dummy_context(*args, **kwargs): yield if six.PY2: from collections import Mapping...
flexible
{ "blob_id": "1bdb19373960e4f63d80d6ab73ec3c0939e40b7f", "index": 364, "step-1": "<mask token>\n\n\n@contextlib.contextmanager\ndef dummy_context(*args, **kwargs):\n yield\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@contextlib.contextmanager\ndef dummy_context(*args, **kwargs):\n yield\n\n\nif six...
[ 1, 2, 3, 4, 5 ]
def solution(n): answer = [] for i in range(1,n+1): if n % i == 0: answer.append(i) return sum(answer) def solution2(n): return sum([i for i in range(1,n+1) if n % i == 0]) print(solution(12)) print(solution(5)) print(solution2(12)) print(solution2(5)) # n return # 12 28 # 5 6
normal
{ "blob_id": "7cfbc36cc6cd6ff7c30f02d979667448f2003546", "index": 9267, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution2(n):\n return sum([i for i in range(1, n + 1) if n % i == 0])\n\n\n<mask token>\n", "step-3": "def solution(n):\n answer = []\n for i in range(1, n + 1):\n ...
[ 0, 1, 2, 3, 4 ]
<|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 postorder_traversal(self, root: TreeNode): if not root: ...
flexible
{ "blob_id": "1d314a04625cfadf574f122b95577c1e677a8b35", "index": 3247, "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 postorder_traversal(self, root: TreeNode):\n if not root:\n ...
[ 0, 1, 2, 3, 4 ]
INPUT_MINBIAS = '/build/RAWReference/MinBias_RAW_320_STARTUP.root' INPUT_TTBAR = '/build/RAWReference/TTbar_RAW_320_STARTUP.root' puSTARTUP_TTBAR = '/build/RAWReference/TTbar_Tauola_PileUp_RAW_320_STARTUP.root' relval = { 'step1': { 'step': 'GEN-HLT', 'timesize': (100, ['MinBias','TTbar']), 'igprof': (50...
normal
{ "blob_id": "78c9f92349ba834bc64dc84f884638c4316a9ea4", "index": 352, "step-1": "<mask token>\n", "step-2": "INPUT_MINBIAS = '/build/RAWReference/MinBias_RAW_320_STARTUP.root'\nINPUT_TTBAR = '/build/RAWReference/TTbar_RAW_320_STARTUP.root'\npuSTARTUP_TTBAR = (\n '/build/RAWReference/TTbar_Tauola_PileUp_RAW_...
[ 0, 1, 2 ]
""" Type data Dictionary hanya sekedar menghubungkan KEY dan VALUE KVP = KEY VALUE PAIR """ kamus = {} kamus['anak'] = 'son' kamus['istri'] = 'wife' kamus['ayah'] = 'father' print(kamus) print(kamus['ayah']) print('\nData ini dikirimkan server gojek, memberikan info driver di sekitar pemakai aplikasi') data_server_g...
normal
{ "blob_id": "67b101df690bbe9629db2cabf0060c0f2aad9722", "index": 2389, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(kamus)\nprint(kamus['ayah'])\nprint(\n \"\"\"\nData ini dikirimkan server gojek, memberikan info driver di sekitar pemakai aplikasi\"\"\"\n )\n<mask token>\nprint(data_server_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class OitYitikuscrapyDataPipeline(object): def open_spider(self, spider): path = 'D:\\xiti10001\\data\\{}\\'.format(time.strftime('%Y%m%d', time.localtime())) isExists = os.path.exists(path) if isExists: pass else: o...
flexible
{ "blob_id": "315996a783d7b95fd87374a8fe2602a572de071e", "index": 3495, "step-1": "<mask token>\n\n\nclass OitYitikuscrapyDataPipeline(object):\n\n def open_spider(self, spider):\n path = 'D:\\\\xiti10001\\\\data\\\\{}\\\\'.format(time.strftime('%Y%m%d',\n time.localtime()))\n isExists...
[ 2, 3, 4, 5, 6 ]
from django.shortcuts import render from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponseNotAllowed from booli import booliwood from models import add_bosta, get_all_bostas, Bosta from django import forms import time class BostaForm(forms.Form): maxPrice = forms.IntegerField() livin...
normal
{ "blob_id": "53573a21364e9dfef9ed1164185ab441dbc29601", "index": 123, "step-1": "<mask token>\n\n\nclass BostaForm(forms.Form):\n maxPrice = forms.IntegerField()\n livingArea = forms.IntegerField()\n room = forms.IntegerField()\n\n\nclass BostaIdForm(forms.Form):\n bostaId = forms.IntegerField()\n\n\...
[ 6, 8, 9, 10, 11 ]
# -*- coding: utf-8 -*- """ # @Time : 2018/6/11 下午6:45 # @Author : zhanzecheng # @File : 542.01矩阵1.py # @Software: PyCharm """ # 一个简单的循环方式来解决这个问题 # 这一题的思路不错,用多次循环来计数 # TODO: check 1 class Solution: def updateMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: List[List[in...
normal
{ "blob_id": "1145050d82e614d5c248fc7e6a71720e6ff72414", "index": 6055, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def updateMatrix(self, matrix):\n \"\"\"\n :type matrix: Li...
[ 0, 1, 2, 3, 4 ]
import numpy import cv2 from keras.models import model_from_json from keras.layers import Dense from keras.utils import np_utils import os from keras.optimizers import SGD, Adam numpy.random.seed(42) file_json = open('model.json', "r") model_json = file_json.read() file_json.close() model = model_from_json(model_json)...
normal
{ "blob_id": "05021c3b39a0df07ca3d7d1c3ff9d47be6723131", "index": 4084, "step-1": "<mask token>\n", "step-2": "<mask token>\nnumpy.random.seed(42)\n<mask token>\nfile_json.close()\n<mask token>\nmodel.load_weights('weights.h5')\nprint('Model loaded')\n<mask token>\nmodel.compile(loss='categorical_crossentropy',...
[ 0, 1, 2, 3, 4 ]
import pytest from freezegun import freeze_time from datetime import datetime from khayyam import JalaliDatetime, TehranTimezone from dilami_calendar import DilamiDatetime, dilami_to_jalali def test_dilami_date(): gdate = datetime(2018, 2, 1) ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone) assert ...
normal
{ "blob_id": "7997efb00f24ecc5c4fbf3ca049eca6b5b178d53", "index": 4088, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_dilami_date():\n gdate = datetime(2018, 2, 1)\n ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone)\n assert ddate.year == 1591\n assert ddate.month == 6\n as...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2 on 2021-06-28 04:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rrhh', '0014_alter_detallepermiso_fecha_permiso'), ] operations = [ migrations.AlterField( model_name='permiso', name=...
normal
{ "blob_id": "5db450424dc143443839e24801ece444d0d7e162", "index": 3611, "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 = [('rrhh', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> def GetNext(self, pNode): def left_most(p): if p == None: ...
flexible
{ "blob_id": "57f8584a8d058e5f9d4e0b7b75c7ec8dbbfef24a", "index": 9681, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def GetNext(self, pNode):\n\n def left_most(p):\n if p == None:\n ...
[ 0, 1, 2, 3, 4 ]
import logging from .const import ( DOMAIN, CONF_SCREENS ) from typing import Any, Callable, Dict, Optional from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import ( ConfigType, DiscoveryInfoType, HomeAssistantType, ) from homeassistant.core import callback from home...
normal
{ "blob_id": "6f1b08a5ae1a07a30d89f3997461f4f97658f364", "index": 4920, "step-1": "<mask token>\n\n\nclass StateConverters:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DGUSScreen(Entity):\n\n def __init__(self, hass, screen):\n self._state = None\n self._hass = hass\n ...
[ 7, 10, 11, 13, 14 ]
<|reserved_special_token_0|> class CSV_Normalize: <|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": "ecbca04a58c19469e63ee2310e2b2f6b86c41199", "index": 1011, "step-1": "<mask token>\n\n\nclass CSV_Normalize:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask t...
[ 11, 12, 19, 21, 23 ]
#!/bin/python3 def solveMeFirst(a,b): return a + b print(solveMeFirst(int(input()),int(input())))
normal
{ "blob_id": "5d55c586c57de8f287d9f51f0cb1f188c8046c29", "index": 2977, "step-1": "<mask token>\n", "step-2": "def solveMeFirst(a, b):\n return a + b\n\n\n<mask token>\n", "step-3": "def solveMeFirst(a, b):\n return a + b\n\n\nprint(solveMeFirst(int(input()), int(input())))\n", "step-4": "#!/bin/pytho...
[ 0, 1, 2, 3 ]
from nbt import nbt from matplotlib import pyplot class Banana(object): id = 10 def srange(x1, xDoors, spaces): """ a counting thing that i dunno what does. """ for a in xrange(x1, x1 + xDoors): yield a for a in xrange(x1 + xDoors + spaces, x1 + spaces + xDoors * 2): yield a ...
normal
{ "blob_id": "4e9674ea46bdf930d1e99bcda56eaa300c84deef", "index": 7196, "step-1": "<mask token>\n\n\nclass Banana(object):\n id = 10\n\n\n<mask token>\n\n\ndef template_village_file(tick):\n \"\"\"\n Creates a template villages.dat file that i can modify later on\n \"\"\"\n cat = nbt.NBTFile()\n ...
[ 14, 15, 19, 21, 23 ]
#finding optimal betting strategy for the blackjack game using Monte Carlo ES method import random class Player(): def __init__(self) -> None: q = None policy = None returns = None cards = 0 dealer = 0 def hit(self): self.cards += random.randint(1,11) def d...
normal
{ "blob_id": "db159cfb198311b0369f65eb9e10947c4d28c695", "index": 2919, "step-1": "<mask token>\n\n\nclass Player:\n <mask token>\n\n def hit(self):\n self.cards += random.randint(1, 11)\n\n def deal(self):\n self.cards = random.randint(1, 11) + random.randint(1, 11)\n self.dealer = ...
[ 4, 5, 8, 9, 10 ]
<|reserved_special_token_0|> @register.resources() class Roles(object): <|reserved_special_token_0|> def role(self, req, resp, id): return obj(req, infinitystone_role, sql_id=id) def roles(self, req, resp): return sql_list(req, 'infinitystone_role', search={'id': str, 'name':...
flexible
{ "blob_id": "13e27c29839286988b37d2d3685f54d42fd57973", "index": 9773, "step-1": "<mask token>\n\n\n@register.resources()\nclass Roles(object):\n <mask token>\n\n def role(self, req, resp, id):\n return obj(req, infinitystone_role, sql_id=id)\n\n def roles(self, req, resp):\n return sql_li...
[ 3, 5, 6, 8, 9 ]
<|reserved_special_token_0|> def generate_grid(): """ Code that generates the grid """ y_offset = -10 for a in range(20): x_offset = 10 for b in range(1): y_offset += 20 for c in range(20): square(x_offset, y_offset, 20, 20, dark_green) for d in ...
flexible
{ "blob_id": "fbe091b1cf3ecc2f69d34e3b1c399314b38ebc4a", "index": 5656, "step-1": "<mask token>\n\n\ndef generate_grid():\n \"\"\" Code that generates the grid \"\"\"\n y_offset = -10\n for a in range(20):\n x_offset = 10\n for b in range(1):\n y_offset += 20\n for c in ra...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [re_path('^rest/', include( 'core_federated_search_app.rest.urls'))] <|reserved_special_token_1|> <|reserved_special_token_0|> from django.conf.urls import include from django.urls import re_path urlpatterns =...
flexible
{ "blob_id": "6903584b27c0720cebf42ed39968b18f0f67f796", "index": 6167, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [re_path('^rest/', include(\n 'core_federated_search_app.rest.urls'))]\n", "step-3": "<mask token>\nfrom django.conf.urls import include\nfrom django.urls import re_pat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def task1(): print('Task 1 is starting...') print('Task 1 is waiting to acquire Lock A') with lock_a: print('Task 1 has acquired Lock A') print('Task 1 is doing some calculations') time.sleep(2) print('Task 1 is waiting to acquire Lock B') ...
flexible
{ "blob_id": "c7d8a67587a6ca01c23ed922faabbaca8bbaf337", "index": 6307, "step-1": "<mask token>\n\n\ndef task1():\n print('Task 1 is starting...')\n print('Task 1 is waiting to acquire Lock A')\n with lock_a:\n print('Task 1 has acquired Lock A')\n print('Task 1 is doing some calculations')...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> def decision(statement, player): stdscr.clear() stdscr.border(0) stdscr.timeout(-1) decision = 'play again' if statement == 1 else 'return to main menu' stdscr.addstr(3, 5, 'Your Partner has decided to ' + decision) if statement == 1: stdscr.addstr(5, 10, '...
flexible
{ "blob_id": "a6f03340c2f60c061977fed6807703cdaeb1b7fd", "index": 7976, "step-1": "<mask token>\n\n\ndef decision(statement, player):\n stdscr.clear()\n stdscr.border(0)\n stdscr.timeout(-1)\n decision = 'play again' if statement == 1 else 'return to main menu'\n stdscr.addstr(3, 5, 'Your Partner h...
[ 4, 5, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('firstModel', FirstModelView.as_view())] <|reserved_special_token_1|> from django.urls import path from .views import FirstModelView urlpatterns = [path('firstModel', FirstModelView.as_view())]
flexible
{ "blob_id": "4efd22d132accd0f5945a0c911b73b67654b92e4", "index": 9358, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('firstModel', FirstModelView.as_view())]\n", "step-3": "from django.urls import path\nfrom .views import FirstModelView\nurlpatterns = [path('firstModel', FirstModel...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with tf.Session() as ss: ss.run(init) for step in range(201): ss.run(train) if step % 10 == 0: print(step, ss.run([k, b])) <|reserved_special_token_1|> <|reserved_special_token_0|> x_data = n...
flexible
{ "blob_id": "ba7f66a0f9cf1028add778315033d596e10d6f16", "index": 3197, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as ss:\n ss.run(init)\n for step in range(201):\n ss.run(train)\n if step % 10 == 0:\n print(step, ss.run([k, b]))\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
class Node: def __init__(self, value, next=None): self.value = value self.next = next def __str__(self): values = [] iter = self while iter != None: values.append(iter.value) iter = iter.next return ' -> '.join(values) @staticmethod ...
normal
{ "blob_id": "599310cfd05be28445535bc72251128ed72a9069", "index": 4372, "step-1": "class Node:\n\n def __init__(self, value, next=None):\n self.value = value\n self.next = next\n <mask token>\n\n @staticmethod\n def makelist(values):\n node = None\n for i in range(len(value...
[ 3, 4, 6, 7 ]
<|reserved_special_token_0|> def F(f): """Returns the test file on the "data" subdirectory""" return pkg_resources.resource_filename(__name__, os.path.join('data', f)) <|reserved_special_token_0|> def load_expected(filename): """Loads libsvm's svm-predict output file with probabilities""" all_labe...
flexible
{ "blob_id": "c24be05700e5ee043d09d6f2e78cb3de1e7088f1", "index": 6242, "step-1": "<mask token>\n\n\ndef F(f):\n \"\"\"Returns the test file on the \"data\" subdirectory\"\"\"\n return pkg_resources.resource_filename(__name__, os.path.join('data', f))\n\n\n<mask token>\n\n\ndef load_expected(filename):\n ...
[ 8, 9, 12, 13, 17 ]
from functools import reduce import confuse config = confuse.Configuration('SleepCycleWebhooks') config.set_file('config.yaml') def get(path): return reduce(lambda view, part: view[part], path.split('.'), config).get()
normal
{ "blob_id": "16879598a8b1a0b23c5ea6de18f8fb0b0b77201c", "index": 1360, "step-1": "<mask token>\n\n\ndef get(path):\n return reduce(lambda view, part: view[part], path.split('.'), config).get()\n", "step-2": "<mask token>\nconfig.set_file('config.yaml')\n\n\ndef get(path):\n return reduce(lambda view, par...
[ 1, 2, 3, 4 ]
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None ####################### # Iterative solution ####################### class Solution: def reverseList(self, head: ListNode) -> ListNode: if head is None: return h...
normal
{ "blob_id": "682495fec200ddad5a68f06bb0ec24e59036e66b", "index": 3286, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n\n\nclass Solution:\n\n def reverseList(self, head):\n prev = None\n while head:\n curr = head\n head = head.next\n ...
[ 6, 7, 8, 9, 11 ]
#!/usr/bin/env python import remctl import json import datetime import time,random import argparse if __name__ == '__main__': parser = argparse.ArgumentParser( description = "List all TCC Forge overlays" ) parser.add_argument( '-n', '--now', action = "store_false", default = True, dest = 'now', help ...
normal
{ "blob_id": "1ce34bfec6a9acfeaf0d5c5835ebebed4d7ee369", "index": 2056, "step-1": "#!/usr/bin/env python\n\nimport remctl\nimport json\nimport datetime\nimport time,random\nimport argparse\n\nif __name__ == '__main__':\n\tparser = argparse.ArgumentParser(\n\t\tdescription = \"List all TCC Forge overlays\"\n\t)\n\...
[ 0 ]
<|reserved_special_token_0|> class Writer: <|reserved_special_token_0|> @staticmethod def rep(string, find, replace): ex = find + '[^0-9]' while re.search(ex, string) is not None: res = re.search(ex, string) string = string[0:res.start()] + replace + ' ' + string[r...
flexible
{ "blob_id": "acd0b9019ef413699b47ecb2b66a0980cf3aa81f", "index": 9792, "step-1": "<mask token>\n\n\nclass Writer:\n <mask token>\n\n @staticmethod\n def rep(string, find, replace):\n ex = find + '[^0-9]'\n while re.search(ex, string) is not None:\n res = re.search(ex, string)\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import sys import ROOT from ROOT import TTree from ROOT import TChain import numpy as np import yaml import xml.etree.ElementTree as ET import datetime #sys.path.append("/disk/gamma/cta/store/takhsm/FermiMVA/AllSky") #sys.path.append("/home/takhsm/FermiMVA/python") ROOT.gROOT.SetBatch() from arra...
normal
{ "blob_id": "66cdeaa106a8f22dbfd64c12c4cb04fdb9f5b453", "index": 5160, "step-1": "#!/usr/bin/env python\n\nimport sys\nimport ROOT\nfrom ROOT import TTree\nfrom ROOT import TChain\nimport numpy as np\nimport yaml\nimport xml.etree.ElementTree as ET\nimport datetime\n#sys.path.append(\"/disk/gamma/cta/store/takhs...
[ 0 ]
import collections def solution(genres, plays): answer = [] cache = collections.defaultdict(list) # 장르 : [고유번호, 재생횟수] genre_order = collections.defaultdict(int) # 장르 : 전체재생횟수 order = collections.defaultdict() # 전체재생횟수 : 장르 # 첫번째 딕셔너리와 두번째 딕셔너리 생성 for i in range(len(genres)): cache[ge...
normal
{ "blob_id": "d56c80b4822b1bd0f2d4d816ed29a4da9d19a625", "index": 3040, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(genres, plays):\n answer = []\n cache = collections.defaultdict(list)\n genre_order = collections.defaultdict(int)\n order = collections.defaultdict()\n fo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def custom_exception_handler(exc, context): response = exception_handler(exc, context) if response is not None: response.data['status_code'] = response.status_code return response <|reserved_special_token_1...
flexible
{ "blob_id": "4e6e4917aee2385fe118d6e58c359a4c9fc50943", "index": 8617, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef custom_exception_handler(exc, context):\n response = exception_handler(exc, context)\n if response is not None:\n response.data['status_code'] = response.status_code\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Hour(object): def __init__(self): self.dayOfTheWeek = fake.day_of_week() self.openingTime = str(random.randint(1, 12)) + 'AM' self.closingTime = str(random.randint(1, 12)) + 'PM' <|reserved_special_token_1|> <|reserved_special_token_0|> fake.add_provi...
flexible
{ "blob_id": "e3386b01bb0bdc7064a2e3e9f3edce8a3231721b", "index": 3664, "step-1": "<mask token>\n\n\nclass Hour(object):\n\n def __init__(self):\n self.dayOfTheWeek = fake.day_of_week()\n self.openingTime = str(random.randint(1, 12)) + 'AM'\n self.closingTime = str(random.randint(1, 12)) +...
[ 2, 3, 4, 5 ]
import pickle class myPickle: def make(self, obj,fileName): print("myPickle make file",fileName) pickle.dump( obj, open(fileName,'wb') ) print(" DONE") def load(self, fileName): print("myPickle load file",fileName) tr = pickle.load( open(fileName,'rb') ...
normal
{ "blob_id": "e50feccd583d7e33877d5fcc377a1d79dc247d3a", "index": 3117, "step-1": "<mask token>\n\n\nclass myPickle:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass myPickle:\n\n def make(self, obj, fileName):\n print('myPickle make file', fileName)\n pickle.dump(obj,...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def Msort(left, right): if left + 1 < right: mid = int((left + right) / 2) Msort(left, mid) Msort(mid, right) merge(left, mid, right) def main(): global ans global A n = int(input()) A = list(map(int, input().split())) Msort(0, n) ...
flexible
{ "blob_id": "dc81ab808720c3a2c76174264c9be9bcdd99c292", "index": 1265, "step-1": "<mask token>\n\n\ndef Msort(left, right):\n if left + 1 < right:\n mid = int((left + right) / 2)\n Msort(left, mid)\n Msort(mid, right)\n merge(left, mid, right)\n\n\ndef main():\n global ans\n ...
[ 2, 3, 4, 5, 6 ]
"""4. Начните работу над проектом «Склад оргтехники». Создайте класс, описывающий склад. А также класс «Оргтехника», который будет базовым для классов-наследников. Эти классы — конкретные типы оргтехники (принтер, сканер, ксерокс). В базовом классе определить параметры, общие для приведенных типов. В классах-наследника...
normal
{ "blob_id": "03bc377bef1de7d512b7982a09c255af1d82fb7d", "index": 3905, "step-1": "<mask token>\n\n\nclass Whouse:\n <mask token>\n\n def get_tech_to_whouse(self, equip: Equipment):\n if self.total == self.max_volume:\n raise OverflowError('Склад заполнен!')\n self.storage[self.add_...
[ 9, 11, 12, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(y) plt.figure(figsize=(10, 1)) plt.bar(range(len(y)), y) plt.savefig('test.png') plt.clf() <|reserved_special_token_1|> <|reserved_special_token_0|> y = np.array([2, 2, 3, 4, 5]) print(y) plt.figure(figsize=(10, 1)) plt.b...
flexible
{ "blob_id": "2f714ed54a19ec26d7ecb1979e79366721b3d0fe", "index": 6682, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(y)\nplt.figure(figsize=(10, 1))\nplt.bar(range(len(y)), y)\nplt.savefig('test.png')\nplt.clf()\n", "step-3": "<mask token>\ny = np.array([2, 2, 3, 4, 5])\nprint(y)\nplt.figure(fig...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Sun Apr 29 15:10:34 2018 @author: nit_n """ from gaussxw import gaussxwab from numpy import linspace, arange from pylab import plot, show, xlabel, ylabel from math import pi, exp, sqrt k = 1.38065e-23 # joules/kelvin h = 6.626e-34 # joules lam1 = 390e-9 # meters ...
normal
{ "blob_id": "9b88a3976d522bdfd38502e29eefc1f1a0c29ed2", "index": 2884, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef n(T):\n k = 1.38065e-23\n c = 300000000.0\n N = 100\n a = h * c / (lam2 * k * T)\n b = h * c / (lam1 * k * T)\n x, w = gaussxwab(N, a, b)\n s = 0.0\n for k...
[ 0, 2, 3, 4, 5 ]
print('-'*100) print('BIENVENIDOS A TIENDA ELEGANCIA') print('-'*100) prendas = ('Remeras', 'Camisas', 'Pantalones', 'Faldas', 'Vestidos', 'Abrigos', 'Calzado') precioSinPromo = 0 superPuntos = 0 #ARTICULO 1 tipoPrenda1 = int(input('Ingrese Codigo de la prenda seleccionada: 0=Remeras, 1=Camisas, 2=Pantalones, 3=Fald...
normal
{ "blob_id": "333d237dd4a203fcfde3668901d725f16fbc402e", "index": 1684, "step-1": "<mask token>\n", "step-2": "print('-' * 100)\nprint('BIENVENIDOS A TIENDA ELEGANCIA')\nprint('-' * 100)\n<mask token>\nprint(prendaseleccionada1)\n<mask token>\nprint('La prenda: ', tipoPrenda1, 'participa de del plan SuperPuntos...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(jsondb_dir) <|reserved_special_token_1|> <|reserved_special_token_0|> root_dir = os.path.dirname(os.path.dirname(__file__)) jsondb_dir = os.path.join(root_dir, 'jsondb') sys.path.append(jsondb_dir) <|reserved_...
flexible
{ "blob_id": "eeb588a162fa222c0f70eb832a0026d0d8adbe9b", "index": 6769, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(jsondb_dir)\n", "step-3": "<mask token>\nroot_dir = os.path.dirname(os.path.dirname(__file__))\njsondb_dir = os.path.join(root_dir, 'jsondb')\nsys.path.append(jsondb_dir...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BBoxSelector: def __init__(self, bbox, zoom=8, resolution=10): center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2 self.map = Map(center=center, zoom=zoom, scroll_wheel_zoom=True) self.resolution = resolution control = DrawContr...
flexible
{ "blob_id": "0545aff80e19e47cb9e5b1941e92ff5cb109f9e6", "index": 1921, "step-1": "<mask token>\n\n\nclass BBoxSelector:\n\n def __init__(self, bbox, zoom=8, resolution=10):\n center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2\n self.map = Map(center=center, zoom=zoom, scroll_w...
[ 3, 4, 5, 6, 7 ]
def search_way(adjacency_list, points): use = [False for i in range(points.__len__())] way = [0 for i in range(points.__len__())] cost = [100000 for i in range(points.__len__())] cost[0] = 0 checkVar = 0 test = True while test: min = 100000 for i in range(points.__len__()): ...
normal
{ "blob_id": "1e4d21998b9f8915167166e5965b0c8c87fcf61d", "index": 3060, "step-1": "<mask token>\n", "step-2": "def search_way(adjacency_list, points):\n use = [(False) for i in range(points.__len__())]\n way = [(0) for i in range(points.__len__())]\n cost = [(100000) for i in range(points.__len__())]\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if A > B: print(A) elif B > A: print(B) else: print(AorB) <|reserved_special_token_1|> A, B = map(str, input().split()) if A > B: print(A) elif B > A: print(B) else: print(AorB) <|reserved_special_toke...
flexible
{ "blob_id": "8cbe78863de535a5b83eacebe67402569b4015fa", "index": 9189, "step-1": "<mask token>\n", "step-2": "<mask token>\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n print(AorB)\n", "step-3": "A, B = map(str, input().split())\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python2 from rpcz import compiler PROTO = '../index_server.proto' compiler.generate_proto(PROTO, '.') compiler.generate_proto( PROTO, '.', with_plugin='python_rpcz', suffix='_rpcz.py')
normal
{ "blob_id": "e868998833774c829b05ae8da3280bed61363be1", "index": 177, "step-1": "<mask token>\n", "step-2": "<mask token>\ncompiler.generate_proto(PROTO, '.')\ncompiler.generate_proto(PROTO, '.', with_plugin='python_rpcz', suffix=\n '_rpcz.py')\n", "step-3": "<mask token>\nPROTO = '../index_server.proto'\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> def minWindow(self, source, target): s_char_count...
flexible
{ "blob_id": "665a868ee71f247a621d82108e545257296e0427", "index": 7048, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n def minWindow(self, source, target):\n s_char_count = defaul...
[ 1, 3, 4, 5, 6 ]
import re text = "Python is an interpreted high-level general-purpose programming language." fiveWord = re.findall(r"\b\w{5}\b", text) print("Following are the words with five Letters:") for strWord in fiveWord: print(strWord)
normal
{ "blob_id": "aa15d51760c16181907994d329fb7ceede6a539b", "index": 5858, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Following are the words with five Letters:')\nfor strWord in fiveWord:\n print(strWord)\n", "step-3": "<mask token>\ntext = (\n 'Python is an interpreted high-level general...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import sys from static_pipeline import render from static_pipeline.lib import argparse if __name__ == "__main__": """ Use argparse to decide what to do """ # set up arg parsing parser = argparse.ArgumentParser( description='render and rearrange files ' \ ...
normal
{ "blob_id": "348676e43e4dfbbe7cd0c0527acb8c613d3d1ebc", "index": 6301, "step-1": "#!/usr/bin/env python\nimport sys\nfrom static_pipeline import render\nfrom static_pipeline.lib import argparse\n\nif __name__ == \"__main__\":\n \"\"\" Use argparse to decide what to do\n \"\"\"\n # set up arg parsing\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cli.run() <|reserved_special_token_1|> from . import cli cli.run()
flexible
{ "blob_id": "235623c3f557dbc28fbff855a618e4d26932ca65", "index": 7630, "step-1": "<mask token>\n", "step-2": "<mask token>\ncli.run()\n", "step-3": "from . import cli\ncli.run()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import os import pubmed_parser as pp nlpPath = "/Users/kapmayn/Desktop/nlp" articlesFolderPath = nlpPath + "/articles" abstractsFilePath = nlpPath + "/abstracts.txt" articlesFileNameList = os.listdir(articlesFolderPath) articlesFileNameList(reverse = True) resultFile = open(abstractsFilePath, 'w') for fileName in ar...
normal
{ "blob_id": "32f9b5c32acbb6411fe6ab99616d8459acfd7c74", "index": 719, "step-1": "<mask token>\n", "step-2": "<mask token>\narticlesFileNameList(reverse=True)\n<mask token>\nfor fileName in articlesFileNameList:\n print(fileName)\n dictOut = pp.parse_medline_xml(articlesFolderPath + '/' + fileName)\n f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if os.environ.get('HEROKU') is None: SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') SECRET_KEY = os.urandom(24) CONSUMER_KEY = '23571-333bb5dbab872eee6686bf86' TROVE_KEY = 'E767C55D-0941-4...
flexible
{ "blob_id": "0656aba517023c003e837d5ad04daeb364f7fda8", "index": 4688, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.environ.get('HEROKU') is None:\n SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')\n SECRET_KEY = os.urandom(24)\n CONSUMER_KEY = '23571-333bb5dbab87...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class YoutubeVerifier(base.SimpleVerifier): <|reserved_special_token_0|> <|reserved_special_token_0|> def get_follower_info(self): """ Get follower information from youtube api subscriptions :rtype: dict :return: follower info """ ...
flexible
{ "blob_id": "7ba2377b7d4f8d127cfee63c856d20753da9b7c6", "index": 4526, "step-1": "<mask token>\n\n\nclass YoutubeVerifier(base.SimpleVerifier):\n <mask token>\n <mask token>\n\n def get_follower_info(self):\n \"\"\"\n Get follower information from youtube api subscriptions\n\n :rtyp...
[ 2, 3, 4, 5, 6 ]
from flask import Flask from sim.toggle import ToggleSensor from sim.sensor import Sensor app = Flask(__name__) sensors = [ ToggleSensor(id="s-01", description="lampadina"), ToggleSensor(id="s-02", description="lampadina"), ToggleSensor(id="s-03", description="allarme atomico"), ToggleSensor(id="s-04...
normal
{ "blob_id": "2843845848747c723d670cd3a5fcb7127153ac7e", "index": 264, "step-1": "<mask token>\n\n\n@app.route('/<sensor_id>', methods=['GET'])\ndef sensor_details(sensor_id):\n sensor_pos = search_index_by_id(sensor_id)\n if sensor_pos >= 0:\n return {'sensor': sensors[sensor_pos]}\n else:\n ...
[ 2, 3, 4, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: name = str(input('Name: ')).capitalize().strip() grade1 = float(input('Grade 1: ')) grade2 = float(input('Grade 2: ')) avgrade = (grade1 + grade2) / 2 student.append([name, [grade1, grade2], avgrade...
flexible
{ "blob_id": "74028a7b317c02c90603ad24c1ddb35a1d5d0e9d", "index": 8678, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n name = str(input('Name: ')).capitalize().strip()\n grade1 = float(input('Grade 1: '))\n grade2 = float(input('Grade 2: '))\n avgrade = (grade1 + grade2) / 2\n ...
[ 0, 1, 2, 3 ]
"""Support for Bond covers.""" import asyncio import logging from typing import Any, Callable, Dict, List, Optional from bond import BOND_DEVICE_TYPE_MOTORIZED_SHADES, Bond from homeassistant.components.cover import DEVICE_CLASS_SHADE, CoverEntity from homeassistant.config_entries import ConfigEntry from homeassistan...
normal
{ "blob_id": "ba9d7b877eda3f7469db58e2ee194b601e3c3e08", "index": 4227, "step-1": "<mask token>\n\n\nclass BondCover(CoverEntity):\n <mask token>\n\n def __init__(self, bond: Bond, device: BondDevice):\n \"\"\"Create HA entity representing Bond cover.\"\"\"\n self._bond = bond\n self._d...
[ 10, 11, 12, 14, 15 ]
<|reserved_special_token_0|> def myFunk(): with open('users.csv', 'w') as fp: a = csv.writer(fp, delimiter=',') roles = ['inspector', 'admin'] data = [['Userneme', 'hash_password', 'role'], ['Olya', func_hash( 'Olya'), 'admin'], ['Stas', func_hash('Stas'), 'admin'], [ ...
flexible
{ "blob_id": "96d13a883590ca969e997bbb27bcdbee1b24252f", "index": 2730, "step-1": "<mask token>\n\n\ndef myFunk():\n with open('users.csv', 'w') as fp:\n a = csv.writer(fp, delimiter=',')\n roles = ['inspector', 'admin']\n data = [['Userneme', 'hash_password', 'role'], ['Olya', func_hash(\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def check_db_exists(opt): try: conn = psycopg2.connect(opt) cur = conn.cursor() cur.close() print('Database exists.') return True except: print("Database doesn't exist.") return False def create_db(opt): if check_db_exi...
flexible
{ "blob_id": "09792da1c3cc38c7df7def2b487c2078de4e8912", "index": 9514, "step-1": "<mask token>\n\n\ndef check_db_exists(opt):\n try:\n conn = psycopg2.connect(opt)\n cur = conn.cursor()\n cur.close()\n print('Database exists.')\n return True\n except:\n print(\"Dat...
[ 3, 4, 5, 6, 7 ]
def inplace_quick_sort(S, start, end): if start > end: return pivot = S[end] left = start right = end - 1 while left <= right: while left <= right and S[left] < pivot: left += 1 while left <= right and pivot < S[right]: right -= 1 if left <= ri...
normal
{ "blob_id": "2a09711e3e487c5d7790af592ff2eb03bb53cff2", "index": 5068, "step-1": "<mask token>\n", "step-2": "def inplace_quick_sort(S, start, end):\n if start > end:\n return\n pivot = S[end]\n left = start\n right = end - 1\n while left <= right:\n while left <= right and S[left]...
[ 0, 1, 2, 3 ]
from django.db import models # Create your models here. class Glo_EstadoPlan(models.Model): descripcion_estado = models.CharField(max_length=100) def __str__(self): return '{}'.format(self.descripcion_estado)
normal
{ "blob_id": "b0a51877b59e14eefdd662bac468e8ce12343e6b", "index": 3885, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Glo_EstadoPlan(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Glo_EstadoPlan(models.Model):\n descripcion_estado = models.CharFie...
[ 0, 1, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> articlesFileNameList(reverse=True) <|reserved_special_token_0|> for fileName in articlesFileNameList: print(fileName) dictOut = pp.parse_medline_xml(articlesFolderPath + '/' + fileName) for item in dictOut: res...
flexible
{ "blob_id": "32f9b5c32acbb6411fe6ab99616d8459acfd7c74", "index": 719, "step-1": "<mask token>\n", "step-2": "<mask token>\narticlesFileNameList(reverse=True)\n<mask token>\nfor fileName in articlesFileNameList:\n print(fileName)\n dictOut = pp.parse_medline_xml(articlesFolderPath + '/' + fileName)\n f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def generate_circular_path(radius, offset): theta = np.deg2rad(np.linspace(0, 360, 360)) x_data = radius * np.sin(theta) + offset[0] y_data = radius * np.cos(theta) + offset[1] radii = radius * np.ones((360,)) return x_data, y_data, radii <|reserved_special_token_0|>...
flexible
{ "blob_id": "e0541c377eb6631e4ef5eb79b1204612ce8af48c", "index": 6107, "step-1": "<mask token>\n\n\ndef generate_circular_path(radius, offset):\n theta = np.deg2rad(np.linspace(0, 360, 360))\n x_data = radius * np.sin(theta) + offset[0]\n y_data = radius * np.cos(theta) + offset[1]\n radii = radius *...
[ 3, 8, 9, 10, 11 ]
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.header import Header class SENDMAIL(object): def __init__(self): self.smtpserver = 'smtp.qq.com' self.username = 'wu_chang_hao@qq.com' # 比如QQ邮箱 self.password = 'xxxxxxxxx...
normal
{ "blob_id": "bcab83e0ae6ee4925393b50bdefdfeb85c42ad2c", "index": 1914, "step-1": "<mask token>\n\n\nclass SENDMAIL(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SENDMAIL(object):\n\n def __init__(self):\n self.smtpserver = 'smtp.qq.com'\n ...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 14 20:35:10 2020 @author: Johanna """ import numpy as np ############################################################################### # Complex Visibility Functions ############################################################################### ...
normal
{ "blob_id": "ea3217be80b6d1d3a400139bc4a91870cd2f1d87", "index": 5118, "step-1": "<mask token>\n\n\ndef compute_vis(X, F):\n vis = np.matmul(X, np.transpose(F)).astype(np.complex64)\n return vis\n\n\ndef compute_vis_grad(vis, Z, F):\n Z_vis = compute_vis(Z, F)\n grad = -np.matmul(np.conjugate(F.T), v...
[ 11, 13, 15, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): os.system( "notify-send 'Backup' 'NAS Backup Starting...' -i /usr/share/pixmaps/xarchiver/xarchiver-extract.png " ) os.system("sudo mount -o username='emre' //192.168.1.2/Samba /media/NAS") ...
flexible
{ "blob_id": "b6dd04219de1d4526d175254da539107362772d6", "index": 9229, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n os.system(\n \"notify-send 'Backup' 'NAS Backup Starting...' -i /usr/share/pixmaps/xarchiver/xarchiver-extract.png \"\n )\n os.system(\"sudo mount -o...
[ 0, 1, 2, 3, 4 ]
#! import os import sys #get current working directory cwd = os.getcwd() ovjtools = os.getenv('OVJ_TOOLS') javaBinDir = os.path.join(ovjtools, 'java', 'bin') # get the envirionment env = Environment(ENV = {'JAVA_HOME' : javaBinDir, 'PATH' : javaBinDir + ':' + os.environ['PATH']}) env.Execut...
normal
{ "blob_id": "549d7368d49cf2f4d2c6e83e300f31db981b62bd", "index": 6285, "step-1": "<mask token>\n", "step-2": "<mask token>\nenv.Execute('cd vjunit && make -f makevjunit')\nenv.Execute('cd VJQA/src && make -f makexmlcheck')\nExecute('rm -rf ovj_qa')\n<mask token>\nif not os.path.exists(path):\n os.makedirs(p...
[ 0, 1, 2, 3, 4 ]
class Leg: <|reserved_special_token_0|> <|reserved_special_token_0|> @property def smelly(self): return self.__smelly <|reserved_special_token_0|> def is_smelly(self): return self.__smelly <|reserved_special_token_1|> class Leg: <|reserved_special_token_0|> <|reserve...
flexible
{ "blob_id": "a4ecc578a163ee4657a2c9302f79f15c2e4e39de", "index": 672, "step-1": "class Leg:\n <mask token>\n <mask token>\n\n @property\n def smelly(self):\n return self.__smelly\n <mask token>\n\n def is_smelly(self):\n return self.__smelly\n", "step-2": "class Leg:\n <mask ...
[ 3, 4, 5, 6, 7 ]
from collections import defaultdict, Counter import numpy as np import sys import re def parseFile(file, frequency_tree): readnumber = re.compile('[r]+\d+') line_spliter = re.compile('\t+') colon_spliter = re.compile(':') forward_reads = 0 reverse_reads = 0 unmatched_reads = 0 read_position...
normal
{ "blob_id": "227b71cb6d4cde8f498ad19c1c5f95f7fc572752", "index": 6995, "step-1": "<mask token>\n\n\ndef getChromosome(str):\n if str == '*' or str[3:] == 'X':\n return -1\n try:\n return int(str[3:])\n except:\n return -1\n", "step-2": "<mask token>\n\n\ndef parseFile(file, freque...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class QualityPatch: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def getReleventPatches(self): relevent_patches = [] for i, coor in enumerate(self.p...
flexible
{ "blob_id": "0ad71f02e37f2744036b134c33e037a724fd38a6", "index": 8049, "step-1": "<mask token>\n\n\nclass QualityPatch:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def getReleventPatches(self):\n relevent_patches = []\n for i, coor in enumerate(s...
[ 3, 6, 7, 9, 10 ]
#!/usr/bin/env python3 # Created by: Khang Le # Created on: Dec 2019 # This program uses lists and rotation def rotation(list_of_number, ratating_time): numbers = list_of_number[0] numbers = [list_of_number[(i + ratating_time) % len(list_of_number)] for i, x in enumerate(list_of_number)] ...
normal
{ "blob_id": "74de0da708c7eb792dea15afb23713d9d71af520", "index": 5491, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n lst = []\n user_input = int(input('Enter number of elements : '))\n rotating_time = int(input('Enter how many times you want to rotate: '))\n print('The numb...
[ 0, 1, 2, 3, 4 ]
import os import unittest import tempfile from bpython import config TEST_THEME_PATH = os.path.join(os.path.dirname(__file__), "test.theme") class TestConfig(unittest.TestCase): def test_load_theme(self): struct = config.Struct() struct.color_scheme = dict() config.load_theme(struct, TEST...
normal
{ "blob_id": "d5efbbb6e818e797652f304f3d022e04be245778", "index": 4931, "step-1": "<mask token>\n\n\nclass TestConfig(unittest.TestCase):\n\n def test_load_theme(self):\n struct = config.Struct()\n struct.color_scheme = dict()\n config.load_theme(struct, TEST_THEME_PATH, struct.color_schem...
[ 2, 3, 4, 5, 6 ]
207. Course Schedule Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all courses? For example: 2, [[1,0]] There are a total of...
normal
{ "blob_id": "34aa08b9a5a89d3fca129271a9e812e2382ca88e", "index": 4196, "step-1": "207. Course Schedule \n\nSome courses may have prerequisites, for example to take course 0 you have to first take course 1, \nwhich is expressed as a pair: [0,1]\n\nGiven the total number of courses and a list of prerequisite pairs...
[ 0 ]
<|reserved_special_token_0|> class WbsAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Equipment_TypeAdmin(admin.ModelAdmin): list_display = 'type', list_filter = 'type', <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "292c66bd5b7f56ee8c27cabff01cd97ff36a79dc", "index": 8885, "step-1": "<mask token>\n\n\nclass WbsAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Equipment_TypeAdmin(admin.ModelAdmin):\n list_display = 'type',\n list_filter = 'type',\n\n\n<mask token>\n"...
[ 3, 4, 5, 6, 7 ]
''' 这部分理解参考: https://www.bilibili.com/video/BV1QA411H7tK?from=search&seid=17305042509580602672 图文代码地址: https://blog.csdn.net/qq_30758629/article/details/112527763 ''' import threading import time data=0 lock=threading.Lock() #创建一个锁对象 def func(): global data print("%s is acquire lock..\n" %threading.curr...
normal
{ "blob_id": "7aa426723f5311b5abec4a7ace9d3ec1e5e31d9a", "index": 5966, "step-1": "<mask token>\n\n\ndef func():\n global data\n print('%s is acquire lock..\\n' % threading.current_thread().getName())\n if lock.acquire():\n print('%s get lock ' % threading.current_thread().getName())\n data...
[ 1, 2, 3, 4, 5 ]
from flask import Flask,request,Response from spamapp.spam import SpamIdentify from json import dumps,loads app = Flask(__name__) spam = SpamIdentify() @app.route("/",methods=['GET']) def home(): return Response(response=dumps({"msg":"App successfull"}), status=200, mimetype='application/json') @app.route("/spam...
normal
{ "blob_id": "1552d862d3b9df45eda8c08256e8b4437ab08740", "index": 2641, "step-1": "<mask token>\n\n\n@app.route('/', methods=['GET'])\ndef home():\n return Response(response=dumps({'msg': 'App successfull'}), status=200,\n mimetype='application/json')\n\n\n@app.route('/spamapi/', methods=['GET', 'POST']...
[ 2, 3, 4, 5, 6 ]
import pygame from Actor import Actor import PlayerInput class TestActor(Actor): def __init__(self): super(TestActor, self).__init__() def act(self): self.key_commands() def key_commands(self): if PlayerInput.is_key_down(pygame.K_LEFT): self.set_location(self.x - 1, ...
normal
{ "blob_id": "9cb11c2bf032aa16abd3463ecdb8997addedc912", "index": 1570, "step-1": "<mask token>\n\n\nclass TestActor(Actor):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestActor(Actor):\n <mask token>\n\n def act(self):\n self.key_commands()\n <m...
[ 1, 2, 3, 4, 5 ]
import random from elment.login_registration_element import LoginRegistration from page.test_verification_code_page import VerificationCodeAction public_number_vip = ['17800000000','17800000001','17800000002','17800000003','17800000004','17800000005','17800000006', '17800000007','17800000008','1780000...
normal
{ "blob_id": "e5a698979bc84fe733a9bf5cd51e2f078956d468", "index": 2461, "step-1": "<mask token>\n\n\nclass LoginRegistrationAction(LoginRegistration):\n\n def check_welcome_xunyou(self):\n return self.welcome_xunyou().text\n <mask token>\n\n def logged_in_random(self):\n self.phone_id().sen...
[ 14, 18, 20, 25, 26 ]
<|reserved_special_token_0|> class HistoryListView(generics.GenericAPIView): <|reserved_special_token_0|> def post(self, request): serializer_class = self.serializer_class(data=request.data) serializer_class.is_valid(raise_exception=True) return Response(serializer_class.data, status=...
flexible
{ "blob_id": "8edca4c50e48734073e80de85088964837247696", "index": 2597, "step-1": "<mask token>\n\n\nclass HistoryListView(generics.GenericAPIView):\n <mask token>\n\n def post(self, request):\n serializer_class = self.serializer_class(data=request.data)\n serializer_class.is_valid(raise_excep...
[ 8, 9, 11, 12 ]
# -*- coding: utf-8 -*- """ Created on Fri Oct 23 15:26:47 2015 @author: tomhope """ import cPickle as pickle from nltk.tokenize import word_tokenize from sklearn.feature_extraction.text import CountVectorizer import re def tokenize_speeches(text): text = re.sub('[\[\]<>\'\+\=\/(.?\",&*!_#:;@$%|)0-9]'," ", text) ...
normal
{ "blob_id": "17548459b83fe4dea29f20dc5f91196b2b86ea60", "index": 4655, "step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Oct 23 15:26:47 2015\n\n@author: tomhope\n\"\"\"\nimport cPickle as pickle\nfrom nltk.tokenize import word_tokenize\nfrom sklearn.feature_extraction.text import CountVectorizer\nimpor...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ if len(s) == 0: return '...
flexible
{ "blob_id": "7c39b3927bc0702818c54875785b4657c20c441e", "index": 2272, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def longestPalindrome(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n ...
[ 0, 1, 2, 3 ]
import socket import threading server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) port = 12321 server.bind(('', port)) server.listen() client_names = [] clients = [] def broadcast(message): for client in clients: client.send(message) def handle(client): while True: try: ...
normal
{ "blob_id": "f1fbbbe4258d0fb0a43505f4718730934fd595ec", "index": 1831, "step-1": "<mask token>\n\n\ndef broadcast(message):\n for client in clients:\n client.send(message)\n\n\ndef handle(client):\n while True:\n try:\n message = client.recv(1024)\n broadcast(message)\n ...
[ 3, 4, 5, 6, 7 ]
lc_headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15", "authority": "leetcode.com", } lc_all = "https://leetcode.com/api/problems/all/" lc_submissions = "https://leetcode.com/api/submissions/?off...
normal
{ "blob_id": "f715628da2f1b950b8fbf8aa5b033e5299d3e224", "index": 7857, "step-1": "<mask token>\n", "step-2": "lc_headers = {'User-Agent':\n 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15'\n , 'authority': 'leetcode.com'}\nlc_all = 'http...
[ 0, 1, 2 ]
<|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": "1330addd53c6187a41dfea6957bf47aaecca1135", "index": 7180, "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 = [('regions', '...
[ 0, 1, 2, 3, 4 ]