code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> out.write('SEQUENCE_ID,TYPE,DOMAINS,TP,FP,FN,Sens,PPV,Jaccard\n') <|reserved_special_token_0|> for file in os.listdir(docpath + 'isoSegmenter100'): if file.endswith('.csv') and 'E' in file: predict_data = csv.DictReade...
flexible
{ "blob_id": "af2aa236f6bfc582093faf868a374be1ebdfabf2", "index": 1235, "step-1": "<mask token>\n", "step-2": "<mask token>\nout.write('SEQUENCE_ID,TYPE,DOMAINS,TP,FP,FN,Sens,PPV,Jaccard\\n')\n<mask token>\nfor file in os.listdir(docpath + 'isoSegmenter100'):\n if file.endswith('.csv') and 'E' in file:\n ...
[ 0, 1, 2, 3, 4 ]
import cv2 import numpy as np result=cv2.VideoCapture(0) while True: ret,square=result.read() area=square[100:200,100:200] cv2.imshow("video",square) cv2.imshow("video2",area) print(square) if cv2.waitKey(25) & 0xff == ord('q'): break result.release() cv2.destroyAllWindows()
normal
{ "blob_id": "934921b22d036bd611134ce74f6eba3a2710018e", "index": 529, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, square = result.read()\n area = square[100:200, 100:200]\n cv2.imshow('video', square)\n cv2.imshow('video2', area)\n print(square)\n if cv2.waitKey(25...
[ 0, 1, 2, 3, 4 ]
class Wspak: """Iterator zwracający wartości w odwróconym porządku""" def __init__(self, data): self.data = data self.index = -2 self.i=len(data)-1 def __iter__(self): return self def __next__(self): if self.index >= self.i: raise StopIteration ...
normal
{ "blob_id": "ea1d62c4a8c406dde9bb138ee045be5e682fdbfe", "index": 566, "step-1": "class Wspak:\n <mask token>\n\n def __init__(self, data):\n self.data = data\n self.index = -2\n self.i = len(data) - 1\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Wspak:\n...
[ 2, 5, 6, 7, 8 ]
import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.cluster import KMeans from kneed import KneeLocator #Create a panda data frame from the csv file df = pd.read_csv('ClusterPlot.csv', usecols=['V1','V2']) #Convert the panda data frame to a NumPy array arr = df.to_numpy() #Code used t...
normal
{ "blob_id": "09417014963172fc71b4268aafdec1405c04f34d", "index": 3472, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 11):\n km = KMeans(n_clusters=i, init='random', n_init=10, max_iter=300, tol=\n 0.0001, random_state=0)\n km.fit(arr)\n distortions.append(km.inertia_)\n...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import argparse import csv import glob import os import sys def run_main(): """ Main function to process user input and then generate the description files for each run :return: exit code -- 0 on success, 1 otherwise """ parser = argparse.ArgumentParser(description="Scan a...
normal
{ "blob_id": "6e6c6c5795e8723a86ae5dfc8f40df57d3dd10f7", "index": 3336, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_main():\n \"\"\"\n Main function to process user input and then generate the description files for each run\n\n :return: exit code -- 0 on success, 1 otherwise\n \...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 4.0.5 on 2023-02-14 18:57 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0020_festival_boxoffice_close_festival_boxoffice_open'), ] operations = [ migrations.AlterModelOptions( name='user', ...
normal
{ "blob_id": "e9bf5a40360d35f32bd2ad5aa404225f49895a14", "index": 4221, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('core',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.system('clear') <|reserved_special_token_0|> print(banner) <|reserved_special_token_0|> os.system('clear') print('\n' + '\x1b[94m - Loading Data ...') time.sleep(3) for u in usrf: userlist.append(u.replace('\n', '')) f...
flexible
{ "blob_id": "6ab5ac0caa44366268bb8b70ac044376d9c062f0", "index": 6976, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('clear')\n<mask token>\nprint(banner)\n<mask token>\nos.system('clear')\nprint('\\n' + '\\x1b[94m - Loading Data ...')\ntime.sleep(3)\nfor u in usrf:\n userlist.append(u...
[ 0, 1, 2, 3, 4 ]
N=int(input("N=")) K=int() K=0 while N>=2: N=N/2 K=K+1 print("K=",K)
normal
{ "blob_id": "7f4c6e4a5627b44b9a700d2de4f9caca0ae8b17c", "index": 2808, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile N >= 2:\n N = N / 2\n K = K + 1\nprint('K=', K)\n", "step-3": "N = int(input('N='))\nK = int()\nK = 0\nwhile N >= 2:\n N = N / 2\n K = K + 1\nprint('K=', K)\n", "ste...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: if suppressRoomPrint: suppressRoomPrint = False else: print(player.location) print( f""" {player.location.name} {player.location.description} {player.location.getItems()} """ ...
flexible
{ "blob_id": "07a172c28057dc803efdbdc10a9e2e11df4e527b", "index": 3134, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n if suppressRoomPrint:\n suppressRoomPrint = False\n else:\n print(player.location)\n print(\n f\"\"\"\n{player.location.name}\n {player.locatio...
[ 0, 1, 2, 3, 4 ]
import re from django import forms from django.contrib.auth import password_validation from django.contrib.auth.forms import PasswordChangeForm from django.contrib.auth.password_validation import validate_password from .models import Account class EditProfileModelForm(forms.ModelForm): class Meta: model...
normal
{ "blob_id": "af442d4a78930a0ebcd85a1cdfe4aa86461be5c1", "index": 1274, "step-1": "<mask token>\n\n\nclass PasswordChangeFormExt(PasswordChangeForm):\n \"\"\"Form for changing user's password.\"\"\"\n\n def clean(self):\n user = self.user\n new_password = self.cleaned_data.get('new_password1')...
[ 3, 4, 5, 6, 7 ]
"""Handles loading and tokenising of datasets""" import enum import numpy as np import os.path import pickle from tqdm import tqdm import nltk from nltk import WordPunctTokenizer nltk.download('punkt') from nltk.tokenize import word_tokenize from lib.utils import DATASETS_BASE_PATH, SAVED_POS_BASE_PATH from lib.pos im...
normal
{ "blob_id": "0150e1db3ef2f6c07280f21971b43ac71fc4cada", "index": 8984, "step-1": "<mask token>\n\n\nclass DatasetType(enum.Enum):\n \"\"\"\n Represents the type of dataset\n \"\"\"\n TRAIN = 0\n VAL = 1\n TEST = 2\n\n\nclass Language(enum.Enum):\n \"\"\"\n Represents the dataset language\...
[ 7, 8, 11, 12, 13 ]
from setuptools import setup setup(name='google-drive-helpers', version='0.1', description='Helper functions for google drive', url='https://github.com/jdoepfert/google-drive-helpers', license='MIT', packages=['gdrive_helpers'], install_requires=[ 'google-api-python-client...
normal
{ "blob_id": "c0218acadb9e03359ac898cf3bb4898f516400e5", "index": 5361, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='google-drive-helpers', version='0.1', description=\n 'Helper functions for google drive', url=\n 'https://github.com/jdoepfert/google-drive-helpers', license='MIT',\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def train(cls, data, target, model_path): cls = cls.fit(data, target) with open(model_path, 'wb') as f: pickle.dump(cls, f) <|reserved_special_token_0|> def load_models(matrix_path, model_path): tfidf, cls = None, None if os.path.isfile(model_path): wit...
flexible
{ "blob_id": "199872ea459a9dba9975c6531034bdbc1e77f1db", "index": 5875, "step-1": "<mask token>\n\n\ndef train(cls, data, target, model_path):\n cls = cls.fit(data, target)\n with open(model_path, 'wb') as f:\n pickle.dump(cls, f)\n\n\n<mask token>\n\n\ndef load_models(matrix_path, model_path):\n ...
[ 3, 4, 5, 6, 8 ]
class Port(object): def __init__(self, mac): self.mac = mac
normal
{ "blob_id": "cd89c9eaea9d331288fd07f1968ef9dce89b4a4b", "index": 7228, "step-1": "<mask token>\n", "step-2": "class Port(object):\n <mask token>\n", "step-3": "class Port(object):\n\n def __init__(self, mac):\n self.mac = mac\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Google_Cloud: <|reserved_special_token_0|> def sentiment(self): google_sentiment = self.client.analyze_sentiment(self.document ).document_sentiment sent = {} sent['sentiment'] = google_sentiment.score sent['magnitude'] = google_se...
flexible
{ "blob_id": "6868a8b5d36403f1417301acdca5f5dc9e45c682", "index": 9849, "step-1": "<mask token>\n\n\nclass Google_Cloud:\n <mask token>\n\n def sentiment(self):\n google_sentiment = self.client.analyze_sentiment(self.document\n ).document_sentiment\n sent = {}\n sent['sentime...
[ 7, 8, 10, 11, 14 ]
import string import pandas as pd import nltk from nltk import word_tokenize from nltk.stem import SnowballStemmer from nltk.tokenize import WordPunctTokenizer import json from sklearn.model_selection import train_test_split from keras.preprocessing.text import Tokenizer import pickle import re import nlpaug.augmenter....
normal
{ "blob_id": "326b2dcbef339aeb196bef23debad75fa079b121", "index": 6435, "step-1": "<mask token>\n\n\nclass Processing:\n <mask token>\n\n @property\n def vocab_size(self):\n return self.__vocab_size\n\n def normalize(self, s):\n s = s.lower()\n replacements = ('á', 'a'), ('é', 'e'...
[ 12, 16, 17, 18, 19 ]
<|reserved_special_token_0|> def set_gcs_credentials(): if os.path.exists(GLOBALS.google_application_credentials): return secrets_client = boto3.client('secretsmanager', region_name=GLOBALS. aws_region, endpoint_url=GLOBALS.aws_endpoint_uri) response = secrets_client.get_secret_value(Secre...
flexible
{ "blob_id": "a5eeafef694db04770833a4063358e8f32f467b0", "index": 8310, "step-1": "<mask token>\n\n\ndef set_gcs_credentials():\n if os.path.exists(GLOBALS.google_application_credentials):\n return\n secrets_client = boto3.client('secretsmanager', region_name=GLOBALS.\n aws_region, endpoint_ur...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def test_evm_contracts_data(globaldb): """Test that all evm contract entries in the packaged global DB have legal data""" serialized_chain_ids = [x.serialize_for_db() for x in ChainID] with globaldb.conn.read_ctx() as cursor: cursor.execute( 'SELECT address...
flexible
{ "blob_id": "52dc8a4f9165a88dddc1da16e0adb045c4d851ed", "index": 5017, "step-1": "<mask token>\n\n\ndef test_evm_contracts_data(globaldb):\n \"\"\"Test that all evm contract entries in the packaged global DB have legal data\"\"\"\n serialized_chain_ids = [x.serialize_for_db() for x in ChainID]\n with gl...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class RNNClassifier(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RNNClassifier(nn.Module): def __init__(self, batch_size, num_classes, hidden_size, vocab_size, embed_size, we...
flexible
{ "blob_id": "41417e3ce52edf6aee432886bbab6d16ec5bc88d", "index": 164, "step-1": "<mask token>\n\n\nclass RNNClassifier(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass RNNClassifier(nn.Module):\n\n def __init__(self, batch_size, num_classes, hidden_size, vocab_size,\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "848374ea7d706bbd2ef5a76489cabeff998acb82", "index": 6040, "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 = [('fuser', '00...
[ 0, 1, 2, 3, 4 ]
''' O(n) time complexity O(n) space complexity ''' class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ seenum = dict() for idx, val in enumerate(nums): if target - val in seenum: ...
normal
{ "blob_id": "b3f62c331ff4ae9f909fc90cc7303997b32daceb", "index": 1876, "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 twoSum(self, nums, target):\n \"\"\"\n :type nums: List...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 """(Optional) Test for GameDealer class.""" import unittest import os, sys from functools import reduce sys.path.insert(0, os.path.join(os.path.split(__file__)[0], "..")) import Lab19_Extending_Builtins.lab19_3 as game_dealer WHOLE_DECK = sorted(game_dealer.Deck()) class ReportingDealer(...
normal
{ "blob_id": "06a721c12e3140d4d1cf544a598f512595c4ab66", "index": 3013, "step-1": "<mask token>\n\n\nclass ReportingDealer(game_dealer.GameDealer):\n <mask token>\n\n def Report(self):\n \"\"\"For testing.\"\"\"\n return [p.hand for p in self.players]\n\n\nclass TestPlayCards(unittest.TestCase...
[ 8, 10, 11, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def iteration_spider(): max_errors = 5 num_errors = 0 for page in itertools.count(1): url = 'http://example.webscraping.com/view/-{}'.format(page) html = download(url) if html is None: ...
flexible
{ "blob_id": "0eaba8f570772de864f52168a597b47a4150d015", "index": 5924, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef iteration_spider():\n max_errors = 5\n num_errors = 0\n for page in itertools.count(1):\n url = 'http://example.webscraping.com/view/-{}'.format(page)\n htm...
[ 0, 1, 2, 3, 4 ]
a=raw_input("Enter the column\n") b=raw_input("Enter the row\n") i=0 k=0 m=0 c="" d="" while (m<int(b)): while(i<int(a)): c=c+" " for j in xrange(1,4): c=c+"-" i=i+1 while(k<int(a)): d=d+"|" for l in xrange(1,4): d=d+" " k=k+1 m=m+1 ...
normal
{ "blob_id": "c28d7fc45be9a6efa7b7ef00520898c3d238ac63", "index": 5518, "step-1": "a=raw_input(\"Enter the column\\n\")\nb=raw_input(\"Enter the row\\n\")\ni=0\nk=0\nm=0\nc=\"\"\nd=\"\"\nwhile (m<int(b)):\n while(i<int(a)):\n c=c+\" \"\n for j in xrange(1,4):\n c=c+\"-\"\n i=i+1...
[ 0 ]
## Author: Aleem Juma import os from app import app import pandas as pd # read in the quotes database q = pd.read_csv(os.path.join('app','data','quotes_all.csv'), sep=';', skiprows=1, header=0) # there are a few quote genres that don't occur in the model vocab # replace them with appropriate words so the similarity ...
normal
{ "blob_id": "8f854f4f2c807f988945af4dc53dba93cfb31168", "index": 9441, "step-1": "<mask token>\n\n\ndef get_similarity(word1, word2):\n \"\"\"\n Returns a similarity score between two words\n \"\"\"\n tok1 = cache.get(word1, nlp(word1))\n tok2 = cache.get(word2, nlp(word2))\n return tok1.simila...
[ 3, 5, 6, 7, 8 ]
from azureml.core.compute import AksCompute from azureml.core.model import Model, InferenceConfig from azureml.core.webservice import AksWebservice workspace_name = "" subscription_id = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" resource_group = "XXXXXXXXXXXXXXXXX" workspace_region = "eastus2" https_cert = "XXXXX" aks_nam...
normal
{ "blob_id": "2941ecde72325d46b5c3899d4b1a213daff67147", "index": 2613, "step-1": "<mask token>\n", "step-2": "<mask token>\nprov_config.enable_ssl(leaf_domain_label=https_cert)\n<mask token>\naks_service.wait_for_deployment(show_output=True)\nprint(aks_service.state)\n", "step-3": "<mask token>\nworkspace_na...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: in_str = input() except Exception as e: print('WRONG FORMAT!') sys.exit(0) <|reserved_special_token_0|> try: in_exp = eval(in_str) except Exception as e: print('WRONG FORMAT!') sys.exit(0) <|reserved_s...
flexible
{ "blob_id": "1634ae0e329b4f277fa96a870fbd19626c0ece81", "index": 6516, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n in_str = input()\nexcept Exception as e:\n print('WRONG FORMAT!')\n sys.exit(0)\n<mask token>\ntry:\n in_exp = eval(in_str)\nexcept Exception as e:\n print('WRONG FO...
[ 0, 1, 2, 3, 4 ]
import sys import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sea import sklearn import glob import pydub from pydub import AudioSegment import time import librosa import noisereduce as nr from scipy.io import wavfile import IPython import sounddevice as sd from pysndfx ...
normal
{ "blob_id": "14bf4befdce4270b4514b4e643964182f9c49ff4", "index": 8434, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(IPython.display.Audio(data=my, rate=sr))\nsd.play(my, sr)\n<mask token>\n", "step-3": "<mask token>\nmy, sr = librosa.load(\n 'C:\\\\Users\\\\pranj\\\\Downloads\\\\IEMOCAP_full...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @app.route('/api/v1/users/<int:user_id>', methods=['GET']) def get_user(user_id): try: user = User.query.filter_by(id=user_id).first() return jsonify({'user': user.serialize}) except: abort(404) @app.route('/api/v1/users', methods=['POST']) def create_use...
flexible
{ "blob_id": "f4519fa82ffc6bf945c7bb36d3761a708a06f641", "index": 5933, "step-1": "<mask token>\n\n\n@app.route('/api/v1/users/<int:user_id>', methods=['GET'])\ndef get_user(user_id):\n try:\n user = User.query.filter_by(id=user_id).first()\n return jsonify({'user': user.serialize})\n except:\...
[ 4, 6, 7, 8 ]
from mathmodule import * import sys print("Welcome to my basic \'Calculator\'") print("Please choose your best option (+, -, *, /) ") # user input part while True: try: A = int(input("Now Enter your first Value=")) break except: print("Oops!", sys.exc_info()[0], "occurred.") while True: mathoparet...
normal
{ "blob_id": "1cca94040cdd8db9d98f587c62eff7c58eae7535", "index": 6974, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"Welcome to my basic 'Calculator'\")\nprint('Please choose your best option (+, -, *, /) ')\nwhile True:\n try:\n A = int(input('Now Enter your first Value='))\n b...
[ 0, 1, 2, 3 ]
target = [] with open('IntegerArray.txt', 'r') as f: target = f.readlines() for x in range(len(target)): target[x] = int(target[x]) def f(A): if len(A) == 1: return 0 else: rightStart = len(A) // 2 leftArray = A[0:rightStart] righArray = A[rightStart:] B, b = co...
normal
{ "blob_id": "b5611c668a40e1735c92d6d00867885023ad713f", "index": 248, "step-1": "<mask token>\n\n\ndef f(A):\n if len(A) == 1:\n return 0\n else:\n rightStart = len(A) // 2\n leftArray = A[0:rightStart]\n righArray = A[rightStart:]\n B, b = count_and_sort(leftArray)\n ...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Widget2: def setup(self, MainWindow, res): self.widget = QWidget() self.grid = QGridLayout() self.results = QLineEdit() self.results.setText(res) row = 3 col = 0 self.cb = QComboBox() self.cb.addItems(['Advance Mod...
flexible
{ "blob_id": "b08cface601ee07125090f3ae03a3120974688f2", "index": 8765, "step-1": "<mask token>\n\n\nclass Widget2:\n\n def setup(self, MainWindow, res):\n self.widget = QWidget()\n self.grid = QGridLayout()\n self.results = QLineEdit()\n self.results.setText(res)\n row = 3\n...
[ 8, 9, 11, 13, 17 ]
<|reserved_special_token_0|> def fibonaci(n): if n <= 1: return n F = np.empty(shape=n + 1) F[0] = 0 F[1] = 1 for i in range(2, len(F)): F[i] = F[i - 1] + F[i - 2] return F[n] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fibo...
flexible
{ "blob_id": "67516551b595c02e70a0ba4005df8a97ba71b17e", "index": 1419, "step-1": "<mask token>\n\n\ndef fibonaci(n):\n if n <= 1:\n return n\n F = np.empty(shape=n + 1)\n F[0] = 0\n F[1] = 1\n for i in range(2, len(F)):\n F[i] = F[i - 1] + F[i - 2]\n return F[n]\n\n\n<mask token>\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): ap = argparse.ArgumentParser() ap.add_argument('-i', '--image', required=True, help='Path to the image') args = vars(ap.parse_args()) image = cv2.imread(args['image']) image = cv2.cvtColor(image, ...
flexible
{ "blob_id": "0547751af7bbac42351476dde591d13d40fb37eb", "index": 7811, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n ap = argparse.ArgumentParser()\n ap.add_argument('-i', '--image', required=True, help='Path to the image')\n args = vars(ap.parse_args())\n image = cv2.imrea...
[ 0, 1, 2, 3, 4 ]
from __future__ import absolute_import, division, print_function, unicode_literals import os from collections import defaultdict from past.builtins import basestring from pycolocstats.core.config import REF_COLL_GSUITES_PATH __metaclass__ = type class RefTrackCollectionRegistry(object): PREBUILT = '__prebuilt_...
normal
{ "blob_id": "9c2cc5b993f020b8a1c96ea4cd5c2fb2da44a251", "index": 1534, "step-1": "<mask token>\n\n\nclass RefTrackCollectionRegistry(object):\n <mask token>\n\n def __init__(self):\n self._genome2TrackIndexReg = defaultdict(set)\n self._trackIndex2CollectionReg = defaultdict(set)\n sel...
[ 6, 7, 8, 10, 11 ]
from pyplasm import * import random as r def gen_windows(plan_grid, n, m, window_model): return STRUCT([ T([1,2])([j,i])( gen_cube_windows(plan_grid, window_model)(i, j, n, m)) for i in range(n) for j in range(m) if plan_grid[i][j]]) def gen_cube_windows(plan_grid, wi...
normal
{ "blob_id": "cb48a1601798f72f9cf3759d3c13969bc824a0f6", "index": 707, "step-1": "<mask token>\n\n\ndef gen_windows(plan_grid, n, m, window_model):\n return STRUCT([T([1, 2])([j, i])(gen_cube_windows(plan_grid,\n window_model)(i, j, n, m)) for i in range(n) for j in range(m) if\n plan_grid[i][j]]...
[ 5, 7, 8, 9, 11 ]
''' Given an expression with numbers, brackets and operators. But in this task only brackets are important. Brackets can be one of three types -- "{}" "()" "[]". Brackets are determine the scope or restricted some expression. So each if was opened, then must be closed with the same type. The scopes of brackets must not...
normal
{ "blob_id": "f69b4d022ebed5a0b660f55704bbe762d5d765d5", "index": 1332, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef checkio(data):\n return True or False\n", "step-3": "'''\nGiven an expression with numbers, brackets and operators. But in this task only brackets are important. Brackets can...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Game: <|reserved_special_token_0|> def __init__(self, grid_size): self.grid_size = grid_size self.start_game(grid_size) plt.title("Nate's Lame Game") def start_game(self, grid_size): self.score = 0 self.goal_pos = 0, 0 se...
flexible
{ "blob_id": "a74f2050a057f579a8a8b77ac04ef09073cdb6cf", "index": 6057, "step-1": "<mask token>\n\n\nclass Game:\n <mask token>\n\n def __init__(self, grid_size):\n self.grid_size = grid_size\n self.start_game(grid_size)\n plt.title(\"Nate's Lame Game\")\n\n def start_game(self, grid...
[ 8, 9, 10, 12, 13 ]
<|reserved_special_token_0|> class ApiException(Exception): def __init__(self, message, code=400, data=None): Exception.__init__(self, message) self.code = code self.msg = message self.data = data def __str__(self): return self.msg <|reserved_special_token_0|> <...
flexible
{ "blob_id": "0ac14b023c51bfd1cf99bd2d991baa30a671e066", "index": 9994, "step-1": "<mask token>\n\n\nclass ApiException(Exception):\n\n def __init__(self, message, code=400, data=None):\n Exception.__init__(self, message)\n self.code = code\n self.msg = message\n self.data = data\n\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class EncyclopediaDao: <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def get_faq_content(query: str, page: str) ->list: """ 获取指定query的faq检索内容 :param query: :param page: :return: """ url = 'https://zhidao.baidu.com/search...
flexible
{ "blob_id": "a7f348b258e1d6b02a79c60e4fe54b6d53801f70", "index": 3877, "step-1": "<mask token>\n\n\nclass EncyclopediaDao:\n <mask token>\n <mask token>\n\n @staticmethod\n def get_faq_content(query: str, page: str) ->list:\n \"\"\"\n\t\t获取指定query的faq检索内容\n\t\t:param query:\n\t\t:param page:\n...
[ 2, 3, 4, 5, 6 ]
from flask import render_template, flash, redirect, url_for, request from flask_login import current_user, login_user, logout_user, login_required from werkzeug.urls import url_parse from app import db # from app.main.forms import [list forms here] from app.models import User from app.main import bp @bp.route('/') @bp...
normal
{ "blob_id": "495d606304e07a097033366d1a7e1d856a4cf61f", "index": 1935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@bp.route('/')\n@bp.route('/index')\n@login_required\ndef index():\n return render_template('index.html')\n", "step-3": "from flask import render_template, flash, redirect, url_f...
[ 0, 1, 2, 3 ]
from django.db import models class Category(models.Model): name = models.CharField(max_length=50, unique=True) created_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name class Meta: verbose_name = 'Categoria' class Books(models.Model): name = model...
normal
{ "blob_id": "0584ff5cb252fba0fe1fc350a5fb023ab5cbb02b", "index": 6750, "step-1": "<mask token>\n\n\nclass Student(models.Model):\n name = models.CharField(max_length=70)\n cpf = models.CharField(max_length=14)\n birth_date = models.DateField()\n city = models.CharField(max_length=50)\n registratio...
[ 3, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> myLabel1.grid(row=0, column=0) myLabel2.grid(row=1, column=0) root.mainloop() <|reserved_special_token_1|> <|reserved_special_token_0|> root = Tk() myLabel1 = Label(root, text='Hello User!') myLabel2 = Label(root, text='Welcome...
flexible
{ "blob_id": "93fe16e5a97ec2652c4f6b8be844244d9776ea2e", "index": 4921, "step-1": "<mask token>\n", "step-2": "<mask token>\nmyLabel1.grid(row=0, column=0)\nmyLabel2.grid(row=1, column=0)\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nmyLabel1 = Label(root, text='Hello User!')\nmyLabel2 = Label(ro...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 import datetime from django.http import JsonResponse from django.shortcuts import render, redirect from models import * from hashlib import sha1 from user_decorators import user_login from df_goods.models import GoodsInfo # Create your views here. def register(request): context={'title':'注册','top':'0...
normal
{ "blob_id": "1ef40d4162ca1b1bd6a5a5010485c78eb9d8d736", "index": 9621, "step-1": "<mask token>\n\n\ndef register(request):\n context = {'title': '注册', 'top': '0'}\n return render(request, 'df_user/register.html', context)\n\n\ndef login(request):\n context = {'title': '登录', 'top': '0'}\n return rende...
[ 6, 7, 9, 11, 12 ]
import json import logging import os import sys from io import StringIO import pytest from allure.constants import AttachmentType from utils.tools import close_popups _beautiful_json = dict(indent=2, ensure_ascii=False, sort_keys=True) # LOGGING console ##############################################################...
normal
{ "blob_id": "37fdfddb471e2eec9e5867d685c7c56fc38c5ae7", "index": 8363, "step-1": "<mask token>\n\n\nclass CustomLogger(logging.Logger):\n <mask token>\n\n @staticmethod\n def format_message(message):\n return json.dumps(message, **_beautiful_json) if isinstance(message,\n (dict, list, ...
[ 10, 13, 14, 15, 16 ]
# cook your dish here t=int(input()) while t: n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) s=0 for i in range(n): k=a[i]-i if k>=0: s+=k print(s%1000000007) t-=1
normal
{ "blob_id": "44bf409d627a6029ab4c4f1fff99f102b8d57279", "index": 3954, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile t:\n n = int(input())\n a = list(map(int, input().split()))\n a.sort(reverse=True)\n s = 0\n for i in range(n):\n k = a[i] - i\n if k >= 0:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def full_adder(a: bool, b: bool, c: bool) ->(bool, bool): """Returns a + b + c in the form of a tuple of two bools representing the two bits. Carried value is ignored. """ nand_a_b = nand(a, b) nand_...
flexible
{ "blob_id": "66f6639ae62fe8c0b42171cf3e3fb450d8eee2b2", "index": 7671, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef full_adder(a: bool, b: bool, c: bool) ->(bool, bool):\n \"\"\"Returns a + b + c in the form of a tuple of two bools representing the two\n bits.\n \n Carried value is ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class priority_customer(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_...
flexible
{ "blob_id": "f2bb00d06023ef7b3ea3dc33f7ec00d1f48d46ae", "index": 8477, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass priority_customer(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass priority_customer(models.Model)...
[ 0, 1, 2, 3, 4 ]
def entete(): entete = """ <!DOCTYPE HTML> <html lang=“fr”> <head> <title>AMAP'PATATE</title> <meta charset="UTF-8" /> <link rel="stylesheet" type="text/css" href="/IENAC15/amapatate/css/font-awesome.min.css" /> <link rel=...
flexible
{ "blob_id": "933758002c5851a2655ed4c51b2bed0102165116", "index": 4742, "step-1": "def entete():\n entete = \"\"\"\n <!DOCTYPE HTML>\n<html lang=“fr”>\n <head>\n <title>AMAP'PATATE</title>\n <meta charset=\"UTF-8\" />\n <link rel=\"stylesheet...
[ 1, 2, 3, 4, 5 ]
import re import itertools import setpath import functions import lib.jopts as jopts from operator import itemgetter import random __docformat__ = 'reStructuredText en' re_params=re.compile('(\w*):(.*)') def consumer(func): """A decorator, advances func to its first yield point when called. """ from fun...
normal
{ "blob_id": "60411e922bfec8f98028f959a370f954eef5437e", "index": 1329, "step-1": "import re\nimport itertools\nimport setpath\nimport functions\nimport lib.jopts as jopts\nfrom operator import itemgetter\nimport random\n\n__docformat__ = 'reStructuredText en'\n\nre_params=re.compile('(\\w*):(.*)')\n\ndef consume...
[ 0 ]
import mysql.connector import json mysql_user = 'root' mysql_pass = 'funwfats' mysql_host = 'localhost' mysql_base = 'sys' wn8_file = "wn8exp.json" def fill_wn8_table(): with open(wn8_file, encoding="utf-8") as file: wn8_dict = json.loads(file.read()) cnx_wn8 = mysql.connector.connect(us...
normal
{ "blob_id": "291052c22059b32f3f300c323a10b260fbd0c20f", "index": 9210, "step-1": "import mysql.connector\r\nimport json\r\n\r\nmysql_user = 'root'\r\nmysql_pass = 'funwfats'\r\nmysql_host = 'localhost'\r\nmysql_base = 'sys'\r\nwn8_file = \"wn8exp.json\"\r\n\r\n\r\ndef fill_wn8_table():\r\n with open(wn8_file,...
[ 0 ]
<|reserved_special_token_0|> class ChamferCylinder(pynewton.ChamferCylinder): pass class ConvexHull(pynewton.ConvexHull): pass class ConvexHullModifier(pynewton.ConvexHullModifier): pass class NullCollider(pynewton.NullCollider): pass class TreeCollision(pynewton.TreeCollision): pass cla...
flexible
{ "blob_id": "90d792fe18e589a0d74d36797b46c6ac1d7946be", "index": 4303, "step-1": "<mask token>\n\n\nclass ChamferCylinder(pynewton.ChamferCylinder):\n pass\n\n\nclass ConvexHull(pynewton.ConvexHull):\n pass\n\n\nclass ConvexHullModifier(pynewton.ConvexHullModifier):\n pass\n\n\nclass NullCollider(pynewt...
[ 33, 52, 66, 68, 76 ]
class UF(object): def __init__(self, n): self.parents = [i for i in range(n)] self.weights = [1 for i in range(n)] self.n = n def find(self, i): while i != self.parents[i]: self.parents[i] = self.parents[self.parents[i]] i = self.parents[i] return...
normal
{ "blob_id": "c8d5b8515a468190d14311118e12a7d414908be6", "index": 8109, "step-1": "class UF(object):\n <mask token>\n\n def find(self, i):\n while i != self.parents[i]:\n self.parents[i] = self.parents[self.parents[i]]\n i = self.parents[i]\n return i\n\n def union(sel...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: return True def quote(items): return [("'" + item + "'") for item in items] if modul...
flexible
{ "blob_id": "68371acc58da6d986d94d746abb4fea541d65fdd", "index": 3384, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef module_exists(module_name):\n try:\n __import__(module_name)\n except ImportError:\n return False\n else:\n return True\n\n\ndef quote(items):\n r...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Ui_FindResultWindow(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_FindResultWindow(object): <|reserved_special_token_0|> def retranslateUi(self, FindResultWindow): _...
flexible
{ "blob_id": "2fdbf418b5cec50ee6568897e0e749681efeef6b", "index": 6584, "step-1": "<mask token>\n\n\nclass Ui_FindResultWindow(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_FindResultWindow(object):\n <mask token>\n\n def retranslateUi(self, FindResultWindow):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # encoding: utf-8 import os import argparse import coaddBatchCutout as cbc def run(args): min = -0.0 max = 0.5 Q = 10 if os.path.isfile(args.incat): cbc.coaddBatchCutFull(args.root, args.incat, filter=args.filter, ...
normal
{ "blob_id": "c0503536672aa824eaf0d19b9d4b5431ef910432", "index": 1028, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(args):\n min = -0.0\n max = 0.5\n Q = 10\n if os.path.isfile(args.incat):\n cbc.coaddBatchCutFull(args.root, args.incat, filter=args.filter,\n id...
[ 0, 1, 2, 3, 4 ]
__author__ = "Yong Peng" __version__ = "1.0" import time import re import getpass from netmiko import ( ConnectHandler, NetmikoTimeoutException, NetmikoAuthenticationException, ) with open('./device_list.txt','r') as f: device_list = [i.strip() for i in f.readlines() if len(i.strip()) != 0] # rea...
normal
{ "blob_id": "31a0c9a143a06ac86c8e8616fb273a0af844a352", "index": 6895, "step-1": "<mask token>\n\n\ndef send_show_command(device, commands):\n OutputPath = 'c:/script/output/' + str(device['host']) + '.txt'\n result = open(OutputPath, 'w')\n flag = True\n try:\n with ConnectHandler(**device) a...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.news.drop() db.news.insert_many(scrape(info, url)) <|reserved_special_token_0|> db.images.drop() db.images.insert_many(scrape(info, url)) <|reserved_special_token_0|> db.weather.drop() db.weather.insert_many(scrape(info, url)) ...
flexible
{ "blob_id": "e3ac8039ffb6787b0e3e80b234c2689c66a184bf", "index": 1704, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.news.drop()\ndb.news.insert_many(scrape(info, url))\n<mask token>\ndb.images.drop()\ndb.images.insert_many(scrape(info, url))\n<mask token>\ndb.weather.drop()\ndb.weather.insert_many(s...
[ 0, 1, 2, 3, 4 ]
from SPARQLWrapper import SPARQLWrapper, JSON sparql = SPARQLWrapper( 'http://localhost:3030/ds/query' ) #Pizzas def get_response_pizzas(): sparql.setQuery(''' PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX saidi: <http://www.semanticweb.org/japor/ontologies/2021/5/Pizzas...
normal
{ "blob_id": "9690366a88a87951f5c51902118888cce8159ffc", "index": 7219, "step-1": "<mask token>\n\n\ndef get_response_carnes():\n sparql.setQuery(\n \"\"\"\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX saidi: <http://www.semanticweb.org/japor/ontologies/2021/5/PizzasLojan...
[ 6, 7, 8, 10, 12 ]
#encoding: utf-8 """ Desc: Author: Makoto OKITA Date: 2016/09/03 """ import numpy as np import chainer from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils from chainer import Link, Chain, ChainList import chainer.functions as F import chainer.links as L import itertools ...
normal
{ "blob_id": "13e89e13f88ac306a62be3390f5292665f128a4d", "index": 9332, "step-1": "#encoding: utf-8\n\"\"\"\nDesc: \nAuthor: Makoto OKITA\nDate: 2016/09/03 \n\"\"\"\nimport numpy as np\nimport chainer\nfrom chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils\nfrom chainer...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solution(record): answer = [] arr = dict() history = [] for i in record: tmp = i.split() if tmp[0] == 'Enter': arr[tmp[1]] = tmp[2] history.append([tmp[1], '님이 들어왔습니다.']) elif tmp[0] == 'Leav...
flexible
{ "blob_id": "d9f66cc3ba40292c49da08d7573d4c605a2771ae", "index": 3730, "step-1": "<mask token>\n", "step-2": "def solution(record):\n answer = []\n arr = dict()\n history = []\n for i in record:\n tmp = i.split()\n if tmp[0] == 'Enter':\n arr[tmp[1]] = tmp[2]\n h...
[ 0, 1, 2 ]
#PortableKanban 4.3.6578.38136 - Encrypted Password Retrieval #Python3 -m pip install des #or #pip install des import json import base64 from des import * #python3 -m pip install des, pip install des import sys def decode(hash): hash = base64.b64decode(hash.encode('utf-8')) key = DesKey(b"7ly6UznJ") r...
normal
{ "blob_id": "136215a3ba99f74160373181c458db9bec4bb6b7", "index": 977, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef decode(hash):\n hash = base64.b64decode(hash.encode('utf-8'))\n key = DesKey(b'7ly6UznJ')\n return key.decrypt(hash, initial=b'XuVUm5fR', padding=True).decode('utf-8')\n\n...
[ 0, 1, 2, 3, 4 ]
test_case = int(input()) while test_case != 0: test_case -= 1 (n, m) = map(int, input().split()) ans = n * m A = [] for i in range(n): t = list(map(int, input().split())) A.append(t) for i in range(1, n - 1): for j in range(1, m - 1): k = 1 while ...
normal
{ "blob_id": "dbc3e51fed63fe0fadea67d05c4b4efc693938a3", "index": 1487, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile test_case != 0:\n test_case -= 1\n n, m = map(int, input().split())\n ans = n * m\n A = []\n for i in range(n):\n t = list(map(int, input().split()))\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties( object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0...
flexible
{ "blob_id": "0ddac0aac5bd001504ed37d31b74c6442304e350", "index": 5729, "step-1": "<mask token>\n\n\nclass OrgApacheJackrabbitOakSecurityAuthenticationTokenTokenConfiguraProperties(\n object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask...
[ 12, 18, 19, 22, 25 ]
from solution import find_days import pudb def test(): T = [1, 2, 3, 1, 0, 4] # pudb.set_trace() res = find_days(T) assert res == [1, 1, 3, 2, 1, 0]
normal
{ "blob_id": "db36c82717aa0bacffce7a3e2724ed2bb586c7fb", "index": 7862, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test():\n T = [1, 2, 3, 1, 0, 4]\n res = find_days(T)\n assert res == [1, 1, 3, 2, 1, 0]\n", "step-3": "from solution import find_days\nimport pudb\n\n\ndef test():\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # coding: utf-8 # In[ ]: import numpy as np import pickle from sklearn.model_selection import train_test_split from sklearn.metrics import mean_absolute_error from pyspark.sql.functions import split, concat,col from sklearn.svm import SVR test = True # In[ ]: dbutils.widgets.removeAll() d...
normal
{ "blob_id": "e48addecdde632607a9c782ff78a769122daab6f", "index": 1738, "step-1": "<mask token>\n", "step-2": "<mask token>\ndbutils.widgets.removeAll()\ndbutils.widgets.text('input_path', 'Not found', 'input_path')\n<mask token>\ndbutils.widgets.text('model_path', 'Not found', 'model_path')\n<mask token>\nif t...
[ 0, 1, 2, 3, 4 ]
import hive from ..bind import Instantiator as _Instantiator from ..event import bind_info as event_bind_info bind_infos = (event_bind_info,) def build_scene_instantiator(i, ex, args, meta_args): bind_bases = tuple((b_i.environment_hive for b_i in bind_infos if b_i.is_enabled(meta_args))) # Update bind env...
normal
{ "blob_id": "23d4619527b5fce7fed0b0a66d834e26bb984129", "index": 6443, "step-1": "<mask token>\n\n\nclass SceneClass:\n\n def __init__(self):\n self._entities = {}\n self.scene = None\n\n def get_entity_id(self, identifier):\n return self._entities[identifier]\n\n def get_position_a...
[ 9, 10, 11, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> #!/usr/bin/env python3 """Test telegram_menu package."""
flexible
{ "blob_id": "8d4ffed90e103e61a85a54d6163770966fb2e5c9", "index": 5049, "step-1": "<mask token>\n", "step-2": "#!/usr/bin/env python3\n\n\"\"\"Test telegram_menu package.\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-10-16 12:35 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0033_auto_20171016_1334'), ] operations = [ migrations.AlterField( ...
normal
{ "blob_id": "d0dfea27128ca6966c85da6529ead5c95c86c4cf", "index": 1183, "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 = [('blog', '003...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(s_stemmer.stem('writing')) <|reserved_special_token_1|> <|reserved_special_token_0|> p_stemmer = PorterStemmer() s_stemmer = SnowballStemmer(language='english') print(s_stemmer.stem('writing')) <|reserved_special_token_...
flexible
{ "blob_id": "67e6d39ef291e4bb30c0b6bab7b71d97c86b0ef1", "index": 4108, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s_stemmer.stem('writing'))\n", "step-3": "<mask token>\np_stemmer = PorterStemmer()\ns_stemmer = SnowballStemmer(language='english')\nprint(s_stemmer.stem('writing'))\n", "step-...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.execute( 'SELECT tweet_date, COUNT(*) FROM projekt_election.tweet as tweet , projekt_election.hashtag_use as use WHERE tweet.tweet_id = use.tweet_id GROUP BY tweet_date ORDER BY tweet_date ASC' ) <|reserved_special_...
flexible
{ "blob_id": "076b852010ddcea69a294f9f2a653bb2fa2f2676", "index": 3531, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(\n 'SELECT tweet_date, COUNT(*) FROM projekt_election.tweet as tweet , projekt_election.hashtag_use as use WHERE tweet.tweet_id = use.tweet_id GROUP BY tweet_date ORDER ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @register(NewsModel) class ProjectTranslationOptions(TranslationOptions): fields = 'name', 'text' <|reserved_special_token_1|> <|reserved_special_token_0|> @register(PageTitleModel) class TitleTranslationOptions(TranslationOptions): <|reserved_special_token_0|> @register(Ne...
flexible
{ "blob_id": "9c29f04746de6847ad1bbdf08964d14e6c3766db", "index": 8700, "step-1": "<mask token>\n\n\n@register(NewsModel)\nclass ProjectTranslationOptions(TranslationOptions):\n fields = 'name', 'text'\n", "step-2": "<mask token>\n\n\n@register(PageTitleModel)\nclass TitleTranslationOptions(TranslationOption...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BackendSerializer(serializers.ModelSerializer): class Meta: model = Backend fields = '__all__' <|reserved_special_token_1|> from rest_framework import serializers from .models import Backend clas...
flexible
{ "blob_id": "b4787d65fb8adf5dc6a99c1a13922c8f9acc2087", "index": 1971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BackendSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Backend\n fields = '__all__'\n", "step-3": "from rest_framework import serializers...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-10-18 07:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0008_alter_user_username_max_length'), ] operations = [...
normal
{ "blob_id": "ab343f88c84d45cf90bddd52623362f047c72d3c", "index": 5754, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# Generated by Selenium IDE import pytest import time import json from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWa...
normal
{ "blob_id": "87f8cc65cf7d0ea932de79a6daf5b29ad387ec6f", "index": 7103, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestSTCHANGE:\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestSTCHANGE:\n\n def setup_method(self, method):\n self.d...
[ 0, 1, 4, 5, 6 ]
<|reserved_special_token_0|> @app.route('/hello/') def hello(): return render_template('index.html', greeting='here we are') <|reserved_special_token_0|> @app.route('/api/1.0/create_playlists', methods=['POST']) def do_create_playlists(): create_playlists(ALL_DBS) retval = get_all_playlists(ALL_DBS) ...
flexible
{ "blob_id": "5193de15052f81460a23d993cfa039fa90c9de5e", "index": 897, "step-1": "<mask token>\n\n\n@app.route('/hello/')\ndef hello():\n return render_template('index.html', greeting='here we are')\n\n\n<mask token>\n\n\n@app.route('/api/1.0/create_playlists', methods=['POST'])\ndef do_create_playlists():\n ...
[ 6, 9, 11, 13, 14 ]
<|reserved_special_token_0|> def send_show_command(device, commands): OutputPath = 'c:/script/output/' + str(device['host']) + '.txt' result = open(OutputPath, 'w') flag = True try: with ConnectHandler(**device) as ssh: ssh.enable() for command in commands: ...
flexible
{ "blob_id": "31a0c9a143a06ac86c8e8616fb273a0af844a352", "index": 6895, "step-1": "<mask token>\n\n\ndef send_show_command(device, commands):\n OutputPath = 'c:/script/output/' + str(device['host']) + '.txt'\n result = open(OutputPath, 'w')\n flag = True\n try:\n with ConnectHandler(**device) a...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): """ Trains an autoencoder on (generated) data and checks adversarial robustness """ architecture = [10, 5, 10] print('----------Training autoencoder----------') aut = autoencoder(architecture=archit...
flexible
{ "blob_id": "44e1208a2165fe68f71d0aa49baa29b26c961e02", "index": 5681, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n \"\"\"\n\tTrains an autoencoder on (generated) data and checks adversarial robustness\n\t\"\"\"\n architecture = [10, 5, 10]\n print('----------Training autoenc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserInfo(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "dbec74ecf488ca98f3f441e252f79bc2bc0959c1", "index": 4068, "step-1": "<mask token>\n\n\nclass UserInfo(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> async def main(URL, buy_time): browser, page = await get_window() await page.goto( 'https://account.xiaomi.com/pass/serviceLogin?callback=http%3A%2F%2Forder.mi.com%2Flogin%2Fcallback%3Ffollowup%3Dhttps%253A%252F%...
flexible
{ "blob_id": "1e87f625fb7bd9f9bf4233229332c909702954a5", "index": 4334, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def main(URL, buy_time):\n browser, page = await get_window()\n await page.goto(\n 'https://account.xiaomi.com/pass/serviceLogin?callback=http%3A%2F%2Forder.mi.com%...
[ 0, 1, 2, 3 ]
# Python 3 program - Currency Sum Validator # def bill_count def bill_count(amount_user, list_of_money_bills): n = len(list_of_money_bills) # Initialize Result ans = [] # Traverse through all the list i = n - 1 while (i >= 0): # Find list while (amount_user >= list_of_mo...
normal
{ "blob_id": "53c5f298dbfb21d7688fef8f0312858e2fd73d79", "index": 4423, "step-1": "<mask token>\n", "step-2": "def bill_count(amount_user, list_of_money_bills):\n n = len(list_of_money_bills)\n ans = []\n i = n - 1\n while i >= 0:\n while amount_user >= list_of_money_bills[i]:\n am...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_sweeps(ref_params_d, n_writers): params_d = copy.deepcopy(ref_params_d) params_d['writer']['nprocs'].values = [n_writers] params_d['writer']['decomposition'].values = [n_writers] all_dicts = [] all_sweeps = [] for r in [8]: par_r = copy.deepcopy(par...
flexible
{ "blob_id": "475cc5130e847b1a74a33bfa5cbc202a6bf31621", "index": 6932, "step-1": "<mask token>\n\n\ndef get_sweeps(ref_params_d, n_writers):\n params_d = copy.deepcopy(ref_params_d)\n params_d['writer']['nprocs'].values = [n_writers]\n params_d['writer']['decomposition'].values = [n_writers]\n all_di...
[ 3, 4, 5, 6, 7 ]
from keras.preprocessing.image import img_to_array from keras.models import load_model import tensorflow as tf import numpy as np import argparse import imutils import pickle import cv2 # USAGE # python classify.py --model output/fashion.model --categorybin output/category_lb.pickle # --colorbin output/color_lb.pickle...
normal
{ "blob_id": "8ff9961c1415c04899bbc15ba64811a1b3ade262", "index": 3082, "step-1": "<mask token>\n", "step-2": "<mask token>\nap.add_argument('-m', '--model', required=True, help=\n 'path to trained model model')\nap.add_argument('-l', '--categorybin', required=True, help=\n 'path to output category label ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import sys def solve(): numEngines = int(sys.stdin.readline()) engines = [] for _ in range(numEngines): engine = sys.stdin.readline() engines.append(engine) numQueries = int(sys.stdin.readline()) queries = [] for _ in range(numQueries): query = sys.stdin.readline() queries.append(...
normal
{ "blob_id": "174f5b04f02ec0c9651d5e34c8b04df8bfd4dff4", "index": 1943, "step-1": "#!/usr/bin/env python\n\nimport sys\n\ndef solve():\n\tnumEngines = int(sys.stdin.readline())\n\tengines = []\n\tfor _ in range(numEngines):\n\t\tengine = sys.stdin.readline()\n\t\tengines.append(engine)\n\n\tnumQueries = int(sys.s...
[ 0 ]
"""Activate coverage at python startup if appropriate. The python site initialisation will ensure that anything we import will be removed and not visible at the end of python startup. However we minimise all work by putting these init actions in this separate module and only importing what is needed when needed. For...
normal
{ "blob_id": "243794d36a1c6861c2c3308fe6a52ec19b73df72", "index": 7820, "step-1": "<mask token>\n\n\ndef multiprocessing_start(obj):\n cov = init()\n if cov:\n multiprocessing.util.Finalize(None, multiprocessing_finish, args=(\n cov,), exitpriority=1000)\n\n\n<mask token>\n\n\ndef init():\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class TestActor(Actor): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestActor(Actor): <|reserved_special_token_0|> def act(self): self.key_commands(...
flexible
{ "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 ]
<|reserved_special_token_0|> def main(): N, K, D = map(int, input().split()) rules = [tuple(map(int, input().split())) for _ in range(K)] minv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules]) while minv + 1 < maxv: midv = (minv + maxv) // 2 cnt, max_in = 0, 0 for ...
flexible
{ "blob_id": "f0b98a3d6015d57a49e315ac984cac1cccf0b382", "index": 6084, "step-1": "<mask token>\n\n\ndef main():\n N, K, D = map(int, input().split())\n rules = [tuple(map(int, input().split())) for _ in range(K)]\n minv, maxv = min([r[0] for r in rules]), max([r[1] for r in rules])\n while minv + 1 <...
[ 1, 2, 3, 4, 5 ]
import turtle def distance(x1, y1, x2, y2): return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5 x1, y1 = eval(input("Enter x1 and y1 for point 1: ")) x2, y2 = eval(input("Enter x2 and y2 for point 2: ")) distanceBetweenPoints = distance(x1, y1, x2, y2) turtle.penup() turtle.goto(x1, y1) turtle.pendown...
normal
{ "blob_id": "9f8065dfdfe07985244e18d92b59e1c045388a72", "index": 2557, "step-1": "<mask token>\n\n\ndef distance(x1, y1, x2, y2):\n return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) ** 0.5\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef distance(x1, y1, x2, y2):\n return ((x1 - x2) * (x1 - x2...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def play_emergency_sound(): print('Playing emergency sound. There are ' + str(threading. active_count()) + ' threads active') while getattr(emergency_sound_thread, 'do_run', True): pygame.mixer.init() pygame.mixer.Channel(0).play(pygame.mixer.Sound( ...
flexible
{ "blob_id": "44274446673225c769f63191d43e4747d8ddfbf7", "index": 6934, "step-1": "<mask token>\n\n\ndef play_emergency_sound():\n print('Playing emergency sound. There are ' + str(threading.\n active_count()) + ' threads active')\n while getattr(emergency_sound_thread, 'do_run', True):\n pyga...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> OK = 200 CREATED = 201 NOT_MODIFIED = 304 UNAUTHORIZED = 401 FORBIDDEN = 403 BAD_REQUEST = 400 NOT_FOUND = 404 CONFLICT = 409 UNPROCESSABLE = 422 INTERNAL_SERVER_ERROR = 500 NOT_IMPLEMENTED = 501 SERVICE_UNAVAILABLE = 503 ADMIN = 'admin' ELITE = 'elite' NOOB ...
flexible
{ "blob_id": "d90942f22cbbd9cfc3a431b7857cd909a7690966", "index": 92, "step-1": "<mask token>\n", "step-2": "OK = 200\nCREATED = 201\nNOT_MODIFIED = 304\nUNAUTHORIZED = 401\nFORBIDDEN = 403\nBAD_REQUEST = 400\nNOT_FOUND = 404\nCONFLICT = 409\nUNPROCESSABLE = 422\nINTERNAL_SERVER_ERROR = 500\nNOT_IMPLEMENTED = 5...
[ 0, 1 ]
# -*- coding: utf-8 -*- import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties from sklearn import svm data=np.loadtxt('yucedata1.txt') X=data[:,0] y=data[:,1] plt.figure(1,figsize=(8,6)) myfont = FontProperties(fname=r"c:\windo...
normal
{ "blob_id": "73d7b1895282df5b744d8c03ec7e6f8530366b76", "index": 865, "step-1": "# -*- coding: utf-8 -*-\r\nimport numpy as np\r\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt \r\nfrom matplotlib.font_manager import FontProperties \r\nfrom sklearn import svm\r\n\r\n\r\ndata=np.loadtxt('yucedata1.tx...
[ 0 ]
from Monument import Monument, Dataset import importer_utils as utils import importer as importer class RoRo(Monument): def set_adm_location(self): counties = self.data_files["counties"] self.set_from_dict_match(counties, "iso_code", "judetul_iso", "located_adm") ...
normal
{ "blob_id": "5f8a9d82a3245671b438475d1fac7be4db769fbe", "index": 8493, "step-1": "<mask token>\n\n\nclass RoRo(Monument):\n\n def set_adm_location(self):\n counties = self.data_files['counties']\n self.set_from_dict_match(counties, 'iso_code', 'judetul_iso',\n 'located_adm')\n <mas...
[ 4, 5, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "6907a1e08d728732eebf81fec7c0dab8729448e2", "index": 9712, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def weights_init(m): if type(m) == nn.Linear: m.weight.data.normal_(0.0, 0.001) m.bias.data.fill_(0.0) def update_lr(optimizer, lr): for param_group in optimizer.param_groups: param_group['lr'] = lr <|reserved_special_token_0|> class ConvNet(nn.Module...
flexible
{ "blob_id": "0553bd4c7261197a1a80c5551305a16e7bfdc761", "index": 2398, "step-1": "<mask token>\n\n\ndef weights_init(m):\n if type(m) == nn.Linear:\n m.weight.data.normal_(0.0, 0.001)\n m.bias.data.fill_(0.0)\n\n\ndef update_lr(optimizer, lr):\n for param_group in optimizer.param_groups:\n ...
[ 5, 6, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> hacker_legends.append('Anonymous') print(hacker_legends) <|reserved_special_token_0|> networking.insert(3, 'SSH') print(networking) <|reserved_special_token_0|> ip_addy.remove(5102018) print(ip_addy) <|reserved_special_token_0|> c...
flexible
{ "blob_id": "53fd020946a2baddb1bb0463d2a56744de6e3822", "index": 5506, "step-1": "<mask token>\n", "step-2": "<mask token>\nhacker_legends.append('Anonymous')\nprint(hacker_legends)\n<mask token>\nnetworking.insert(3, 'SSH')\nprint(networking)\n<mask token>\nip_addy.remove(5102018)\nprint(ip_addy)\n<mask token...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from distributions.zero_inflated_poisson import ZeroInflatedPoisson from distributions.negative_binomial import NegativeBinomial from distributions.zero_inflated_negative_binomial import ZeroInflatedNegativeBinomial from distributions.zero_inflated import Zer...
flexible
{ "blob_id": "dfae1007adc557a15d03b78f2bf790fb5b06141a", "index": 4442, "step-1": "<mask token>\n", "step-2": "from distributions.zero_inflated_poisson import ZeroInflatedPoisson\nfrom distributions.negative_binomial import NegativeBinomial\nfrom distributions.zero_inflated_negative_binomial import ZeroInflated...
[ 0, 1 ]
# Getting familiar with OOP and using Functions and Classes :) class Dog(): species = 'mammal' def __init__(self,breed,name): self.breed = breed self.name = name def bark(self,number): print(f'Woof! My name is {self.name} and the number is {number}') my_dog = Dog('Corgi'...
normal
{ "blob_id": "c8137aacfb0f35c9630515442d5bdda870e9908a", "index": 4827, "step-1": "<mask token>\n\n\nclass Circle:\n <mask token>\n\n def __init__(self, radius=1):\n self.radius = radius\n self.area = radius * radius * Circle.pi\n\n def get_circumference(self):\n return self.radius *...
[ 10, 11, 13, 16, 18 ]
<|reserved_special_token_0|> def old_bracket(taxable_income, joint=True): rate = [0.1, 0.15, 0.25, 0.28, 0.33, 0.35, 0.396] if not joint: bracket = [0, 9325, 37950, 91900, 191650, 416700, 418400] else: bracket = [0, 18650, 75900, 153100, 233350, 416700, 470700] return tax_calculator(ta...
flexible
{ "blob_id": "70cb5673a13967247b6da1fa5948000db39a92c8", "index": 7253, "step-1": "<mask token>\n\n\ndef old_bracket(taxable_income, joint=True):\n rate = [0.1, 0.15, 0.25, 0.28, 0.33, 0.35, 0.396]\n if not joint:\n bracket = [0, 9325, 37950, 91900, 191650, 416700, 418400]\n else:\n bracket...
[ 7, 10, 13, 15, 16 ]
marks = { "S":"subject", "O":"object", "A":"attribute", "C":"clause", } marks_reverse = { "subject":"S", "object":"O", "attribute":"A", "clause":"C", }
normal
{ "blob_id": "c66b07c45f4a675a6c7fcec82048a3197910d0d8", "index": 3435, "step-1": "<mask token>\n", "step-2": "marks = {'S': 'subject', 'O': 'object', 'A': 'attribute', 'C': 'clause'}\nmarks_reverse = {'subject': 'S', 'object': 'O', 'attribute': 'A', 'clause': 'C'\n }\n", "step-3": "marks = {\n \"S\":\"...
[ 0, 1, 2 ]
#!/usr/bin/env python import sys total = 0 for line in sys.stdin: edges = [int(x) for x in line.split("x")] edges.sort() ribbon = sum(x * 2 for x in edges[:2]) l, w, h = edges bow = l * w * h total += bow + ribbon print(total)
normal
{ "blob_id": "ed85cb61f4bc8bf758dafb10ffbabf87fb4521d0", "index": 9281, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n edges = [int(x) for x in line.split('x')]\n edges.sort()\n ribbon = sum(x * 2 for x in edges[:2])\n l, w, h = edges\n bow = l * w * h\n total +=...
[ 0, 1, 2, 3, 4 ]