code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import sys import pysolr import requests import logging import json import datetime from urlparse import urlparse from django.conf import settings from django.utils.html import strip_tags from aggregator.utils import mercator_to_llbbox def get_date(layer): """ Returns a date for Solr. A date can be detected...
normal
{ "blob_id": "6eb59f62a1623f308e0eda4e616be4177a421179", "index": 2254, "step-1": "import sys\nimport pysolr\nimport requests\nimport logging\nimport json\nimport datetime\n\nfrom urlparse import urlparse\nfrom django.conf import settings\nfrom django.utils.html import strip_tags\n\nfrom aggregator.utils import m...
[ 0 ]
<|reserved_special_token_0|> def stacked_vertical(): total = Totals.get_or_insert('total') if len(total.shirts) == 0: shirts = sorted(T_Shirts, key=lambda shirt: shirt[0]) for shirt in shirts: total.shirts.append(shirt[0]) total.votes.append(0) votes = [] shirts...
flexible
{ "blob_id": "d8c9e1098dde9d61341ebc3c55eada5592f4b71a", "index": 2891, "step-1": "<mask token>\n\n\ndef stacked_vertical():\n total = Totals.get_or_insert('total')\n if len(total.shirts) == 0:\n shirts = sorted(T_Shirts, key=lambda shirt: shirt[0])\n for shirt in shirts:\n total.sh...
[ 4, 5, 6, 7, 8 ]
<|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 = [m...
flexible
{ "blob_id": "ab5400f4b44a53cb5cc2f6394bcdb8f55fd218f0", "index": 1813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
import random import string import steembase import struct import steem from time import sleep from time import time from steem.transactionbuilder import TransactionBuilder from steembase import operations from steembase.transactions import SignedTransaction from resultthread import MyThread from charm.toolbox.pairingg...
normal
{ "blob_id": "a90b7e44cc54d4f96a13e5e6e2d15b632d3c4983", "index": 290, "step-1": "<mask token>\n\n\nclass GroupSignature:\n\n def __init__(self, groupObj):\n global util, group\n util = SecretUtil(groupObj, debug)\n self.group = groupObj\n\n def pkGen(self, h1str):\n gstr = (\n ...
[ 10, 19, 22, 24, 31 ]
from dataloaders.datasets import caltech, embedding from torch.utils.data import DataLoader def make_data_loader(args, **kwargs): if args.dataset == 'caltech101': train_set = caltech.caltech101Classification(args, split='train') val_set = caltech.caltech101Classification(args, split='val') test_set = caltech.c...
normal
{ "blob_id": "1ea71f7b17809189eeacf19a6b7c4c7d88a5022c", "index": 1070, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef make_id2class(args):\n if args.dataset == 'caltech101':\n return caltech.id2class\n", "step-3": "<mask token>\n\n\ndef make_data_loader(args, **kwargs):\n if args.d...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def cos_two_terms(x): s = 0 a = 1 s = s + a a = -a * x ** 2 / ((2 * 0 + 1) * (2 * 0 + 2)) s = s + a a = -a * x ** 2 / ((2 * 1 + 1) * (2 * 1 + 2)) s = s + a a = -a * x ** 2 / ((2 * 2 + 1) * (2 * 2 + 2)) return s, abs(a) def test_cos_Taylor(): x = 0...
flexible
{ "blob_id": "fb0dcb641dfb379751264dc0b18007f5d058d379", "index": 3520, "step-1": "<mask token>\n\n\ndef cos_two_terms(x):\n s = 0\n a = 1\n s = s + a\n a = -a * x ** 2 / ((2 * 0 + 1) * (2 * 0 + 2))\n s = s + a\n a = -a * x ** 2 / ((2 * 1 + 1) * (2 * 1 + 2))\n s = s + a\n a = -a * x ** 2 /...
[ 2, 4, 5, 6, 7 ]
from src import npyscreen from src.MainForm import MainForm from src.ContactsForm import ContactsForm from src.SendFileForm import SendFileForm from src.MessageInfoForm import MessageInfoForm from src.ForwardMessageForm import ForwardMessageForm from src.RemoveMessageForm import RemoveMessageForm class App(npyscreen....
normal
{ "blob_id": "dc2c429bae10ee14737583a3726eff8fde8306c7", "index": 6940, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass App(npyscreen.StandardApp):\n\n def onStart(self):\n self.MainForm = self.addFor...
[ 0, 1, 2, 3, 4 ]
default_app_config = 'child.apps.ChildConfig'
normal
{ "blob_id": "290f96bb210a21183fe1e0e53219ad38ba889625", "index": 1602, "step-1": "<mask token>\n", "step-2": "default_app_config = 'child.apps.ChildConfig'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def is_wall(r, c): if r < 0 or r >= n or c < 0 or c >= n: return True return False def find(r, c, cnt): Q = [] Q.append((r, c)) visited[r][c] = 1 while Q: tr, tc = Q.pop(0) mine_cnt = 0 for i in range(8): nr = tr + dr[i...
flexible
{ "blob_id": "8bce394c651931304f59bbca3e2f019212be9fc1", "index": 4620, "step-1": "<mask token>\n\n\ndef is_wall(r, c):\n if r < 0 or r >= n or c < 0 or c >= n:\n return True\n return False\n\n\ndef find(r, c, cnt):\n Q = []\n Q.append((r, c))\n visited[r][c] = 1\n while Q:\n tr, t...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class AdvertisementStatus(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Authors(models.Model): name = models.CharField(max_length=20, db_index=True, verbose_name='ФИО') email = models.EmailField() phone = mo...
flexible
{ "blob_id": "c5bdbcc8ba38b02e5e5cf8b53362e87ba761443d", "index": 8654, "step-1": "<mask token>\n\n\nclass AdvertisementStatus(models.Model):\n name = models.CharField(max_length=100)\n\n def __str__(self):\n return self.name\n\n\nclass Authors(models.Model):\n name = models.CharField(max_length=2...
[ 6, 7, 8, 10, 11 ]
################## #Drawing Generic Rest of Board/ ################## def drawBoard(canvas,data): canvas.create_rectangle(10,10,data.width-10,data.height-10, fill = "dark green") canvas.create_rectangle(187, 160, 200, 550, fill = "white") canvas.create_rectangle(187, 160, 561, 173, fill = "white") can...
normal
{ "blob_id": "628e625be86053988cbaa3ddfe55f0538136e24d", "index": 3599, "step-1": "<mask token>\n", "step-2": "def drawBoard(canvas, data):\n canvas.create_rectangle(10, 10, data.width - 10, data.height - 10, fill\n ='dark green')\n canvas.create_rectangle(187, 160, 200, 550, fill='white')\n can...
[ 0, 1, 2, 3 ]
import boto3 from time import sleep cfn = boto3.client('cloudformation') try: # Get base stack outputs. stack_id = cfn.describe_stacks(StackName='MinecraftInstance')['Stacks'][0]['StackId'] cfn.delete_stack(StackName=stack_id) print(f"Deleting Stack: {stack_id}") except Exception as e: print('Some...
normal
{ "blob_id": "b3fb210bcdec2ed552c37c6221c1f0f0419d7469", "index": 8478, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n stack_id = cfn.describe_stacks(StackName='MinecraftInstance')['Stacks'][0][\n 'StackId']\n cfn.delete_stack(StackName=stack_id)\n print(f'Deleting Stack: {stack_id}...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ListingCustomFieldsGet(Service): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ListingCustomFieldsGet(Service): <|reserved_special_token_0|> def reply(self): solr_fields = {} ...
flexible
{ "blob_id": "ab352c9431fda19bc21a9f7ffa075303641cca45", "index": 155, "step-1": "<mask token>\n\n\nclass ListingCustomFieldsGet(Service):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ListingCustomFieldsGet(Service):\n <mask token>\n\n def reply(self):\n solr_fields = ...
[ 1, 2, 3, 5, 6 ]
from datetime import datetime import requests as req import smtplib import mysql.connector #mysql constant MYSQL_HOST='den1.mysql6.gear.host' MYSQL_USER='winlabiot' MYSQL_PW='winlabiot+123' MYSQL_DB="winlabiot" Coffee_mailing_list_table='coffee_mailing_list' #keys in dict receive via socket TIME='time' AMBIENT_TEM...
normal
{ "blob_id": "5488b32970a0b734334835457c712768a756de7f", "index": 859, "step-1": "from datetime import datetime\nimport requests as req\n\nimport smtplib\n\nimport mysql.connector\n\n#mysql constant\nMYSQL_HOST='den1.mysql6.gear.host'\nMYSQL_USER='winlabiot'\nMYSQL_PW='winlabiot+123'\nMYSQL_DB=\"winlabiot\"\nCoff...
[ 0 ]
#Tom Healy #Adapted from Chris Albon https://chrisalbon.com/machine_learning/linear_regression/linear_regression_using_scikit-learn/ #Load the libraries we will need #This is just to play round with Linear regression more that anything else from sklearn.linear_model import LinearRegression from sklearn.datasets import ...
normal
{ "blob_id": "0f257d199ad0285d8619647434451841144af66d", "index": 9379, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings(action='ignore', module='scipy', message=\n '^internal gelsd')\n<mask token>\nmodel.intercept_\nprint(model.intercept_)\nmodel.coef_\nprint(model.coef_)\n", "...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def li(): return list(map(int, stdin.readline().split())) def mp(): return map(int, stdin.readline().split()) <|reserved_special_token_0|> def pr(n): return stdout.write(str(n) + '\n') <|reserved_special_token_0|> def solve(): def check(n): temp = n ...
flexible
{ "blob_id": "9cd1cb84c457db64019fa542efcf6500aa8d6d42", "index": 9275, "step-1": "<mask token>\n\n\ndef li():\n return list(map(int, stdin.readline().split()))\n\n\ndef mp():\n return map(int, stdin.readline().split())\n\n\n<mask token>\n\n\ndef pr(n):\n return stdout.write(str(n) + '\\n')\n\n\n<mask to...
[ 4, 7, 8, 9, 10 ]
from rest_framework import serializers from users.models import bills, Userinfo class billsSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = bills fields = ('bname', 'bamount', 'duedate', 'user_id') class UserinfoSerializer(serializers.HyperlinkedModelSerializer): class ...
normal
{ "blob_id": "124ece8f2f4ecc53d19657e2463cc608befb1ce7", "index": 3722, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserinfoSerializer(serializers.HyperlinkedModelSerializer):\n\n\n class Meta:\n model = Userinfo\n fields = ('fname', 'lname', 'address', 'city', 'state', 'zipc...
[ 0, 1, 2, 3, 4 ]
from django.db import models from private_storage.fields import PrivateFileField class PrivateFile(models.Model): title = models.CharField("Title", max_length=200) file = PrivateFileField("File") class PrivateFile2(models.Model): title = models.CharField("Title", max_length=200) file = models.FileFi...
normal
{ "blob_id": "e12c397ca1ae91ce314cda5fe2cd8e0ec4cfa861", "index": 2199, "step-1": "<mask token>\n\n\nclass PrivateFile2(models.Model):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PrivateFile(models.Model):\n <mask token>\n <mask token>\n\n\nclass PrivateFile2(models.Model):\...
[ 1, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from tensorflow.python.ops.image_ops_impl import ResizeMethod import sflow.core as tf from sflow.core import layer import numpy as np # region arg helper def _kernel_shape(nd, k, indim, outdim): if isinstance(k, int): k = [k for _ in range(nd)] k = list(k) assert len(k) =...
normal
{ "blob_id": "940c3b4a2b96907644c0f12deddd8aba4086a0f0", "index": 5131, "step-1": "<mask token>\n\n\ndef _kernel_shape(nd, k, indim, outdim):\n if isinstance(k, int):\n k = [k for _ in range(nd)]\n k = list(k)\n assert len(k) == nd\n k.extend([indim, outdim])\n return k\n\n\n<mask token>\n\n...
[ 22, 26, 29, 32, 39 ]
<|reserved_special_token_0|> def test_main_cnv(): main_cnv(tarfile) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append('../circos_report/cnv_anno2conf') <|reserved_special_token_0|> def test_main_cnv(): main_cnv(tarfile) if __name__ == '__main__': ...
flexible
{ "blob_id": "3c0beb7be29953ca2d7b390627305f4541b56efa", "index": 69, "step-1": "<mask token>\n\n\ndef test_main_cnv():\n main_cnv(tarfile)\n\n\n<mask token>\n", "step-2": "<mask token>\nsys.path.append('../circos_report/cnv_anno2conf')\n<mask token>\n\n\ndef test_main_cnv():\n main_cnv(tarfile)\n\n\nif _...
[ 1, 2, 3, 4, 5 ]
from djitellopy import Tello import time import threading import pandas as pd class DataTello: def __init__(self): # Inicia objeto de controle do Tello self.tello = Tello() # Array onde será armazenado a lista de dados coletado pelo Tello self.__data = [] self....
normal
{ "blob_id": "9e751bbddabbec7c5e997578d99ef1b8c35efe06", "index": 8108, "step-1": "<mask token>\n\n\nclass DataTello:\n\n def __init__(self):\n self.tello = Tello()\n self.__data = []\n self.__array = []\n self.tempoVoo = 420000\n \"\"\"\n ___Padrão para nome dos arqui...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class MztspiderSpider(CrawlSpider): <|reserved_special_token_0|> <|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 MztspiderSpider(Cra...
flexible
{ "blob_id": "a1ce43c3f64667619c4964bc4dc67215d3ecc1a0", "index": 9215, "step-1": "<mask token>\n\n\nclass MztspiderSpider(CrawlSpider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MztspiderSpider(CrawlSpider):\n <mask token...
[ 1, 2, 3, 4, 5 ]
import numpy as np from global_module.implementation_module import Autoencoder from global_module.implementation_module import Reader import tensorflow as tf from global_module.settings_module import ParamsClass, Directory, Dictionary import random import sys import time class Test: def __init__(self): se...
normal
{ "blob_id": "e008f9b11a9b7480e9fb53391870809d6dea5497", "index": 3953, "step-1": "<mask token>\n\n\nclass Test:\n\n def __init__(self):\n self.iter_test = 0\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Test:\n\n def __init__(self):\n self.iter_test = 0\n\n d...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: ret, frame = cap.read() if ret: print('Decoded frame') cv2.imwrite('fr_' + str(count) + '.png', frame) count += 1 else: print("Couldn't decoded frame") <|reserved_special_t...
flexible
{ "blob_id": "40ac3292befa2354878927ada0e10c24368a9d73", "index": 2643, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, frame = cap.read()\n if ret:\n print('Decoded frame')\n cv2.imwrite('fr_' + str(count) + '.png', frame)\n count += 1\n else:\n prin...
[ 0, 1, 2, 3, 4 ]
# 효율적인 해킹 # https://www.acmicpc.net/problem/1325 from collections import deque import sys input = sys.stdin.readline n, m = map(int, input().split()) graph = [[] for _ in range(n + 1)] for _ in range(m): a, b = map(int, input().split()) graph[b].append(a) # B를 해킹하면 A도 해킹할 수 있다 def bfs(start): visited =...
normal
{ "blob_id": "8a631adc8d919fb1dded27177818c4cb30148e94", "index": 610, "step-1": "<mask token>\n\n\ndef bfs(start):\n visited = [False] * (n + 1)\n visited[start] = True\n q = deque()\n q.append(start)\n cnt = 1\n while q:\n now = q.popleft()\n for i in graph[now]:\n if ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Mish(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> def forward(self, input): """ Forward pass of the function. """ return Func.mish(input, inplace=self.inplace) <|reserved_special_token_1|> <|reserved_special_to...
flexible
{ "blob_id": "2deb73c7d2588ea1a5b16eb1ed617583d41f0130", "index": 2846, "step-1": "<mask token>\n\n\nclass Mish(nn.Module):\n <mask token>\n <mask token>\n\n def forward(self, input):\n \"\"\"\n Forward pass of the function.\n \"\"\"\n return Func.mish(input, inplace=self.inpl...
[ 2, 3, 4, 5, 6 ]
from typing import Type from sqlalchemy.exc import IntegrityError from src.main.interface import RouteInterface as Route from src.presenters.helpers import HttpRequest, HttpResponse from src.presenters.errors import HttpErrors def flask_adapter(request: any, api_route: Type[Route]) -> any: """Adapter pattern for ...
normal
{ "blob_id": "3212bb7df990ad7d075b8ca49a99e1072eab2a90", "index": 595, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef flask_adapter(request: any, api_route: Type[Route]) ->any:\n \"\"\"Adapter pattern for Flask\n :param - Flask Request\n :api_route: Composite Routes\n \"\"\"\n try:\...
[ 0, 1, 2, 3 ]
from pyspark.sql.types import StructType, StructField, StringType, TimestampType, IntegerType from main.config.spark_config import SparkConfiguration import main.config.constants as Constants from main.connectors.kafka_connector import KafkaConnector, extract_json_data def main(): # Configure Spark Session co...
normal
{ "blob_id": "23099b29fb5898c2556d1612690e33860662ca35", "index": 9846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n config = {'spark.jars.packages':\n 'io.delta:delta-core_2.12:0.8.0,org.postgresql:postgresql:9.4.1211,org.apache.spark:spark-streaming-kafka-0-10_2.12:3.0.0,or...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def positive_words(scrape_results_df): def text_process(text): nopunc = [char for char in text if char not in string.punctuation] nopunc = ''.join(nopunc) return [word for word in nopunc.split() if word.lower() not in stopwords.words('english')] ...
flexible
{ "blob_id": "82f86284dddf48bf2c65ddf55eb6d7a372306373", "index": 7182, "step-1": "<mask token>\n\n\ndef positive_words(scrape_results_df):\n\n def text_process(text):\n nopunc = [char for char in text if char not in string.punctuation]\n nopunc = ''.join(nopunc)\n return [word for word in...
[ 2, 3, 4, 5, 6 ]
from tkinter import * from tkinter import filedialog from tkinter import scrolledtext import tkinter as tk import os import sys import subprocess import shlex from subprocess import check_output import pathlib
normal
{ "blob_id": "11576597429e119cf4887a88139df4a9e6d7eb66", "index": 1409, "step-1": "<mask token>\n", "step-2": "from tkinter import *\nfrom tkinter import filedialog\nfrom tkinter import scrolledtext\nimport tkinter as tk\nimport os\nimport sys\nimport subprocess\nimport shlex\nfrom subprocess import check_outpu...
[ 0, 1 ]
#Purpose: find the bonds, angles in Zr/GPTMS .xyz outpuf file from simulation from Tkinter import Tk from tkFileDialog import askopenfilename Tk().withdraw() from pylab import * from scipy import * from numpy import * import numpy as np import math ##################################################################...
normal
{ "blob_id": "82abed3a60829eeabf6b9e8b791085d130ec3dd4", "index": 3086, "step-1": "#Purpose: find the bonds, angles in Zr/GPTMS .xyz outpuf file from simulation \n\nfrom Tkinter import Tk\nfrom tkFileDialog import askopenfilename\nTk().withdraw()\n\nfrom pylab import *\nfrom scipy import *\nfrom numpy import *\ni...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ResPartner(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ResPartner(models.Model): _inherit = 'res.partner' pu...
flexible
{ "blob_id": "f26b127b4d968c1a168a57825a5acfffbf027bef", "index": 3372, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ResPartner(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ResPartner(models.Model):\n _inherit = 'res.partner'\n purchase_type...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_second_long(time_str=None): if time_str is None: return long(time.time()) time_array = time.strptime(time_str, '%Y-%m-%d %H:%M:%S') return long(time.mktime(time_array)) <|reserved_special_token_0|> def get_curtimestamp(): return int(time.time() * 1000) ...
flexible
{ "blob_id": "e735529eddd3a46ea335e593e5937558b50b142d", "index": 2276, "step-1": "<mask token>\n\n\ndef get_second_long(time_str=None):\n if time_str is None:\n return long(time.time())\n time_array = time.strptime(time_str, '%Y-%m-%d %H:%M:%S')\n return long(time.mktime(time_array))\n\n\n<mask t...
[ 7, 9, 10, 11, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def threeNumberSum(array, targetSum): array.sort() triplet = [] for i in range(len(array) - 2): left = i + 1 right = len(array) - 1 while left < right: current_sum = array[i] + arr...
flexible
{ "blob_id": "240f5e9cbb38f319b6e03b1b7f9cae7655ac4385", "index": 5258, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef threeNumberSum(array, targetSum):\n array.sort()\n triplet = []\n for i in range(len(array) - 2):\n left = i + 1\n right = len(array) - 1\n while lef...
[ 0, 1, 2, 3, 4 ]
class Solution: def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [] result_set = [] letters = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', ...
normal
{ "blob_id": "aec311cae7cb6cbe3e3a927a133ec20a2d2afbf5", "index": 1312, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def letterCombinations(self, digits):\n \"\"\"\n :type digits: str\n :rtype: List[str]\n \"\"\"\n ...
[ 0, 1, 2 ]
import numpy as np import sys import os import os.path import json import optparse import time import pandas as pd #Randomize and split the inference set according to hor_pred #Generate .npy file for each hp selected #Coge valores aleatorios de la columna de etiquetas en función del horizonte de predicció...
normal
{ "blob_id": "83a92c0b645b9a2a483a01c19a47ab5c296ccbd9", "index": 6907, "step-1": "<mask token>\n\n\ndef addOptions(parser):\n parser.add_option('--NNfile', default='', help=\n 'Config json file for the data to pass to the model')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef addOptions(parse...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class QuotesByMonth: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class QuotesByRating: def __init__(self): self.chart = pygal.Histogram(title='Quotes by Rating', margin=20, show_legend=False, style=style) ...
flexible
{ "blob_id": "6f6f57ff317d7e3c6e6ae4d450c6fdf0e22eb4eb", "index": 7256, "step-1": "<mask token>\n\n\nclass QuotesByMonth:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass QuotesByRating:\n\n def __init__(self):\n self.chart = pygal.Histogram(title='Quotes by Rating', margin=20,\n ...
[ 9, 16, 20, 21, 23 ]
# -*- coding: utf-8 -*- """ :copyright: (c) 2014-2016 by Mike Taylor :license: MIT, see LICENSE for more details. Micropub Tools """ import requests from bs4 import BeautifulSoup, SoupStrainer try: # Python v3 from urllib.parse import urlparse, urljoin except ImportError: from urlparse import urlparse, urlj...
normal
{ "blob_id": "1bb82a24faed6079ec161d95eff22aa122295c13", "index": 3982, "step-1": "<mask token>\n\n\ndef setParser(htmlParser='html5lib'):\n global _html_parser\n _html_parser = htmlParser\n\n\ndef discoverEndpoint(domain, endpoint, content=None, look_in={'name':\n 'link'}, test_urls=True, validateCerts=...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class AttachmentTestCase(BaseTestCase): def set_up(self): BaseTestCase.set_up(self) self.init_data = dict(content='Important attachment content.', file_name='test_file1.txt', description='A test file.', size=14, author='user1', time=None) ...
flexible
{ "blob_id": "41681a80807800efc06b3912533d739dab2cd085", "index": 1999, "step-1": "<mask token>\n\n\nclass AttachmentTestCase(BaseTestCase):\n\n def set_up(self):\n BaseTestCase.set_up(self)\n self.init_data = dict(content='Important attachment content.',\n file_name='test_file1.txt', ...
[ 5, 10, 11, 12, 14 ]
class Node(object): def __init__(self, d, n=None): self.data = d self.next_node = n def get_data(self): return self.data def set_data(self, d): self.data = d def get_next(self): return self.next_node def set_next(self, n): self.next_node=n class...
normal
{ "blob_id": "de3e952ad43fe7e323e8f975a45bbd4eec7192db", "index": 3481, "step-1": "class Node(object):\n\n def __init__(self, d, n=None):\n self.data = d\n self.next_node = n\n\n def get_data(self):\n return self.data\n\n def set_data(self, d):\n self.data = d\n\n def get_n...
[ 0 ]
#!python3 import configparser parser = configparser.ConfigParser() parser.read("sim.conf") print(parser.get("config", "option1")) print(parser.get("config", "option2")) print(parser.get("config", "option3"))
normal
{ "blob_id": "cf5ab10ce743aa261867501e93f498022e5908fe", "index": 7360, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.read('sim.conf')\nprint(parser.get('config', 'option1'))\nprint(parser.get('config', 'option2'))\nprint(parser.get('config', 'option3'))\n", "step-3": "<mask token>\nparser = con...
[ 0, 1, 2, 3, 4 ]
"""storeproject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
normal
{ "blob_id": "4a8fa195a573f8001e55b099a8882fe71bcca233", "index": 8335, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouter.register('users', views.CategoryView)\n<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT\n )\n", "step-3": ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/') def show_home(): return render_template('index.html') @app.route('/addhost', methods=['GET', 'POST']) def hosts(): if request.method == 'POST': db = mongo_login() hosts_collection = db.hosts host = request.form.to_dict() hosts_coll...
flexible
{ "blob_id": "ad813216ba8162a7089340c677e47c3e656f7c95", "index": 6198, "step-1": "<mask token>\n\n\n@app.route('/')\ndef show_home():\n return render_template('index.html')\n\n\n@app.route('/addhost', methods=['GET', 'POST'])\ndef hosts():\n if request.method == 'POST':\n db = mongo_login()\n ...
[ 6, 7, 10, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(num1) print(num2) print(add) print(sub) print(mul) print(div) print(mod) print(exp) print(fd) <|reserved_special_token_1|> num1 = 101 num2 = 20 add = num1 + num2 sub = num1 - num2 mul = num1 * num2 div = num1 / num2 mod =...
flexible
{ "blob_id": "3ffbef142d8fb53b734567ebea874f9c59ff9a9e", "index": 1455, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(num1)\nprint(num2)\nprint(add)\nprint(sub)\nprint(mul)\nprint(div)\nprint(mod)\nprint(exp)\nprint(fd)\n", "step-3": "num1 = 101\nnum2 = 20\nadd = num1 + num2\nsub = num1 - num2\nm...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Graph: def __init__(self, V: int, W: int): self.V = V self.E = 0 self.adj = [] self.W = W for i in range(V): nears = [] self.adj.append(nears) def AddEdge(self, v: int, w: int): self.adj[v].append(w) ...
flexible
{ "blob_id": "b6d8a918659f733919fe3bb4be9037e36ad32386", "index": 272, "step-1": "<mask token>\n\n\nclass Graph:\n\n def __init__(self, V: int, W: int):\n self.V = V\n self.E = 0\n self.adj = []\n self.W = W\n for i in range(V):\n nears = []\n self.adj.a...
[ 14, 17, 18, 19, 24 ]
import bs4 from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup import pandas as pd import time from urllib.request import Request import requests import json import re import sys def compare(mystring): def usd_to_ngn(): print("Getting USD to NGN Rate") r...
normal
{ "blob_id": "d96038a715406388b4de4611391dee18fc559d5a", "index": 2693, "step-1": "<mask token>\n\n\ndef compare(mystring):\n\n def usd_to_ngn():\n print('Getting USD to NGN Rate')\n req = requests.get(\n 'http://free.currconv.com/api/v7/convert?q=USD_NGN&apiKey=5029a99b396929294f63'\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def broadcast(msg, prefix=''): """Broadcasts a message to all the clients.""" for sock in clients: sock.send(bytes(prefix, 'utf8') + msg) def broadcast_file(msg): for sock in clients: sock.send(msg) def private_message(address, message): message = '<pri...
flexible
{ "blob_id": "9f02313b6f91f83e3a8b4af8d9447b1d8f3558f6", "index": 4430, "step-1": "<mask token>\n\n\ndef broadcast(msg, prefix=''):\n \"\"\"Broadcasts a message to all the clients.\"\"\"\n for sock in clients:\n sock.send(bytes(prefix, 'utf8') + msg)\n\n\ndef broadcast_file(msg):\n for sock in cli...
[ 5, 6, 7, 8, 9 ]
#!/usr/bin/python # # Dividend! # import os import sys import urllib2 import math import numpy from pylab import * # # Dividend adjusted! ...
normal
{ "blob_id": "6454790c98b254edeead4e68ef7f5760c9105a57", "index": 433, "step-1": "#!/usr/bin/python\n#\n# Dividend!\n#\n\nimport os\nimport sys\nimport urllib2\nimport math\nimport numpy\nfrom pylab import *\n\n# ...
[ 0 ]
<|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": "e6884afaae15e903c62eecb3baec868548998080", "index": 2106, "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 = [('words', '00...
[ 0, 1, 2, 3, 4 ]
""" Problem statement: https://leetcode.com/problems/contains-duplicate-ii/description/ Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k. """ class Solution: def c...
normal
{ "blob_id": "33c241747062ab0d374082d2a8179335503fa212", "index": 3320, "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 containsNearbyDuplicate(self, nums, k):\n \"\"\" Time complexi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Sampler: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def standard_normal(cls, size=1): return list(itertools.islice(cls.randn_gen, size)) @classmethod def randn(cls): return next(cl...
flexible
{ "blob_id": "ddeff852e41b79fb71cea1e4dc71248ddef85d79", "index": 7033, "step-1": "<mask token>\n\n\nclass Sampler:\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def standard_normal(cls, size=1):\n return list(itertools.islice(cls.randn_gen, size))\n\n @classmethod\n ...
[ 4, 7, 9, 10 ]
import torch import util import numpy as np import argparse import losses args = argparse.Namespace() args.device = torch.device('cpu') args.num_mixtures = 20 args.init_mixture_logits = np.ones(args.num_mixtures) args.softmax_multiplier = 0.5 args.relaxed_one_hot = False args.temperature = None temp = np.arange(args....
normal
{ "blob_id": "8f558593e516aa4a769b7c5e1c95c8bc23a36420", "index": 1232, "step-1": "<mask token>\n\n\ndef get_grads_correct(seed):\n util.set_seed(seed)\n theta_grads_correct = []\n phi_grads_correct = []\n log_weight, log_q = losses.get_log_weight_and_log_q(generative_model,\n inference_network...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> def getSize(): x = driver.get_window_size()['width'] y = driver.get_window_size()['height'] return x, y <|reserved_special_token_0|> def swipeUp(t): l = getSize() x1 = int(l[0] * 0.5) y1 = int(l[1] * 0.75) y2 = int(l[1] * 0.25) driver.swipe(x1, y1, x1, ...
flexible
{ "blob_id": "6e614d1235a98ef496956001eef46b4447f0bf9b", "index": 4677, "step-1": "<mask token>\n\n\ndef getSize():\n x = driver.get_window_size()['width']\n y = driver.get_window_size()['height']\n return x, y\n\n\n<mask token>\n\n\ndef swipeUp(t):\n l = getSize()\n x1 = int(l[0] * 0.5)\n y1 = ...
[ 3, 4, 5, 6, 7 ]
import numpy as np from sklearn.decomposition import PCA import pandas as pd from numpy.testing import assert_array_almost_equal import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn import decomposition from sklearn import datasets def transform(x): if x == 'Kama': return 0 elif x =...
normal
{ "blob_id": "ef04e808a2a0e6570b28ef06784322e0b2ca1f8f", "index": 4774, "step-1": "<mask token>\n\n\ndef transform(x):\n if x == 'Kama':\n return 0\n elif x == 'Rosa':\n return 1\n else:\n return 2\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef transform(x):\n if x == 'K...
[ 1, 2, 3, 4, 5 ]
#coding=utf-8 i=1 s=0 while s<=8848: s=s+(2**i)*0.2*10**(-3) i=i+1 print '对折次数:',i
normal
{ "blob_id": "98a384392d0839ddf12f3374c05929bc5e32987b", "index": 9242, "step-1": "#coding=utf-8\ni=1\ns=0\nwhile s<=8848:\n\ts=s+(2**i)*0.2*10**(-3)\n\ti=i+1\nprint '对折次数:',i\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class UrlPath: <|reserved_special_token_0|> <|reserved_special_token_1|> class UrlPath: @staticmethod def combine(*args): result = '' for path in args: result += path if path.endswith('/') else '{}/'.format(path) ...
flexible
{ "blob_id": "aa579025cacd11486a101b2dc51b5ba4997bf84a", "index": 95, "step-1": "<mask token>\n", "step-2": "class UrlPath:\n <mask token>\n", "step-3": "class UrlPath:\n\n @staticmethod\n def combine(*args):\n result = ''\n for path in args:\n result += path if path.endswith...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generate(root: Dict): relations: List[Dict] = [] subj = DPHelper.get_subject(root) obj = DPHelper.get_object(root) if subj is not None and DPHelper.is_proper_noun(subj ) and obj is not None and DPHelp...
flexible
{ "blob_id": "5923a12378225fb6389e7e0275af6d4aa476fe87", "index": 1635, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate(root: Dict):\n relations: List[Dict] = []\n subj = DPHelper.get_subject(root)\n obj = DPHelper.get_object(root)\n if subj is not None and DPHelper.is_proper_n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def index(request): print(request.session) today = datetime.datetime.now() return render(request, 'index.html', {'today': today.strftime('%d-%m=%Y')}) def isFileOpen(request): stack = request.session['stack'] if stack > 0 and request.session.get('name' ) != N...
flexible
{ "blob_id": "3378ce72ae67d09258554048138b7f9023000922", "index": 6619, "step-1": "<mask token>\n\n\ndef index(request):\n print(request.session)\n today = datetime.datetime.now()\n return render(request, 'index.html', {'today': today.strftime('%d-%m=%Y')})\n\n\ndef isFileOpen(request):\n stack = requ...
[ 12, 14, 15, 17, 19 ]
# Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
normal
{ "blob_id": "e11c479a99ab68755de8ab565e3d360d557129cf", "index": 6036, "step-1": "# Copyright 2010 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://w...
[ 0 ]
print('-' * 60) print( 'Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...' ) print() age = input('What is your age today? ') age = int(age) if age >= 21: print('Cool, come on in.') else: print( 'Your gonna need to back up. This c...
normal
{ "blob_id": "19ffac718008c7c9279fb8cbc7608597d2d3e708", "index": 3937, "step-1": "<mask token>\n", "step-2": "print('-' * 60)\nprint(\n 'Welcome to CLUB425, the most lit club in downtown ACTvF. Before you can enter, I need you yo answer some question...'\n )\nprint()\n<mask token>\nif age >= 21:\n pri...
[ 0, 1, 2 ]
def solution(num): if num < 10: num = str(num) + str(0) else: num = str(num) cycle_val = 0 new_num = "" temp_num = num[:] while new_num != num: sum_num = int(temp_num[0]) + int(temp_num[1]) new_num = temp_num[-1] + str(int(temp_num[0]) + int(tem...
normal
{ "blob_id": "cec772f1e470aae501aa7c638ec4cbb565848804", "index": 9258, "step-1": "<mask token>\n", "step-2": "def solution(num):\n if num < 10:\n num = str(num) + str(0)\n else:\n num = str(num)\n cycle_val = 0\n new_num = ''\n temp_num = num[:]\n while new_num != num:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class fake_logger(object): def __init__(self): self.msg = None def info(self, msg, *args): pass def warn(self, msg, *args): self.msg = msg.reason class TestRequestData(object): def test_read_url(self, monkeypatch): monkeypatch.setattr(...
flexible
{ "blob_id": "2bbfbc597a4e1f8b46f58a4c6002a9943eff557a", "index": 5644, "step-1": "<mask token>\n\n\nclass fake_logger(object):\n\n def __init__(self):\n self.msg = None\n\n def info(self, msg, *args):\n pass\n\n def warn(self, msg, *args):\n self.msg = msg.reason\n\n\nclass TestRequ...
[ 7, 9, 10, 12, 14 ]
# This file is used to run a program to perform Active measuremnts import commands import SocketServer import sys #Class to handle Socket request class Handler(SocketServer.BaseRequestHandler): def handle(self): # Get the IP of the client IP = self.request.recv(1024) #print 'IP=' + IP ...
normal
{ "blob_id": "c853f922d1e4369df9816d150e5c0abc729b325c", "index": 4902, "step-1": "# This file is used to run a program to perform Active measuremnts\n\n\nimport commands\nimport SocketServer\nimport sys\n\n#Class to handle Socket request\nclass Handler(SocketServer.BaseRequestHandler):\n\n def handle(self):\n...
[ 0 ]
<|reserved_special_token_0|> class ConnectionManager: <|reserved_special_token_0|> def handle(self, msg): if msg['type'] in {'register', 'heartbeat'}: self.store.reg_hb(**msg['payload']) elif msg['type'] == 'result': self.store.result(msg['payload']) return 'se...
flexible
{ "blob_id": "03b38e6e2d0097d5d361b0794aba83b8e430323d", "index": 4370, "step-1": "<mask token>\n\n\nclass ConnectionManager:\n <mask token>\n\n def handle(self, msg):\n if msg['type'] in {'register', 'heartbeat'}:\n self.store.reg_hb(**msg['payload'])\n elif msg['type'] == 'result'...
[ 3, 4, 7, 8, 10 ]
import tensorflow as tf import numpy as np import tensorflow_datasets as tfds print(tf.__version__) imdb, info = tfds.load("imdb_reviews", with_info=True, as_supervised=True) train_data = imdb['train'] test_data = imdb['test'] # 25000 in each set training_sentences = [] training_labels = [] testing_sentences = [] ...
normal
{ "blob_id": "921c45af3ba34a1b12657bf4189fc8dd66fa44a6", "index": 3860, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(tf.__version__)\n<mask token>\nfor s, l in train_data:\n training_sentences.append(str(s.numpy()))\n training_labels.append(l.numpy())\nfor s, l in test_data:\n testing_sen...
[ 0, 1, 2, 3, 4 ]
<|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": "a7d7408808f28343a51ff6522c5e14747c8c6e43", "index": 9819, "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 = [('s1app', '00...
[ 0, 1, 2, 3, 4 ]
import cv2, os, fitz, shutil import numpy as np from PIL import Image from pytesseract import pytesseract from PIL import UnidentifiedImageError pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe' config = r'--oem 3 --psm' # Возвращает путь к картинке, созданной на основе 1 ...
normal
{ "blob_id": "84980b8923fa25664833f810a906d27531145141", "index": 1066, "step-1": "<mask token>\n\n\ndef pdf_to_png(filename):\n doc = fitz.open('pdf_files\\\\{}'.format(filename))\n zoom = 4\n page = doc.loadPage(0)\n mat = fitz.Matrix(zoom, zoom)\n pix = page.getPixmap(matrix=mat)\n new_filena...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class FileBlobstore: <|reserved_special_token_0|> def _csum_to_name(self, csum): """Return string name of link relative to root""" return _checksum_to_path(csum) <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "4fb1ece28cd7c6e2ac3a479dcbf81ee09ba14223", "index": 3096, "step-1": "<mask token>\n\n\nclass FileBlobstore:\n <mask token>\n\n def _csum_to_name(self, csum):\n \"\"\"Return string name of link relative to root\"\"\"\n return _checksum_to_path(csum)\n <mask token>\n <mask to...
[ 8, 12, 16, 20, 27 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(c + a * y * y / b) <|reserved_special_token_1|> a, b, c, y = 4.4, 0.0, 4.2, 3.0 print(c + a * y * y / b)
flexible
{ "blob_id": "2c43ede960febfb273f1c70c75816848768db4e5", "index": 6599, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(c + a * y * y / b)\n", "step-3": "a, b, c, y = 4.4, 0.0, 4.2, 3.0\nprint(c + a * y * y / b)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Profile(models.Model): <|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 Profile(models.Model): user = models.OneToOneField(User...
flexible
{ "blob_id": "3e7df9a733c94b89d22d10883844c438444d5e2c", "index": 8010, "step-1": "<mask token>\n\n\nclass Profile(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Profile(models.Model):\n user = models.OneToOneField(User, on_delete...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def obj_rec(obj, t, flag=0, acc=''): v_obj = type(obj) r = '' if type(obj) not in [dict, list, map]: ref_url = re.findall('\\((http.*?)\\)', obj) ref_title = re.findall('\\[[^\\[\\]]*\\]', obj) if ref_url: url = ref_url[len(ref_url) - 1].str...
flexible
{ "blob_id": "739921a6a09edbb81b442f4127215746c601a69a", "index": 4990, "step-1": "<mask token>\n\n\ndef obj_rec(obj, t, flag=0, acc=''):\n v_obj = type(obj)\n r = ''\n if type(obj) not in [dict, list, map]:\n ref_url = re.findall('\\\\((http.*?)\\\\)', obj)\n ref_title = re.findall('\\\\[[...
[ 1, 2, 3, 4, 5 ]
""" We have created mash sketches of the GPDB database, the MGV database, and the SDSU phage, and this will figure out the top hits and summarize their familes. """ import os import sys import argparse def best_hits(distf, maxscore, verbose=False): """ Find the best hits """ bh = {} allph = set()...
normal
{ "blob_id": "22523304c9e2ce1339a7527cdbd67a81c780d806", "index": 1090, "step-1": "<mask token>\n\n\ndef best_hits(distf, maxscore, verbose=False):\n \"\"\"\n Find the best hits\n \"\"\"\n bh = {}\n allph = set()\n with open(distf, 'r') as din:\n for li in din:\n p = li.strip()...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def test_app_models(): assert models.ComponentsApp.allowed_subpage_models() == [models. ComponentsApp, models.BannerComponent] <|reserved_special_token_0|> @pytest.mark.django_db def test_set_slug(en_locale): instance = models.ComponentsApp.objects.create(title_en_gb='...
flexible
{ "blob_id": "b1622aa65422fcb69a16ad48a26fd9ed05b10382", "index": 8882, "step-1": "<mask token>\n\n\ndef test_app_models():\n assert models.ComponentsApp.allowed_subpage_models() == [models.\n ComponentsApp, models.BannerComponent]\n\n\n<mask token>\n\n\n@pytest.mark.django_db\ndef test_set_slug(en_loca...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python # # Author: Johnson Kachikaran (johnsoncharles26@gmail.com) # Date: 7th August 2016 # Google Drive API: # https://developers.google.com/drive/v3/reference/ # https://developers.google.com/resources/api-libraries/documentation/drive/v3/python/latest/ """ Includes functions to integrate with a u...
normal
{ "blob_id": "033719313f92aaf3c62eb1b07a9aa08f13c7bb6e", "index": 2600, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_metadata(file_id, user_settings=None):\n \"\"\"\n Obtains the metadata of a file\n\n :param str file_id: the identifier of the file whose metadata is needed\n :par...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from mathgraph3D.core.plot import * from mathgraph3D.core.functions import *
flexible
{ "blob_id": "b58cc08f8f10220373fa78f5d7249bc883b447bf", "index": 6991, "step-1": "<mask token>\n", "step-2": "from mathgraph3D.core.plot import *\nfrom mathgraph3D.core.functions import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from pyNastran.bdf.fieldWriter import print_card from pyNastran.bdf.bdfInterface.assign_type import (integer, integer_or_blank, double_or_blank, string_or_blank) class NLPARM(object): """ Defines a set of parameters for nonlinear static analysis iteration strategy. +--------+--------+------+-----...
normal
{ "blob_id": "7701a98d836dc9551a4e2eb4b7d9c10307b3f665", "index": 1411, "step-1": "<mask token>\n\n\nclass NLPARM(object):\n <mask token>\n <mask token>\n\n def __init__(self):\n pass\n\n def add(self, card=None, comment=''):\n if comment:\n self._comment = comment\n se...
[ 6, 7, 8, 9, 10 ]
from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqldb://sql3354595:7Haz6Ng1fm@sql3.freemysqlhosting.net/sql3354595' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SECRET_KEY'] = 'mysecret' db = S...
normal
{ "blob_id": "d7240703bc4cf9b566e7b50a536c83497cd8c6d7", "index": 7116, "step-1": "<mask token>\n\n\nclass TipoUsuarios(db.Model):\n id = db.Column(db.Integer, primary_key=True, nullable=False)\n texto = db.Column(db.String(50))\n usuarios = db.relationship('Usuarios', backref='tipo', lazy='dynamic')\n\n...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(z.shape) print(x.shape) assert z.shape == x.shape <|reserved_special_token_1|> <|reserved_special_token_0|> x = np.random.random_sample(10 * 32 * 1024) w = windowed(x, n=1024, step=128) z = DisaggregationManager._overlap_...
flexible
{ "blob_id": "6d4950ca61cd1e2ee7ef8b409577e9df2d65addd", "index": 4462, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(z.shape)\nprint(x.shape)\nassert z.shape == x.shape\n", "step-3": "<mask token>\nx = np.random.random_sample(10 * 32 * 1024)\nw = windowed(x, n=1024, step=128)\nz = Disaggregation...
[ 0, 1, 2, 3 ]
def maior(a,b): if a > b: return a else: return b a = int(input("Digite o 1 valor: ")) b = int(input("Digite o 2 valor: ")) print(maior(a,b))
normal
{ "blob_id": "f4ca7f31000a1f649876b19ef937ece9958dd60f", "index": 5352, "step-1": "<mask token>\n", "step-2": "def maior(a, b):\n if a > b:\n return a\n else:\n return b\n\n\n<mask token>\n", "step-3": "def maior(a, b):\n if a > b:\n return a\n else:\n return b\n\n\n<ma...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('O valor inteiro é %d' % b) print('O valor decimal é %.6f' % c) <|reserved_special_token_1|> a = float(input('Digite um número:')) b = a - a % 1 c = a % 1 print('O valor inteiro é %d' % b) print('O valor decimal é %.6f' %...
flexible
{ "blob_id": "1b09b18926dc95d4c4b3088f45088f12c162ccb3", "index": 5465, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('O valor inteiro é %d' % b)\nprint('O valor decimal é %.6f' % c)\n", "step-3": "a = float(input('Digite um número:'))\nb = a - a % 1\nc = a % 1\nprint('O valor inteiro é %d' % b)\...
[ 0, 1, 2, 3 ]
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
normal
{ "blob_id": "2bf057621df3b860c8f677baf54673d2da8c2bd1", "index": 5804, "step-1": "<mask token>\n\n\nclass TestCOEClusters(base.TestCase):\n <mask token>\n\n def get_mock_url(self, service_type=\n 'container-infrastructure-management', base_url_append=None, append\n =None, resource=None):\n ...
[ 3, 5, 6, 7, 8 ]
#!/usr/bin/env python # encoding: utf-8 # -*- coding: utf-8 -*- # @contact: ybsdeyx@foxmail.com # @software: PyCharm # @time: 2019/3/6 9:59 # @author: Paulson●Wier # @file: 5_词向量.py # @desc: # (1)Word2Vec from gensim.models import Word2Vec import jieba # 定义停用词、标点符号 punctuation = ['、',')','(',',',",", "。", ":", ";",...
normal
{ "blob_id": "5c61ec549a3e78da4ea8a18bb4f8382f2b5c2cfa", "index": 4438, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('sentences:\\n', sentences)\n<mask token>\nfor sentence in sentences:\n words = []\n for word in sentence:\n if word not in punctuation:\n words.append(word)...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IssueTitleFactory(factory.Factory): """ ``issue`` must be provided """ FACTORY_FOR = models.IssueTitle language = factory.SubFactory(LanguageFactory) title = u'Bla' class IssueFactory(factory.Factory): FACTORY_FOR = models.Issue total_documents = 16...
flexible
{ "blob_id": "44d87f112ab60a202e4c8d64d7aec6f4f0d10578", "index": 31, "step-1": "<mask token>\n\n\nclass IssueTitleFactory(factory.Factory):\n \"\"\"\n ``issue`` must be provided\n \"\"\"\n FACTORY_FOR = models.IssueTitle\n language = factory.SubFactory(LanguageFactory)\n title = u'Bla'\n\n\ncla...
[ 22, 39, 42, 45, 47 ]
from django.apps import AppConfig class AutomationserverConfig(AppConfig): name = 'automationserver'
normal
{ "blob_id": "3153218fe1d67fdc1c1957ffcfdb380688c159c1", "index": 6483, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AutomationserverConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AutomationserverConfig(AppConfig):\n name = 'automationserver'\n", "step-4": "...
[ 0, 1, 2, 3 ]
from nltk.tokenize import RegexpTokenizer token = RegexpTokenizer(r'\w+') from nltk.corpus import stopwords # with open('microsoft.txt','r+',encoding="utf-8") as file: # text = file.read() # text = ''' # Huawei Technologies founder and CEO Ren Zhengfei said on Thursday the Chinese company is willing to license its...
normal
{ "blob_id": "aed6e1966d9e4ce7250ae3cacaf8854cab4b590c", "index": 3513, "step-1": "<mask token>\n\n\ndef word_freq_improved_summarize(text):\n sen = text.split('.')\n small = [s.lower() for s in sen]\n punc_free = []\n for p in small:\n punc_free.extend(token.tokenize(p))\n stop_words = set(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Logger: <|reserved_special_token_0|> def __init__(self, file_path, print_too=True, override=False): """Create a new Logger. Args: file_path: String, the full path to the target file. print_too: Bool, whether or not to also print logger i...
flexible
{ "blob_id": "1355c3abfd2683f6dc869703fdb79a04e264099c", "index": 3421, "step-1": "<mask token>\n\n\nclass Logger:\n <mask token>\n\n def __init__(self, file_path, print_too=True, override=False):\n \"\"\"Create a new Logger.\n\n Args:\n file_path: String, the full path to the target ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'ghou' from datetime import datetime bGameValid = True dAskUserInfo = {} gAccMode = 0 #============UserSyncResource2.py=================== #============前端资源热更白名单测试功能================ #============去读配置表config.xml================== #============大于配置标号的热更内容只有...
normal
{ "blob_id": "2e075c3ee6b245b1ffd0bb8c4e205199f794da76", "index": 5725, "step-1": "<mask token>\n", "step-2": "__author__ = 'ghou'\n<mask token>\nbGameValid = True\ndAskUserInfo = {}\ngAccMode = 0\ngWhiteTestResourceVersion = None\ngInvalidClientVersion = None\n", "step-3": "__author__ = 'ghou'\nfrom datetime...
[ 0, 1, 2, 3 ]
#Main thread for starting the gui import cv2 import PIL from PIL import Image,ImageTk from tkinter import * from matplotlib import pyplot as pt from matplotlib.image import imread from control.control import Control control=Control() #gives the indtruction for saving the current frame def takePicture(): global s...
normal
{ "blob_id": "8d8c211895fd43b1e2a38216693b0c00f6f76756", "index": 5748, "step-1": "<mask token>\n\n\ndef takePicture():\n global setImage\n setImage = True\n\n\ndef addRectangles(locations):\n _, axe = pt.subplots()\n img = imread('hola.jpg')\n cv2image = cv2.cvtColor(img, cv2.COLOR_BGR2RGBA)\n ...
[ 4, 5, 6, 7, 8 ]
from .simulator import SpatialSIRSimulator as Simulator from .util import Prior from .util import PriorExperiment from .util import Truth from .util import log_likelihood
normal
{ "blob_id": "4f06eddfac38574a0ae3bdd0ea2ac81291380166", "index": 9987, "step-1": "<mask token>\n", "step-2": "from .simulator import SpatialSIRSimulator as Simulator\nfrom .util import Prior\nfrom .util import PriorExperiment\nfrom .util import Truth\nfrom .util import log_likelihood\n", "step-3": null, "s...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> TEST_NAME = 'read_only' VM_NAME = '{0}_vm_%s'.format(TEST_NAME) VM_COUNT = 2 DISK_NAMES = dict() DISK_TIMEOUT = 600 SPARSE = True DIRECT_LUNS = UNUSED_LUNS DIRECT_LUN_ADDRESSES = UNUSED_LUN_ADDRESSES DIRECT_LUN_TARGETS = UNUSED_LU...
flexible
{ "blob_id": "ecdc8f5f76b92c3c9dcf2a12b3d9452166fcb706", "index": 1098, "step-1": "<mask token>\n", "step-2": "<mask token>\nTEST_NAME = 'read_only'\nVM_NAME = '{0}_vm_%s'.format(TEST_NAME)\nVM_COUNT = 2\nDISK_NAMES = dict()\nDISK_TIMEOUT = 600\nSPARSE = True\nDIRECT_LUNS = UNUSED_LUNS\nDIRECT_LUN_ADDRESSES = U...
[ 0, 1, 2, 3 ]
from django.shortcuts import render, get_object_or_404, redirect from django.utils import timezone from .models import Group,SQLlist from .forms import GroupForm from .oraConnect import * from .utils import IfNoneThenNull ########################### Группы ############################ def group_list(request): grou...
normal
{ "blob_id": "b9fe758d5fe12b5a15097c0e5a33cb2d57edfdd2", "index": 7484, "step-1": "<mask token>\n\n\ndef group_list(request):\n groups = Group.objects.all()\n return render(request, 'group_list.html', {'groups': groups})\n\n\n<mask token>\n\n\ndef group_add(request):\n if request.method == 'POST':\n ...
[ 4, 6, 8, 10, 11 ]
#Copyright 2008, Meka Robotics #All rights reserved. #http://mekabot.com #Redistribution and use in source and binary forms, with or without #modification, are permitted. #THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS #"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #LIMITED...
normal
{ "blob_id": "b227f222569761493f50f9dfee32f21e0e0a5cd6", "index": 4400, "step-1": "#Copyright 2008, Meka Robotics\n#All rights reserved.\n#http://mekabot.com\n\n#Redistribution and use in source and binary forms, with or without\n#modification, are permitted. \n\n\n#THIS SOFTWARE IS PROVIDED BY THE Copyright HOL...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> codecool_bp = CodecoolClass.create_local <|reserved_special_token_1|> from codecool_class import CodecoolClass from mentor import Mentor from student import Student codecool_bp = CodecoolClass.create_local
flexible
{ "blob_id": "7e985f55271c8b588abe54a07d20b89b2a29ff0d", "index": 8380, "step-1": "<mask token>\n", "step-2": "<mask token>\ncodecool_bp = CodecoolClass.create_local\n", "step-3": "from codecool_class import CodecoolClass\nfrom mentor import Mentor\nfrom student import Student\ncodecool_bp = CodecoolClass.cre...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FaceTrigger(CascadeBase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FaceTrigger(CascadeBase): def build_network(self): net = lasagne.layers.batch_nor...
flexible
{ "blob_id": "1dd5c25cd3b7bc933ba0b63d9a42fdddc92b8531", "index": 8737, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FaceTrigger(CascadeBase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FaceTrigger(CascadeBase):\n\n def build_network(self):\n net = lasagne.layers.batc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> SetOption('num_jobs', 4) SetOption('implicit_cache', 1) <|reserved_special_token_0|> buildVariables.Add(PathVariable('QTDIR', 'Qt4 root directory', '/usr/share/qt4', PathVariable.PathIsDir)) buildVariables.Add(PathVariable('OG...
flexible
{ "blob_id": "595912753d778a0fa8332f0df00e06a9da5cde93", "index": 447, "step-1": "<mask token>\n", "step-2": "<mask token>\nSetOption('num_jobs', 4)\nSetOption('implicit_cache', 1)\n<mask token>\nbuildVariables.Add(PathVariable('QTDIR', 'Qt4 root directory',\n '/usr/share/qt4', PathVariable.PathIsDir))\nbuil...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def GUI(): app = HiCityGUI() app.mainloop() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def GUI(): app = HiCityGUI() app.mainloop() if __name__ == '__main__': ...
flexible
{ "blob_id": "dd96b7f73c07bf0c74e6ce4dbff1a9cc09729b72", "index": 7918, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\nif __name__ == '_...
[ 0, 1, 2, 3 ]
import json from jsonargparse import ArgumentParser, ActionConfigFile import yaml from typing import List, Dict import glob import os import pathlib import pdb import subprocess import copy from io import StringIO from collections import defaultdict import torch from spacy.tokenizer import Tokenizer from spacy....
normal
{ "blob_id": "04aacf9461ade2e229076ffdf85aca913037edad", "index": 642, "step-1": "<mask token>\n\n\nclass NavigationTransformerTrainer(TransformerTrainer):\n\n def __init__(self, dataset_reader: NavigationDatasetReader, encoder:\n TransformerEncoder, optimizer: torch.optim.Optimizer, scheduler:\n ...
[ 10, 11, 12, 13, 15 ]
class NlpUtility(): """ Utility methods to get particular parts of speech from a token set """ def get_nouns(self, tokens): nouns = [] for word, pos in tokens: if pos == "NN": nouns.push(word) def get_verbs(self, tokens): verbs = [] for word, pos in tokens: if pos == "VB": nouns.push(word) ...
normal
{ "blob_id": "c6502ea2b32ad90c76b6dfaf3ee3218d029eba15", "index": 56, "step-1": "class NlpUtility:\n <mask token>\n\n def get_nouns(self, tokens):\n nouns = []\n for word, pos in tokens:\n if pos == 'NN':\n nouns.push(word)\n <mask token>\n <mask token>\n\n d...
[ 4, 5, 6, 7, 8 ]
from django.db.models.signals import post_save from django.dispatch import receiver from django.contrib.auth import get_user_model from .models import Profile User = get_user_model() # this wan't run on creating superuser @receiver(post_save, sender=User) def save_profile(sender, created, instance, **kwargs): if ...
normal
{ "blob_id": "4f93af104130f5a7c853ee0e7976fd52847e588a", "index": 4988, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@receiver(post_save, sender=User)\ndef save_profile(sender, created, instance, **kwargs):\n if created:\n profile = Profile.objects.create(user=instance)\n profile.sa...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def pattern4(n): """ n: length of the base of the triangle ie. the max number of starts it will contain. """ for row in range(1, n + 1): for col in range(1, row + 1): print('*', end='') print('') <|reserved_special_to...
flexible
{ "blob_id": "d77036ed07231719358658a42dc14d20453bd792", "index": 7563, "step-1": "<mask token>\n", "step-2": "def pattern4(n):\n \"\"\"\n\tn: length of the base of the triangle ie. the max number\n\t\tof starts it will contain.\n\t\"\"\"\n for row in range(1, n + 1):\n for col in range(1, row + 1)...
[ 0, 1, 2, 3 ]