code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
""" GoldenTemplate based on the golden-layout library. """ from __future__ import annotations import pathlib from typing import TYPE_CHECKING, Literal import param from ...config import config from ...io.resources import JS_URLS from ..base import BasicTemplate if TYPE_CHECKING: from ...io.resources import Res...
normal
{ "blob_id": "5bfb69d1608b397d6a19e663164a30089e4f67ad", "index": 2859, "step-1": "<mask token>\n\n\nclass GoldenTemplate(BasicTemplate):\n <mask token>\n sidebar_width = param.Integer(default=20, constant=True, doc=\n \"\"\"\n The width of the sidebar in percent.\"\"\")\n _css = pathlib.Pa...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 26 23:42:11 2018 @author: pohsuanh Fully Covolutional Network FCN-32s. FCN-32s network is based on VGG-16 """ import os import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import data_load from datetime import datetime ...
normal
{ "blob_id": "df6fa0409500f97e5afde8f97796d6ed0cc4d746", "index": 1330, "step-1": "<mask token>\n\n\ndef fcn_model_fn(features, labels, mode):\n L2 = tf.contrib.layers.l2_regularizer(scale=0.1)\n trainable = False\n if mode == tf.estimator.ModeKeys.TRAIN:\n trainable = True\n seed = 2019\n w...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python '''Defines classes for representing metadata found in Biographies''' class Date: '''Object to represent dates. Dates can consist of regular day-month-year, but also descriptions (before, after, ca.). Object has attributes for regular parts and one for description, default is empty string.''' ...
normal
{ "blob_id": "9609f23463aa4c7859a8db741c7f3badd78b8553", "index": 6527, "step-1": "#!/usr/bin/python\n\n'''Defines classes for representing metadata found in Biographies'''\n\n\n\nclass Date:\n '''Object to represent dates. Dates can consist of regular day-month-year, but also descriptions (before, after, ca.)...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT) <|reserved_special_token_1|> from app import app from config import config as cfg app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT) <|reserved_special_token_1|...
flexible
{ "blob_id": "f97150f60dfb3924cda2c969141d5bfe675725ef", "index": 9150, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)\n", "step-3": "from app import app\nfrom config import config as cfg\napp.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> LOCAL_INFO = 1 LSM = 2 TLS = 3 TLS_STOP = 4 DANGER = 5 STOP_DANGER = 6 PM = 7 PM_STOP = 8 <|reserved_special_token_1|> # -*- coding: utf-8 -*- """ Created on Thu Feb 15 17:28:48 2018 @author: otalabay """ LOCAL_INFO = ...
flexible
{ "blob_id": "db341c3686c53f1cd9fe98c532f17e872952cbba", "index": 6733, "step-1": "<mask token>\n", "step-2": "<mask token>\nLOCAL_INFO = 1\nLSM = 2\nTLS = 3\nTLS_STOP = 4\nDANGER = 5\nSTOP_DANGER = 6\nPM = 7\nPM_STOP = 8\n", "step-3": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Thu Feb 15 17:28:48 2018\...
[ 0, 1, 2 ]
import functools import requests import time import argparse class TracePoint: classes = [] funcs = [] flow = [] @staticmethod def clear(): TracePoint.classes = [] TracePoint.funcs = [] TracePoint.flow = [] def __init__(self, cls, func, t): if cls not ...
normal
{ "blob_id": "80bf208f1d658b639d650af8208a744ed2dd258f", "index": 9355, "step-1": "<mask token>\n\n\nclass TracePoint:\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def clear():\n TracePoint.classes = []\n TracePoint.funcs = []\n TracePoint.flow = []\n\n d...
[ 6, 9, 11, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def factorial(no): fact = 1 if no < 0: print('-ve no factorial not exist') else: for i in range(1, no + 1): fact = fact * i return fact <|reserved_special_token_0|> <|reserved_...
flexible
{ "blob_id": "2d3ab575b18144f714f06167f54cd069af4e5895", "index": 7506, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef factorial(no):\n fact = 1\n if no < 0:\n print('-ve no factorial not exist')\n else:\n for i in range(1, no + 1):\n fact = fact * i\n retu...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', url('^plugin$', JiraUIWidgetView.as_view()), url ('^config$', JiraConfigView.as_view()), url( '^atlassian-connect\\.json$', JiraDescriptorView.as_view()), url( '^installed$', JiraInstalledCal...
flexible
{ "blob_id": "2440f5bc774f2e2f746a246cbb2e305965c9e576", "index": 7788, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^plugin$', JiraUIWidgetView.as_view()), url\n ('^config$', JiraConfigView.as_view()), url(\n '^atlassian-connect\\\\.json$', JiraDescriptorView.as_vi...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def ModelConvMiniImagenet(out_features, hidden_size=84): return MetaConvModel(3, out_features, hidden_size=hidden_size, feature_size=5 * 5 * hidden_size) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_accuracy(logits, targ...
flexible
{ "blob_id": "e2a50fbd277ab868fbe71f9ff113a68a30b9f893", "index": 2523, "step-1": "<mask token>\n\n\ndef ModelConvMiniImagenet(out_features, hidden_size=84):\n return MetaConvModel(3, out_features, hidden_size=hidden_size,\n feature_size=5 * 5 * hidden_size)\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 1, 2, 4, 5, 6 ]
import copy import pandas as pd import numpy as np from pandas import DataFrame from collections import Counter from sklearn.metrics import roc_auc_score, roc_curve from statsmodels.stats.outliers_influence import variance_inflation_factor class Get_res_DataFrame: ''' sheet1:数据概况 sheet2:变量的大小,效果,相关性 ok ...
normal
{ "blob_id": "6336b31e51f0565c6b34ab5148645748fe899541", "index": 3829, "step-1": "<mask token>\n\n\nclass Get_res_DataFrame:\n <mask token>\n\n def __init__(self, lr, df, df_bin, df_woe, use_lst, woe_dic, type_train\n ='type_train', y='is_7_p'):\n self.df = df\n self.df_bin = df_bin\n ...
[ 11, 12, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/', methods=['GET', 'POST']) @app.route('/index') def index(): return render_template('index.html') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/', me...
flexible
{ "blob_id": "bb3c4039ff224c0ca0305778b938ef969c196033", "index": 8759, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\n@app.route('/index')\ndef index():\n return render_template('index.html')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@app.route(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @unittest.skip('need to make this less brittle') class TestSerialization(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def test_default_serializer(self): from yalp.pipeline import tasks tasks.pro...
flexible
{ "blob_id": "c945dc4df68fe110e8b38713fb77e2dce9efad8d", "index": 8418, "step-1": "<mask token>\n\n\n@unittest.skip('need to make this less brittle')\nclass TestSerialization(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_default_serializer(self):\n from yalp.pipe...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python3 # coding: utf-8 """ Blaise de Vigenère (1523–1596) mathematician, developed encryption scheme, VigenereCipher algorithm is implemented based on his work, with a utility of relative strength index for encryption and decryption. VERSION : 1.0 LICENSE : GNU GPLv3 ...
normal
{ "blob_id": "38906a31ab96e05a9e55a51260632538872ed463", "index": 6889, "step-1": "<mask token>\n\n\nclass VigenereCipher(object):\n\n def __init__(self, key):\n print('Vigenere Cipher Encription')\n self.key = key\n\n def encode(self, text):\n key = self.key\n ans = ''\n ...
[ 8, 9, 11, 12, 13 ]
<|reserved_special_token_0|> class Ccase_model(cgibase): def __init__(self): return cgibase.__init__(self) <|reserved_special_token_0|> def cmadd(self): self.log.debug('cmadd in.') req = self.input['input'] name = req['name'] pid = req['pid'] ip = req['ip'...
flexible
{ "blob_id": "5282e9a9e87fd7fd6053f816048f371fbe190046", "index": 5650, "step-1": "<mask token>\n\n\nclass Ccase_model(cgibase):\n\n def __init__(self):\n return cgibase.__init__(self)\n <mask token>\n\n def cmadd(self):\n self.log.debug('cmadd in.')\n req = self.input['input']\n ...
[ 6, 9, 10, 11, 13 ]
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name = "keputils", version = "0.2.1", description = "Basic module for interaction with KOI and Kepler-stellar tables.", long_description = readme(), author = "Timothy D. Morton", author_email...
normal
{ "blob_id": "6da828a797efac7c37723db96a2682e960c317b5", "index": 1007, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef readme():\n with open('README.rst') as f:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def multiple_parameters(name, location): print(f'Hello {name}') print(f'I live in {location}') <|reserved_special_token_0|> <|reserved_special_token_1|> def multiple_parameters(name, location): print(f'Hello {name}') print(f'I live in {lo...
flexible
{ "blob_id": "baf3bde709ec04b6f41dce8a8b8512ad7847c164", "index": 3100, "step-1": "<mask token>\n", "step-2": "def multiple_parameters(name, location):\n print(f'Hello {name}')\n print(f'I live in {location}')\n\n\n<mask token>\n", "step-3": "def multiple_parameters(name, location):\n print(f'Hello {...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Test: def __init__(self): self.iter_test = 0 <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test: def __init__(self): self.iter_test = 0 def run_epoch(self, session...
flexible
{ "blob_id": "e008f9b11a9b7480e9fb53391870809d6dea5497", "index": 3953, "step-1": "<mask token>\n\n\nclass Test:\n\n def __init__(self):\n self.iter_test = 0\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Test:\n\n def __init__(self):\n self.iter_test = 0\n\n d...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # # Exploit for "assignment" of GoogleCTF 2017 # # CTF-quality exploit... # # Slightly simplified and shortened explanation: # # The bug is a UAF of one or both values during add_assign() if a GC is # triggered during allocate_value(). The exploit first abuses this to leak a # pointer into the he...
normal
{ "blob_id": "e4a05cbfd0959402eacf21959c68e449d15b1e74", "index": 7651, "step-1": "<mask token>\n\n\ndef e(d):\n \"\"\"Encode the given string instance using UTF-8.\"\"\"\n return d.encode('UTF-8')\n\n\n<mask token>\n\n\ndef u32(d):\n \"\"\"Return the number represented by d when interpreted as a 32-bit ...
[ 30, 44, 58, 59, 63 ]
<|reserved_special_token_0|> class RecurrentLayer(object): <|reserved_special_token_0|> def forward(self, input_vec): self.time += 1 state = np.dot(self.U, input_vec) + np.dot(self.W, self.state_list[-1]) element_wise_op(state, self.activator.forward) self.state_list.append(st...
flexible
{ "blob_id": "b34ce3ac87a01b8e80abc3fde1c91638f2896610", "index": 2392, "step-1": "<mask token>\n\n\nclass RecurrentLayer(object):\n <mask token>\n\n def forward(self, input_vec):\n self.time += 1\n state = np.dot(self.U, input_vec) + np.dot(self.W, self.state_list[-1])\n element_wise_o...
[ 3, 8, 9, 10, 12 ]
# -*- coding: utf-8 -*- from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool from django.utils.translation import ugettext_lazy as _ class StaffApp(CMSApp): name = _('Staff') urls = ['blog.urls', ] app_name = 'staff' apphook_pool.register(StaffApp)
normal
{ "blob_id": "40ee790f4272c05c1619eb7b2cc66a8b57bbe8a8", "index": 5988, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name = _('Staff')\n urls = ['blog.urls']\n app_name = 'staff'\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name...
[ 0, 2, 3, 4, 5 ]
import os import numpy as np import networkx as nx from matplotlib import colors, cm from matplotlib import pyplot as plt from matplotlib.collections import LineCollection from mpl_toolkits.mplot3d import Axes3D, art3d from typing import Union, Sequence, List, Tuple, Optional import wknml from wkskel.types import Nod...
normal
{ "blob_id": "365d031a31f3596df6fb71e620c293382d6ead1f", "index": 2635, "step-1": "<mask token>\n\n\nclass Skeleton:\n <mask token>\n <mask token>\n\n def __init__(self, nml_path: str=None, parameters: Parameters=None,\n strict=True):\n \"\"\" The Skeleton constructor expects either a path ...
[ 25, 43, 44, 46, 50 ]
import sublime import sublime_plugin class PromptSurrounderCommand(sublime_plugin.WindowCommand): def run(self): self.window.show_input_panel("Surround by:", "", self.on_done, None, None) def on_done(self, tag): try: if self.window.active_view(): self.window.active_...
normal
{ "blob_id": "bcc4276ea240247519cabbf5fc5646a9147ee3be", "index": 545, "step-1": "<mask token>\n\n\nclass SurroundByCommand(sublime_plugin.TextCommand):\n\n def run(self, edit, tag):\n for region in self.view.sel():\n text = self.view.substr(region)\n self.view.replace(edit, region...
[ 2, 3, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-10 12:20 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Complet...
normal
{ "blob_id": "d2368ab243a0660cf98f1cf89d3d8f6cc85cefaa", "index": 6384, "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 ]
# Should print 516 def final_frequency(): frequency = 0 with open('input') as f: for line in f: frequency += int(line) return frequency print(final_frequency())
normal
{ "blob_id": "4d68b663933070cb287689b70d6ded07958cef22", "index": 3047, "step-1": "<mask token>\n", "step-2": "def final_frequency():\n frequency = 0\n with open('input') as f:\n for line in f:\n frequency += int(line)\n return frequency\n\n\n<mask token>\n", "step-3": "def final_fr...
[ 0, 1, 2, 3 ]
from graphics import * from random import random def printIntro(): print("This program evaluates pi via Monte Carlo techniques") def simDarts(n): win = GraphWin("", 400, 400) win.setCoords(-1.2, -1.2, 1.2, 1.2) hits = 0 for i in range(n): pt = getDarts() if hitTarget(pt): ...
normal
{ "blob_id": "0bf970a84911d29a8343575ef15f2765875b8b89", "index": 9552, "step-1": "<mask token>\n\n\ndef printIntro():\n print('This program evaluates pi via Monte Carlo techniques')\n\n\n<mask token>\n\n\ndef getDarts():\n x = 2 * random() - 1\n y = 2 * random() - 1\n pt = Point(x, y)\n return pt\...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Group(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_1|> ...
flexible
{ "blob_id": "8baf61a20a64f296304b6a7017a24f1216e3d771", "index": 2908, "step-1": "<mask token>\n\n\nclass Group(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Group(models.Model)...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(cadena.replace(' ', separador)) <|reserved_special_token_1|> cadena = input('Introduzca su cadena: ') separador = input('Introduzca el separador: ') print(cadena.replace(' ', separador)) <|reserved_special_token_1|> ca...
flexible
{ "blob_id": "290b8b4c3aeafc84b1e9cce7e6d2a5e770bd8716", "index": 3444, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(cadena.replace(' ', separador))\n", "step-3": "cadena = input('Introduzca su cadena: ')\nseparador = input('Introduzca el separador: ')\nprint(cadena.replace(' ', separador))\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1000): l = str(i).zfill(3) k = 0 for j in range(N): if S[j] == l[k]: k += 1 if k == 3: ans += 1 break print(ans) <|reserved_special_token...
flexible
{ "blob_id": "dabd835ff02f2adb01773fb7dd7099206cbae162", "index": 9903, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1000):\n l = str(i).zfill(3)\n k = 0\n for j in range(N):\n if S[j] == l[k]:\n k += 1\n if k == 3:\n ans += 1\n ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import sqlalchemy as sa import ujson from aiohttp import web, WSMsgType from .db import TLE from .log import logger from .utils import parse_sa_filter, parse_sa_order, check_sa_column, get_sa_column async def query(request): filters = [] if 'filters' not in request.query: rai...
normal
{ "blob_id": "c414e5d3934f741540fb5721a529b48f95e17016", "index": 5982, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def query(request):\n filters = []\n if 'filters' not in request.query:\n raise web.HTTPBadRequest(reason='Query parameter `filters` is required'\n )\n ...
[ 0, 1, 2, 3 ]
import pymysql import logging import socket from models.platformconfig import Pconfig class ncbDB(Pconfig): # I have to retrieve basic configuration attributes, listed below, from system config file # on ApplSrv, for example : /etc/ncb_applsrv/ncb_applsrv.conf hostname = None conferenceMediaStoragePa...
normal
{ "blob_id": "257a4d0b0c713624ea8452dbfd6c5a96c9a426ad", "index": 8344, "step-1": "<mask token>\n\n\nclass ncbDB(Pconfig):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def ncb_getQuery(self, querySQL):\n result = []\n try:\n with self.co...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class ConexionList: <|reserved_special_token_0|> def selectClientes(self): pass def selectProveedores(self): pass <|reserved_special_token_1|> <|reserved_special_token_0|> class ConexionList: def __init__(self): self.conexion = Conexion() ...
flexible
{ "blob_id": "6b4af452778bdf13ac18e8d260cf1c9176ca95e0", "index": 8414, "step-1": "<mask token>\n\n\nclass ConexionList:\n <mask token>\n\n def selectClientes(self):\n pass\n\n def selectProveedores(self):\n pass\n", "step-2": "<mask token>\n\n\nclass ConexionList:\n\n def __init__(sel...
[ 3, 4, 5, 6, 7 ]
<|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": "1c979d505b58025aae74865d6556c726ed3f0769", "index": 2651, "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 = [('api',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(args): return run(args) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(args, fin=sys.stdin, fout=sys.stdout, ferr=sys.stderr, input_data=None ): """ Generic wrapper for MyStem """ mystem_path = mystem.u...
flexible
{ "blob_id": "d4a4ea67a06107ad7ea18bb21fb1ec9e74ccd7c1", "index": 7187, "step-1": "<mask token>\n\n\ndef main(args):\n return run(args)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef run(args, fin=sys.stdin, fout=sys.stdout, ferr=sys.stderr, input_data=None\n ):\n \"\"\" Generic wrapper for ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': s = Snake() s.run() <|reserved_special_token_1|> from snake.snake import Snake if __name__ == '__main__': s = Snake() s.run() <|reserved_special_token_1|> from snake.snake import Sn...
flexible
{ "blob_id": "efed5c113e085e5b41d9169901c18c06111b9077", "index": 8894, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n s = Snake()\n s.run()\n", "step-3": "from snake.snake import Snake\nif __name__ == '__main__':\n s = Snake()\n s.run()\n", "step-4": "from sna...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(r.url) print(r.text) <|reserved_special_token_0|> print(r.text) print(r.url) <|reserved_special_token_0|> print(r.text) print(r) <|reserved_special_token_1|> <|reserved_special_token_0|> url = 'https://www.baidu.com' url ...
flexible
{ "blob_id": "325770130473153d092d3058587e9666625e12d0", "index": 5670, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(r.url)\nprint(r.text)\n<mask token>\nprint(r.text)\nprint(r.url)\n<mask token>\nprint(r.text)\nprint(r)\n", "step-3": "<mask token>\nurl = 'https://www.baidu.com'\nurl = 'http://w...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def draw(): window = turtle.Screen() window.bgcolor('white') brad = turtle.Turtle() brad.shape('turtle') brad.color('blue') brad.speed(6) draw_triangle(brad) window.exitonclick() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_spec...
flexible
{ "blob_id": "33f766bf12a82e25e36537d9d3b745b2444e1fd7", "index": 7042, "step-1": "<mask token>\n\n\ndef draw():\n window = turtle.Screen()\n window.bgcolor('white')\n brad = turtle.Turtle()\n brad.shape('turtle')\n brad.color('blue')\n brad.speed(6)\n draw_triangle(brad)\n window.exitoncl...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def check_filesystem(): """ either start a new checkpoint or continue from existing checkpoint folder """ if FLAGS.continue_run: if not tf.gfile.Exists(FLAGS.summaries_dir): tf.gfile.MakeDirs(FLAGS.summaries_dir) tf.gfile.MakeDirs(os.path.jo...
flexible
{ "blob_id": "f653e906d3026de4bb1e705162f4321bb75e8705", "index": 4166, "step-1": "<mask token>\n\n\ndef check_filesystem():\n \"\"\"\n either start a new checkpoint or continue from existing checkpoint folder\n \"\"\"\n if FLAGS.continue_run:\n if not tf.gfile.Exists(FLAGS.summaries_dir):\n ...
[ 3, 5, 6, 7, 8 ]
__author__ = 'sushil' from .utilities import decompose_date from .DateConverter import _bs_to_ad, _ad_to_bs def convert_to_ad(bs_date): date_components = decompose_date(bs_date) year, month, day = date_components ad_year, ad_month, ad_day = _bs_to_ad(year, month, day) formatted_date = "{}-{:02}-{:02}"...
normal
{ "blob_id": "e7295336a168aa2361a9090e79465eab5f564599", "index": 5076, "step-1": "<mask token>\n\n\ndef convert_to_bs(ad_date):\n date_components = decompose_date(ad_date)\n year, month, day = date_components\n bs_year, bs_month, bs_day = _ad_to_bs(year, month, day)\n formatted_date = '{}-{:02}-{:02}...
[ 1, 2, 3, 4, 5 ]
import numpy as np print(np.random.binomial(10, 0.5, 1))
normal
{ "blob_id": "0a3e0eeda14e42bfff7797b3c42a0aebd9a72ade", "index": 3212, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(np.random.binomial(10, 0.5, 1))\n", "step-3": "import numpy as np\nprint(np.random.binomial(10, 0.5, 1))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
#!python3 """ I1. a Ex1 5 1 3 5 2 1 4 3 2 4 4 1 5 5 2 3 """ n = int(input().strip()) t = [None] * n for i in range(n): x,x1 = [int(i) for i in input().strip().split(' ')] x,x1 = x-1, x1-1 t[i] = [x, x1] res = [0] while len(res) < n: a = res[-1] b = t[a][0] ...
normal
{ "blob_id": "0e3c6e14ff184401a3f30a6198306a17686e6ebe", "index": 2382, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n x, x1 = [int(i) for i in input().strip().split(' ')]\n x, x1 = x - 1, x1 - 1\n t[i] = [x, x1]\n<mask token>\nwhile len(res) < n:\n a = res[-1]\n b = t[...
[ 0, 1, 2, 3 ]
############################################################################### # Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. # # All rights reserved. # # This file is part of the AiiDA-FLEUR package. # ...
normal
{ "blob_id": "1d4a51cfbd5df9ac9074c816a140309e04fff021", "index": 4159, "step-1": "<mask token>\n\n\nclass FleurBaseWorkChain(BaseRestartWorkChain):\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def define(cls, spec):\n super().define(spec)\n spec.expose_inputs(Fleur...
[ 4, 7, 9, 14, 15 ]
""" This module provides an optimizer class that is based on an evolution strategy algorithm. """ import copy, random, math from time import time from xml.dom import minidom from extra.schedule import Schedule from extra.printer import pprint, BLUE class Optimizer(object): """ This class is the implementation of the...
normal
{ "blob_id": "8ce2e9cd9ceed6c79a85682b8bc03a3ffb5131c4", "index": 3817, "step-1": "<mask token>\n\n\nclass Optimizer(object):\n <mask token>\n <mask token>\n\n @staticmethod\n def fromXml(xmlDoc, plant, orderList, simulator, evaluator):\n \"\"\"\n\t\tLoads the optimizer configuration and parame...
[ 10, 11, 12, 13, 16 ]
from enum import Enum from app.utilities.data import Prefab class Tags(Enum): FLOW_CONTROL = 'Flow Control' MUSIC_SOUND = 'Music/Sound' PORTRAIT = 'Portrait' BG_FG = 'Background/Foreground' DIALOGUE_TEXT = 'Dialogue/Text' CURSOR_CAMERA = 'Cursor/Camera' LEVEL_VARS = 'Level-wide Unlocks and ...
normal
{ "blob_id": "c2dba981b0d628aebdf8cebfb890aad74a629b08", "index": 7365, "step-1": "<mask token>\n\n\nclass GiveExp(EventCommand):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SetExp(EventCommand):\n nid = 'set_exp'\n tag = Tags.MODIFY_UNIT_PROPERTIES\n keywords = ['GlobalUnit', 'Posit...
[ 119, 154, 180, 218, 252 ]
<|reserved_special_token_0|> def search(query, finalIndexPath): listOfDicts = list() queryList = set() tempList = query.strip().lower().replace("'", '').split(' ') for word in tempList: if word not in stopWords: queryList.add(word) print('Cleaned query tokens:') print(query...
flexible
{ "blob_id": "19f17044d48c8cc0f9d366cde7edc846ff343462", "index": 2598, "step-1": "<mask token>\n\n\ndef search(query, finalIndexPath):\n listOfDicts = list()\n queryList = set()\n tempList = query.strip().lower().replace(\"'\", '').split(' ')\n for word in tempList:\n if word not in stopWords:...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(db) <|reserved_special_token_1|> <|reserved_special_token_0|> db = Postgresdb() print(db) <|reserved_special_token_1|> from core import Postgresdb db = Postgresdb() print(db)
flexible
{ "blob_id": "962a9781e4f2ad787dd695896b6455c9b336603a", "index": 7178, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(db)\n", "step-3": "<mask token>\ndb = Postgresdb()\nprint(db)\n", "step-4": "from core import Postgresdb\ndb = Postgresdb()\nprint(db)\n", "step-5": null, "step-ids": [ ...
[ 0, 1, 2, 3 ]
# Author: Lijing Wang (lijing52@stanford.edu), 2021 import numpy as np import pandas as pd import gstools as gs import matplotlib.pyplot as plt from matplotlib import patches import seaborn as sns plt.rcParams.update({'font.size': 15}) import os path = os.path.dirname(os.getcwd()) subpath = '/examples/case2_nonline...
normal
{ "blob_id": "09fb99a15c2727da2ef96028aca5513337449f62", "index": 3772, "step-1": "<mask token>\n\n\ndef print_theta(theta, name='theta'):\n theta_pd = pd.DataFrame(theta.reshape(1, -1), index=[name], columns=[\n 'mean', 'variance', 'max_range', 'min_range', 'anisotropy',\n 'head_west'])\n pri...
[ 11, 13, 17, 19, 20 ]
import urllib2 import csv from bs4 import BeautifulSoup url = { "Home ": 'https://www.moneycontrol.com/', # "Market": 'https://www.moneycontrol.com/stocksmarketsindia/', # "Mf Home": 'https://www.moneycontrol.com/mutualfundindia/' } def get_last_element_timestamp(url): conn = urllib2.urlopen(url) html ...
normal
{ "blob_id": "81f75498afcca31e38ea7856c81c291af3ef6673", "index": 7151, "step-1": "<mask token>\n\n\ndef historic_data(url):\n csv_data = urllib2.urlopen(url)\n csv_reader = list(csv.reader(csv_data, delimiter=','))\n return csv_reader[-1]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_last...
[ 1, 3, 4, 5, 6 ]
import os timeslices = ['0_' + str(x) + '_' + str(y) for x in range(30,100) for y in range(0,6)] #print timeslices def make_Folders(names): for n in names: if not os.path.exists(n): os.makedirs(n) make_Folders(timeslices)
normal
{ "blob_id": "426396c981fe56230e39b81e156e7c6877e39055", "index": 2213, "step-1": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n if not os.path.exists(n):\n os.makedirs(n)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef make_Folders(names):\n for n in names:\n ...
[ 1, 2, 3, 4, 5 ]
def is_palindrome_v2(word): '''(string)->boolean returns if word is palindrome (ignores white space)''' if len(word) < 2: return True if(not word[0].isalpha() or not word[1].isalpha()): if(word[0].isalpha()): return is_palindrome_v2(word[:-1]) if(word[-1].isal...
normal
{ "blob_id": "1fbe269c9c09fe58b0df1ebd4354cf9dc31a2f90", "index": 7739, "step-1": "<mask token>\n", "step-2": "def is_palindrome_v2(word):\n \"\"\"(string)->boolean\n returns if word is palindrome (ignores white space)\"\"\"\n if len(word) < 2:\n return True\n if not word[0].isalpha() or not ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Author(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Book(object): def __init__(self, author): self.author = author self.content = b'PlainText of the book' self.label = b'book' class...
flexible
{ "blob_id": "bc843abecfc076c9413498f9ebba0da0857ad3cc", "index": 4103, "step-1": "<mask token>\n\n\nclass Author(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Book(object):\n\n def __init__(self, author):\n self.author = author\n self.content = b'PlainText of the book...
[ 14, 19, 20, 22, 23 ]
""" TODO Chess A.I. """ import os, pygame, board, math, engine, sys, gSmart from pygame.locals import * import engine, board, piece, copy class gSmart: def __init__(self): self.e = engine.engine() self.mtrlW = .75 self.dvlpW = 2 self.aggnW = 2 self.defnW = .5 self.thrndW = 2 sel...
normal
{ "blob_id": "7998c4e0ed2bb683f029342554730464f8ac2a09", "index": 2366, "step-1": "<mask token>\n\n\nclass gSmart:\n <mask token>\n\n def getNextMove(self, b, n):\n gt = gameTree(b, n)\n return gt.miniMax()\n\n def getAllNextMoves(self, b):\n pcs = b.getPieces(b.turn)\n nextMo...
[ 4, 6, 7, 8, 9 ]
from .VimaptException import VimaptException class VimaptAbortOperationException(VimaptException): pass
normal
{ "blob_id": "f52bac3e658a34b82721746364fab11d25d470c4", "index": 5302, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass VimaptAbortOperationException(VimaptException):\n pass\n", "step-3": "from .VimaptException import VimaptException\n\n\nclass VimaptAbortOperationException(VimaptException)...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='champ', version='0.0.1', description= 'Channel modeling in Python', url='https://github.com/sgherbst/champ', author='Steven Herbst', author_email='sherbst@stanford.edu', packages=[ 'champ'], include_package...
flexible
{ "blob_id": "885fd32c9520dfdc2becd6b1a3d0c0f5f5397112", "index": 7449, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='champ', version='0.0.1', description=\n 'Channel modeling in Python', url='https://github.com/sgherbst/champ',\n author='Steven Herbst', author_email='sherbst@stanford.e...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('dwarfs.txt') as fh: i = 1 for line in fh: print('[%d] %s' % (i, line)) i += 1 <|reserved_special_token_1|> with open('dwarfs.txt') as fh: i = 1 for line in fh: print("[%d] %s" % (i, line)) i += 1 ...
flexible
{ "blob_id": "18c4c1e1ee0df835895397488b270a47b1620c30", "index": 8032, "step-1": "<mask token>\n", "step-2": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n print('[%d] %s' % (i, line))\n i += 1\n", "step-3": "with open('dwarfs.txt') as fh:\n i = 1\n for line in fh:\n ...
[ 0, 1, 2 ]
import os from .common import cached_outputs, data_files, test_outputs import nappy.nc_interface.na_to_nc import nappy.nc_interface.nc_to_na def test_convert_nc_2010_to_na_2310(): ffi_in, ffi_out = (2010, 2310) infile = os.path.join(cached_outputs, f"{ffi_in}.nc") outfile = os.path.join(test_outputs, f...
normal
{ "blob_id": "0de657ee173b606ad61d614a6168c00fcd571a70", "index": 74, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_convert_nc_2010_to_na_2310():\n ffi_in, ffi_out = 2010, 2310\n infile = os.path.join(cached_outputs, f'{ffi_in}.nc')\n outfile = os.path.join(test_outputs, f'{ffi_out}...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> S.sendemail(""" this is a test! """) <|reserved_special_token_1|> <|reserved_special_token_0|> S = smtpsend.Smtpsent(SUBJECT='Test') S.sendemail(""" this is a test! """) <|reserved_special_token_1|> import smtpsend S = smtps...
flexible
{ "blob_id": "7754974e79202b2df4ab9a7f69948483042a67cc", "index": 855, "step-1": "<mask token>\n", "step-2": "<mask token>\nS.sendemail(\"\"\"\nthis is a test!\n\"\"\")\n", "step-3": "<mask token>\nS = smtpsend.Smtpsent(SUBJECT='Test')\nS.sendemail(\"\"\"\nthis is a test!\n\"\"\")\n", "step-4": "import smtp...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def is_wcsaxes(axes): """ Tests a `matplotlib.axes.Axes` object to see if it is an instance of `~astropy.visualization.wcsaxes.WCSAxes`. Parameters ---------- axes : `matplotlib.axes` Axes to test. Returns ------- `bool` Result of the ...
flexible
{ "blob_id": "be1ef0aa3868985bf198781ee827bd447588df15", "index": 606, "step-1": "<mask token>\n\n\ndef is_wcsaxes(axes):\n \"\"\"\n Tests a `matplotlib.axes.Axes` object to see if it is an instance of\n `~astropy.visualization.wcsaxes.WCSAxes`.\n\n Parameters\n ----------\n axes : `matplotlib.a...
[ 4, 5, 6, 7, 8 ]
# This file is part of the Adblock Plus web scripts, # Copyright (C) 2006-present eyeo GmbH # # Adblock Plus is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # Adblock Plus is distributed in the hop...
normal
{ "blob_id": "bfc6f6acef26e3dc4f6bf2b76363daec68c53cd1", "index": 5709, "step-1": "# This file is part of the Adblock Plus web scripts,\n# Copyright (C) 2006-present eyeo GmbH\n#\n# Adblock Plus is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version...
[ 0 ]
import shelve from club import Club #загальний бютжет клубів в заданій країні #клуб який має найбільше трофеїв country = input('country: ') FILENAME = "clubs" with shelve.open(FILENAME) as clubs: clubs_by_country = list(filter(lambda s: s.country.lower() == country.lower(), clubs.values())) if len(clubs_b...
normal
{ "blob_id": "1346bf78241b4be00f2da3c22731d2846f9d1ada", "index": 4629, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith shelve.open(FILENAME) as clubs:\n clubs_by_country = list(filter(lambda s: s.country.lower() == country.\n lower(), clubs.values()))\n if len(clubs_by_country) == 0:\n ...
[ 0, 1, 2, 3, 4 ]
from count_freqs import * from eval_gene_tagger import * ''' Using gene.train gene.counts prediction file to evaluate the performance Usage: python viterbi.py gene.counts gene.dev gene_dev.p1.out ''' if __name__ == "__main__": #if len(sys.argv)!=2: # Expect exactly one argument: the training data file # ...
normal
{ "blob_id": "6dda23cc5d0083e72520b0664b6550ccb48e4b4f", "index": 7288, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n counter1 = Hmm(3)\n input_counts = open('gene_NoClass.counts', 'r')\n dev_file = open('gene.dev', 'r+')\n output_file2 = open('gene_dev.NoClass.ou...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(11): newList.append(i * 2) print(newList) <|reserved_special_token_0|> print(newList2) <|reserved_special_token_0|> for name in list: if name.startswith('王'): emptyList.append(name) print(emptyList) ...
flexible
{ "blob_id": "3752b68e151379c57e1494715a45172607f4aead", "index": 8090, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(11):\n newList.append(i * 2)\nprint(newList)\n<mask token>\nprint(newList2)\n<mask token>\nfor name in list:\n if name.startswith('王'):\n emptyList.append(name...
[ 0, 1, 2, 3 ]
import os import sys import csv import math for i in sys.stdin: i = float(i) key = math.floor(i * 10) print('%s\t%s' % (key, i))
normal
{ "blob_id": "ba2f8598ec7e107ac71786cf9191777a93ae2c7a", "index": 2145, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in sys.stdin:\n i = float(i)\n key = math.floor(i * 10)\n print('%s\\t%s' % (key, i))\n", "step-3": "import os\nimport sys\nimport csv\nimport math\nfor i in sys.stdin:\n...
[ 0, 1, 2 ]
from flask.ext.restful import Resource, abort from flask_login import current_user, login_required from peewee import DoesNotExist from redash.authentication.org_resolving import current_org from redash.tasks import record_event class BaseResource(Resource): decorators = [login_required] def __init__(self, ...
normal
{ "blob_id": "71cdddfdd7c1327a8a77808dbdd0ff98d827231f", "index": 945, "step-1": "<mask token>\n\n\nclass BaseResource(Resource):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super(BaseResource, self).__init__(*args, **kwargs)\n self._user = None\n <mask token>\n\n @property...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Question 1') <|reserved_special_token_0|> print() print('Question 2') <|reserved_special_token_0|> print() print('Question 3') <|reserved_special_token_0|> print('%.2f' % b) <|reserved_special_token_0|> print('%.2f' % a) <|reserved_special_token_0|> pr...
flexible
{ "blob_id": "82c426836fee0560e917848084af4ca124e74dff", "index": 7043, "step-1": "<mask token>\n", "step-2": "print('Question 1')\n<mask token>\nprint()\nprint('Question 2')\n<mask token>\nprint()\nprint('Question 3')\n<mask token>\nprint('%.2f' % b)\n<mask token>\nprint('%.2f' % a)\n<mask token>\nprint('%.2f'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Profile) <|reserved_special_token_1|> from django.contrib import admin from .models import Profile from django.contrib.admin.templatetags.admin_list import admin_actions admin.site.register(Profile) <|rese...
flexible
{ "blob_id": "89c44d35559504501e4333ea6ff4d3528f1a4c4f", "index": 5171, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Profile)\n", "step-3": "from django.contrib import admin\nfrom .models import Profile\nfrom django.contrib.admin.templatetags.admin_list import admin_actions\nadmin....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(numero) < 8: while len(numero) < 8: numero = '3' + numero numero = numero[:4] + '-' + numero[4:] print('Numero: ', numero) elif len(numero) > 8: print('Numero invalido') <|reserved_special_token_1|...
flexible
{ "blob_id": "6297256bce1954f041915a1ce0aa0546689850f3", "index": 2256, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(numero) < 8:\n while len(numero) < 8:\n numero = '3' + numero\n numero = numero[:4] + '-' + numero[4:]\n print('Numero: ', numero)\nelif len(numero) > 8:\n print...
[ 0, 1, 2, 3 ]
password = '#Garb1122'
normal
{ "blob_id": "918358f6e8e3f1c601b18a3c08fc6b7c024721ba", "index": 5547, "step-1": "<mask token>\n", "step-2": "password = '#Garb1122'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Node: parent = None children = None weight_sum = 0 def __init__(self, name, weight, linked): self.name = name self.weight = int(weight) self.weight_sum += self.weight self.linked = linked self.children = [] def __str__(se...
flexible
{ "blob_id": "679ca76212b90261683d59899c1189280b6b6e8c", "index": 5953, "step-1": "<mask token>\n\n\nclass Node:\n parent = None\n children = None\n weight_sum = 0\n\n def __init__(self, name, weight, linked):\n self.name = name\n self.weight = int(weight)\n self.weight_sum += sel...
[ 6, 8, 10, 12, 13 ]
<|reserved_special_token_0|> def align_process(house_id): data = np.load('data\\REFIT\\original_data\\%d.npy' % house_id) new_data = [] current_index = 0 current_time = int(data[0][0]) end_time = int(data[-1][0]) + 8 interval_threshold = refit_cfg.separation_threshold isend = 0 data_le...
flexible
{ "blob_id": "30405a6f20a44b2252b6894ef6d0e818861702f8", "index": 9857, "step-1": "<mask token>\n\n\ndef align_process(house_id):\n data = np.load('data\\\\REFIT\\\\original_data\\\\%d.npy' % house_id)\n new_data = []\n current_index = 0\n current_time = int(data[0][0])\n end_time = int(data[-1][0]...
[ 14, 15, 22, 23, 26 ]
def __handle_import(): import sys import os cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_path = os.path.join(cur_path, '../../build/lib/') sys.path.append(lib_path) proto_path = os.path.join(cur_path, '../../build/protobuf_python/') sys.path.append(proto_path...
normal
{ "blob_id": "24595979199199ecc6bc6f3a26e0db418def8b78", "index": 9675, "step-1": "<mask token>\n", "step-2": "def __handle_import():\n import sys\n import os\n cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))\n lib_path = os.path.join(cur_path, '../../build/lib/')\n sys....
[ 0, 1, 2 ]
<|reserved_special_token_0|> def con(): pool = redis.ConnectionPool(host='ap2.jd.local', port=5360, password= '/redis/cluster/1:1803528818953446384') r = redis.StrictRedis(connection_pool=pool) r.set('foo', 'bar') print(r.get('foo')) def findUrl(url): html = getHtml(url) x = isJd(htm...
flexible
{ "blob_id": "4863581a1a557186ceee8d544d1a996082edcf2c", "index": 4644, "step-1": "<mask token>\n\n\ndef con():\n pool = redis.ConnectionPool(host='ap2.jd.local', port=5360, password=\n '/redis/cluster/1:1803528818953446384')\n r = redis.StrictRedis(connection_pool=pool)\n r.set('foo', 'bar')\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NombreaplicacionConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class NombreaplicacionConfig(AppConfig): name = 'nombreAplicacion' <|reserved_special...
flexible
{ "blob_id": "0c7efa99dc22154f9835b277cba5057b213a28e7", "index": 2414, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NombreaplicacionConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NombreaplicacionConfig(AppConfig):\n name = 'nombreAplicacion'\n", "step-4": "...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- import random IMAGES = [''' +---+ | | | | | | =========''', ''' +---+ | | O | | | | =========''', ''' +---+ | | O | | | | | =========''', ''' ...
normal
{ "blob_id": "074defa92c8bc5afc221c9c19842d808fbf1e112", "index": 197, "step-1": "<mask token>\n\n\ndef run():\n word = randomWord()\n hiddenWord = ['-'] * len(word)\n tries = 0\n while True:\n displayBoard(hiddenWord, tries)\n currentLetter = str(raw_input('Escoge una letra: '))\n ...
[ 1, 4, 5, 6, 7 ]
#Diagonal Traverse #Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. #Example: #Input: #[ # [ 1, 2, 3 ], # [ 4, 5, 6 ], # [ 7, 8, 9 ] #] #Output: [1,2,4,7,5,3,6,8,9] #Explanation: #Note: # The total number of elements of the given...
normal
{ "blob_id": "0a5ea7ad0ee34c8a3f0299908c61fa0a09139d2f", "index": 8558, "step-1": "#Diagonal Traverse\n#Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal\norder as shown in the below image.\n#Example:\n#Input:\n#[\n# [ 1, 2, 3 ],\n# [ 4, 5, 6 ],\n# [ 7, 8, 9 ]\n#]...
[ 0 ]
def somaSerie(valor): soma = 0 for i in range(valor): soma += ((i**2)+1)/(i+3) return soma a = int(input("Digite o 1º Numero :-> ")) result = somaSerie(a) print(result)
normal
{ "blob_id": "8114d8162bab625854804d1df2b4a9c11818d35e", "index": 3747, "step-1": "<mask token>\n", "step-2": "def somaSerie(valor):\n soma = 0\n for i in range(valor):\n soma += (i ** 2 + 1) / (i + 3)\n return soma\n\n\n<mask token>\n", "step-3": "def somaSerie(valor):\n soma = 0\n for ...
[ 0, 1, 2, 3, 4 ]
import unittest import calla.test TestCase = calla.test.TestCase from math import pi from calla.TB.RC_strength import * class test(TestCase): def test1(self): """ 标准验证:铁路混凝土结构设计原理(容许应力计算法).ppt 例1 """ b = 200 h0 = 411 As = 763 n = 15 M = 31.5 r...
normal
{ "blob_id": "acb9b6128a3432aecf3498e1d27bdff204fee0f4", "index": 8110, "step-1": "<mask token>\n\n\nclass test(TestCase):\n <mask token>\n\n def test2(self):\n \"\"\"\n 标准验证:混凝土结构基本原理答案吕晓寅版第12章\n \"\"\"\n b = 250\n h = 350\n l0 = 5\n a = 40\n a_ = 40\...
[ 4, 5, 6, 8, 9 ]
l, w, h = map(int, input().split()) TSA = 2 * (l * w + w * h + h * l) V = l * w * h print(TSA, V)
normal
{ "blob_id": "d3382ead1d98ba2fb15fe3ea277430f1bb07131c", "index": 2544, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(TSA, V)\n", "step-3": "l, w, h = map(int, input().split())\nTSA = 2 * (l * w + w * h + h * l)\nV = l * w * h\nprint(TSA, V)\n", "step-4": null, "step-5": null, "step-ids": [...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "8af9cc32b445402fa790b29382a802bd8afc1100", "index": 5655, "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', '000...
[ 0, 1, 2, 3, 4 ]
# def test_categories: # ["5S", "5H", "5D", "4S", "4H", "4D", "3D", "3S"] import unittest from poker import Hand, makeCard, Rank, count_ranks, RankCount, max_straight class TestHand(unittest.TestCase): # def test_heap_multiples(self): # heaped_multiples = Hand.heap_multiples({"J":4, "2":3}) # prin...
normal
{ "blob_id": "5b8d1bd026e97bb7508a500048f940abf0253471", "index": 9698, "step-1": "<mask token>\n\n\nclass TestHand(unittest.TestCase):\n\n def test_max_straight(self):\n cards = map(makeCard, ['10S', '6S', '9S', '8S', '7S'])\n straight = max_straight(cards)\n self.assertEqual(straight, so...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print("this's rstrip() function---------") print(str1.rstrip('c')) print(str1.rstrip('d')) <|reserved_special_token_0|> print("this's replace function----------") print(str3.replace('is', 'was')) print(str3.replace('is', 'was', 3)...
flexible
{ "blob_id": "59170e6b0b0705b9908ed1c32bbea87373126594", "index": 9484, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"this's rstrip() function---------\")\nprint(str1.rstrip('c'))\nprint(str1.rstrip('d'))\n<mask token>\nprint(\"this's replace function----------\")\nprint(str3.replace('is', 'was')...
[ 0, 1, 2, 3 ]
def TongTien(m1,m2,s): if s <=100: tong = m1 * s else: tong = m1 * 100 + m2 * (s-100) print tong m1 = float(raw_input("nhap gia m1 :")) m2 = float(raw_input("nhap gia m2 :")) s = int (raw_input("nhap so dien da dung :")) TongTien(m1,m2,s)
normal
{ "blob_id": "1de8c129769827c7fe763ce221cb9fdf8226e473", "index": 114, "step-1": "def TongTien(m1,m2,s):\n\n\tif s <=100:\n\t\ttong = m1 * s\n\telse:\n\t\ttong = m1 * 100 + m2 * (s-100)\n\n\n\tprint tong\n\n\nm1 = float(raw_input(\"nhap gia m1 :\"))\n\nm2 = float(raw_input(\"nhap gia m2 :\"))\n\ns = int (raw_inp...
[ 0 ]
#encoding:utf-8 x="There are %d types of peopel."%10 #定义字符串变量x,将10以%d方式输出 binary="binary" do_not="don't" #定义字符串变量binary和do_not y="Those who know %s and those who %s."%(binary,do_not) #使用binary和do_not定义字符串变量y print x print y #打印以上两个变量 print "I said:%r"%x print "I also said:%r."%y #用%r的格式输出以上两个变量 hilarious=False joke_...
normal
{ "blob_id": "c2ba60a321eff63f6321831093d7254f6939549b", "index": 9040, "step-1": "#encoding:utf-8\nx=\"There are %d types of peopel.\"%10\n#定义字符串变量x,将10以%d方式输出\nbinary=\"binary\"\ndo_not=\"don't\"\n#定义字符串变量binary和do_not\ny=\"Those who know %s and those who %s.\"%(binary,do_not)\n#使用binary和do_not定义字符串变量y\n\nprint...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in fileobj3.readlines(): print(line) fileobj3.close() <|reserved_special_token_1|> <|reserved_special_token_0|> fileobj3 = open('lines.txt', 'r') for line in fileobj3.readlines(): print(line) fileobj3.close() ...
flexible
{ "blob_id": "25f3c9f48b779d2aec260d529529156ff3c508ca", "index": 7719, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in fileobj3.readlines():\n print(line)\nfileobj3.close()\n", "step-3": "<mask token>\nfileobj3 = open('lines.txt', 'r')\nfor line in fileobj3.readlines():\n print(line)\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def view2(request): context = {'tag_var': 'tag_var'} return render(request, 'new.html', context) <|reserved_special_token_1|> <|reserved_special_token_0|> def view1(request): return HttpResponse(' Hey..,This is ...
flexible
{ "blob_id": "c9b62328a463fd38f3dbd1e7b5e1990f7eec1dba", "index": 9793, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef view2(request):\n context = {'tag_var': 'tag_var'}\n return render(request, 'new.html', context)\n", "step-3": "<mask token>\n\n\ndef view1(request):\n return HttpRespo...
[ 0, 1, 2, 3, 4 ]
import Pyro4 from Pyro4 import Daemon, Proxy from threading import Thread import thread import pickle import socket Pyro4.config.REQUIRE_EXPOSE = False def register(obj): ''' Register an object with daemon ''' daemon = Pyro4.Daemon(host="localhost") uri = daemon.register(obj) # Scheduler serve_daemon(...
normal
{ "blob_id": "02cd99f0a265fe01835a6adc211e750a58d993fd", "index": 6610, "step-1": "import Pyro4\nfrom Pyro4 import Daemon, Proxy\nfrom threading import Thread\nimport thread\nimport pickle\nimport socket\n\nPyro4.config.REQUIRE_EXPOSE = False\n\ndef register(obj):\n ''' Register an object with daemon '''\n ...
[ 0 ]
""" Main class of the interface. It setups the experimental parameters such as the :class:`.Experiment`'s and :class:`.Sample`, geometry (:attr:`geometry <Stratagem.geometry>`), type of :math:`\\phi(\\rho z)` model (:attr:`prz_mode <Stratagem.prz_mode>`) and fluorescence mode (:attr:`fluorescence <Stratagem.fluoresce...
normal
{ "blob_id": "6914656a2f78fa1fe74a67bf09b017585b3eac88", "index": 2770, "step-1": "<mask token>\n\n\nclass Stratagem:\n <mask token>\n\n def __init__(self, dll_path=None, display_error=True):\n \"\"\"\n :arg dll_path: complete path to the location of ``stratadllogger.dll``\n (option...
[ 21, 23, 38, 39, 40 ]
from pyftpdlib.authorizers import DummyAuthorizer # Autorizaciones from pyftpdlib.handlers import FTPHandler # Comandos del usuario from pyftpdlib.servers import FTPServer # Creacion del servidor import logging import os def main(): # Instancia un autorizador dummy para controlar usuarios "virtuales" auth...
normal
{ "blob_id": "a12fe733e607b1ce4cf0f3f4adc3ea85d082e769", "index": 6615, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n authorizer = DummyAuthorizer()\n authorizer.add_user('user', '12345', '.', perm='elradfmwMT')\n authorizer.add_anonymous(os.getcwd())\n handler = FTPHandler\...
[ 0, 1, 2, 3, 4 ]
from django.urls import path from . import views # . current directory urlpatterns = [ path("", views.index, name="index"), path("login", views.login_view, name="login"), path("logout", views.logout_view, name="logout"), path("menu", views.menu, name="menu"), path("add_item", views.add_item, name="...
normal
{ "blob_id": "9be6940fc6f405db652d478f9a74fcf56d8a0ad7", "index": 3470, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.index, name='index'), path('login', views.\n login_view, name='login'), path('logout', views.logout_view, name=\n 'logout'), path('menu', views.menu, n...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Aplicação H2HC criado para CTF Exploit criado por M4v3r1ck (helvio_junior[at]hotmail[dot]com) ''' from pwn import * import os context(arch='amd64', os='windows', log_level='debug') host= "192.168.255.201" port = 54345 # Estágio 1 log.info("Enviando estágio 1") payload1...
normal
{ "blob_id": "4fff64a62776a9d1b06cc11d5e55fc00f6787338", "index": 8128, "step-1": "<mask token>\n", "step-2": "<mask token>\ncontext(arch='amd64', os='windows', log_level='debug')\n<mask token>\nlog.info('Enviando estágio 1')\n<mask token>\npayload1 += 'ÿ\\x00\\x00\\x00'\npayload1 += 'A' * 255\npayload1 += '\\n...
[ 0, 1, 2, 3, 4 ]
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
normal
{ "blob_id": "b694c834555843cc31617c944fa873f15be2b9c5", "index": 9598, "step-1": "<mask token>\n\n\nclass IntegrityConstraintViolationError(_base.EdgeDBError):\n <mask token>\n\n\nclass MissingRequiredPointerError(IntegrityConstraintViolationError):\n code = '23502'\n\n def __init__(self, msg, *, source...
[ 17, 18, 19, 23, 24 ]
from string import maketrans def to_rna(str): strtrans = maketrans('ACGT', 'UGCA') return str.translate(strtrans)
normal
{ "blob_id": "aace7bc6684f4a9cec2f8fe270b5123a375780af", "index": 8059, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef to_rna(str):\n strtrans = maketrans('ACGT', 'UGCA')\n return str.translate(strtrans)\n", "step-3": "from string import maketrans\n\n\ndef to_rna(str):\n strtrans = make...
[ 0, 1, 2 ]
# This script created by Joseph Aaron Campbell - 10/2020 """ With Help from Agisoft Forum @: https://www.agisoft.com/forum/index.php?topic=12027.msg53791#msg53791 """ """ Set up Working Environment """ # import Metashape library module import Metashape # create a reference to the current project via Document...
normal
{ "blob_id": "dcfc6d76730ba3b33e64cc8f2c166f739bbde5ff", "index": 3655, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('parent Folder is : ' + parentFolderPath)\n<mask token>\nprint('output folder: ' + str(outputFolder))\nprint('output chunk folder: ' + str(outputChunkFolder))\nprint('mask output fo...
[ 0, 1, 2, 3, 4 ]
# 15650번 수열 2번째 n, m = list(map(int, input().split())) arr = [i for i in range(1,n+1)] check = [] def seq(ctn, array, l): if sorted(check) in array: return # if ctn == m: # # l+=1 # # print('ctn :',ctn,' check :',sorted(check)) # array.append(sorted(check)) # for k in ...
normal
{ "blob_id": "dc5d56d65417dd8061a018a2f07132b03e2d616e", "index": 5127, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef seq(ctn, array, l):\n if sorted(check) in array:\n return\n for i in range(n):\n l += 1\n check.append(arr[i])\n seq(ctn + 1, array, l)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def value(energy, noise, x, gen): logp_x = energy(x) logq_x = noise.log_prob(x).unsqueeze(1) logp_gen = energy(gen) logq_gen = noise.log_prob(gen).unsqueeze(1) ll_data = logp_x - torch.logsumexp(torch.cat([logp_x, logq_x], dim=1), dim=1, keepdim=True) ll_ge...
flexible
{ "blob_id": "010a132645883915eff605ae15696a1fac42d570", "index": 8276, "step-1": "<mask token>\n\n\ndef value(energy, noise, x, gen):\n logp_x = energy(x)\n logq_x = noise.log_prob(x).unsqueeze(1)\n logp_gen = energy(gen)\n logq_gen = noise.log_prob(gen).unsqueeze(1)\n ll_data = logp_x - torch.log...
[ 7, 8, 9, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> version = '2.3' date = 'Thu Apr 11 20:57:18 2019' dev = False version_info = 'networkx', '2', '3', None date_info = datetime.datetime(2019, 4, 11, 20, 57, 18) vcs_info = None, (None, None) <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "814191a577db279389975e5a02e72cd817254275", "index": 9444, "step-1": "<mask token>\n", "step-2": "<mask token>\nversion = '2.3'\ndate = 'Thu Apr 11 20:57:18 2019'\ndev = False\nversion_info = 'networkx', '2', '3', None\ndate_info = datetime.datetime(2019, 4, 11, 20, 57, 18)\nvcs_info = None, (None,...
[ 0, 1, 2, 3 ]
def increment(number: int) ->int: """Increment a number. Args: number (int): The number to increment. Returns: int: The incremented number. """ return number + 1
normal
{ "blob_id": "b0cc2efda4d6586b66e04b41dfe1bbce8d009e2e", "index": 6871, "step-1": "<mask token>\n", "step-2": "def increment(number: int) ->int:\n \"\"\"Increment a number.\n\n Args:\n number (int): The number to increment.\n\n Returns:\n int: The incremented number.\n \"\"\"\n retu...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.chdir( 'C:\\Users\\Alex\\Documents\\GitHub\\insight-articles-project\\src\\topic modeling\\' ) <|reserved_special_token_0|> with open(filename, 'rb') as fp: topic_assignments, meta_topic_assignments = pickle.load(fp...
flexible
{ "blob_id": "d98db745be2ab9c506a98539b25e9b46e4997136", "index": 3422, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(\n 'C:\\\\Users\\\\Alex\\\\Documents\\\\GitHub\\\\insight-articles-project\\\\src\\\\topic modeling\\\\'\n )\n<mask token>\nwith open(filename, 'rb') as fp:\n topic_assi...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # This file is auto-generated, don't edit it. Thanks. from Tea.model import TeaModel class CreateCertificateRequest(TeaModel): def __init__(self, domain=None, certificate=None, private_key=None, certificate_name=None, instance_id=None): self.domain = domain # type: str sel...
normal
{ "blob_id": "addf92a3d4060fa9464a802a4a4378cf9eeadde4", "index": 2545, "step-1": "<mask token>\n\n\nclass DescribeDomainResponseBodyDomainCloudNativeInstancesProtocolPortConfigs(\n TeaModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass DescribeDomainResponseBodyDomainClo...
[ 426, 429, 443, 447, 577 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ContactRequestForm(ModelForm): class Meta: model = ContactRequest <|reserved_special_token_1|> from django.forms import ModelForm from contactform.models import ContactRequest class ContactRequestForm(Mo...
flexible
{ "blob_id": "97637e2114254b41ef6e777e60b3ddab1d4622e8", "index": 4606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ContactRequestForm(ModelForm):\n\n\n class Meta:\n model = ContactRequest\n", "step-3": "from django.forms import ModelForm\nfrom contactform.models import ContactRe...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def set_sns_standard(context='paper', font_scale=1.4, linewidth=1.5, font= 'serif'): rc_params = {'lines.linewidth': linewidth, 'text.usetex': True} sns.set(style='ticks', font=font, palette='Set1', context=context, ...
flexible
{ "blob_id": "b935c48210b1965ebb0de78384f279b71fc17d5d", "index": 7044, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef set_sns_standard(context='paper', font_scale=1.4, linewidth=1.5, font=\n 'serif'):\n rc_params = {'lines.linewidth': linewidth, 'text.usetex': True}\n sns.set(style='tick...
[ 0, 2, 3, 4, 5 ]