code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from __future__ import print_function from __future__ import absolute_import # # LinkedIn Sales Module # import requests from bs4 import BeautifulSoup import logging from plugins.base import PageGrabber from plugins.colors import BodyColors as bc import json try: import __builtin__ as bi except: import builtins...
normal
{ "blob_id": "570e0d46aa1ea88d1784447e8f693199e3c3b6ad", "index": 9488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LinkedInGrabber(PageGrabber):\n\n def get_info(self, email):\n client = requests.Session()\n print('[' + bc.CPRP + '?' + bc.CEND + '] ' + bc.CCYN + 'LinkedIn' +...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/env python # coding: utf-8 import sys sys.path.insert(0, "/code/huggingface/transformers-fair-wmt/src") import logging logging.disable(logging.INFO) # disable INFO and DEBUG logger everywhere from transformers.tokenization_fsmt import FSMTTokenizer from transformers.modeling_fsmt import FSMTForConditional...
normal
{ "blob_id": "7864138459caf469a0148420718b2282598141de", "index": 6674, "step-1": "<mask token>\n\n\ndef translate(src, tgt, text):\n mname = f'stas/wmt19-{src}-{tgt}'\n tokenizer = FSMTTokenizer.from_pretrained(mname)\n model = FSMTForConditionalGeneration.from_pretrained(mname)\n encoded = tokenizer...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class BuildDataset(data.Dataset): <|reserved_special_token_0|> def __init__(self, imgs_path, labels, extra_info=None, transform=None): """ The constructor gets the images path and their respectively labels and extra information (if it exists). In addition,...
flexible
{ "blob_id": "4e31c2a80bec77a1f5aafc8a91617fb4b2941788", "index": 432, "step-1": "<mask token>\n\n\nclass BuildDataset(data.Dataset):\n <mask token>\n\n def __init__(self, imgs_path, labels, extra_info=None, transform=None):\n \"\"\"\n The constructor gets the images path and their respectivel...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class trinet(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def generate_image_left(self, img, disp): return bilinear_sampler_1d_h(img, -disp) def generate_image_right(self, img...
flexible
{ "blob_id": "fbd8af4ab3e4ebdcb07509db776d38f9c26fd06a", "index": 9446, "step-1": "<mask token>\n\n\nclass trinet(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def generate_image_left(self, img, disp):\n return bilinear_sampler_1d_h(img, -disp)\n\n def generate_...
[ 8, 14, 15, 17, 18 ]
from django.views.generic import ListView class ExperimentList(ListView): pass
normal
{ "blob_id": "10990282c8aa0b9b26a69e451132ff37257acbc6", "index": 3331, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ExperimentList(ListView):\n pass\n", "step-3": "from django.views.generic import ListView\n\n\nclass ExperimentList(ListView):\n pass\n", "step-4": null, "step-5": n...
[ 0, 1, 2 ]
import xlrd from django.shortcuts import redirect from django.contrib import messages from django.utils.translation import ugettext_lazy as _ from django.core import validators from utils.views import render_to from accounts.models import Account from .models import ExternalSubscriber from .forms import ExternalSubsc...
normal
{ "blob_id": "2ec41e02c95a270455c096e85829b7220eeda0c7", "index": 1317, "step-1": "<mask token>\n\n\ndef validate_email(value, row_number):\n error_message = _(u'Invalid e-mail address on \"%d\" line.')\n return validators.EmailValidator(validators.email_re, unicode(\n error_message % row_number), 'i...
[ 2, 3, 4, 5, 6 ]
a = ['a', 'b', 'c', 'd', 'e'] print(';'.join(a))
normal
{ "blob_id": "a10403d7809b97c1bcdfa73224b8c365519cc456", "index": 7275, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(';'.join(a))\n", "step-3": "a = ['a', 'b', 'c', 'd', 'e']\nprint(';'.join(a))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import sys def main(): lines = [line.strip() for line in sys.stdin.readlines()] h = lines.index("") w = len(lines[0].split()[0]) start = 0 grids = set() while start < len(lines): grid = tuple(x.split()[0] for x in lines[start:start + h]) if len(grid) == h: grids.add(grid) start += h + 1 ...
normal
{ "blob_id": "6ef8a174dcce633b526ce7d6fdb6ceb11089b177", "index": 3652, "step-1": "import sys\n\ndef main():\n lines = [line.strip() for line in sys.stdin.readlines()]\n h = lines.index(\"\")\n w = len(lines[0].split()[0])\n start = 0\n grids = set()\n while start < len(lines):\n grid = tuple(x.split()[0...
[ 0 ]
<|reserved_special_token_0|> class AtomExtensionGrammar(extension.ExtensionGrammar): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AtomExtensionGrammar(extension.ExtensionGrammar): <|reserved_...
flexible
{ "blob_id": "ac5c6a534d5131438d9590b070e6b392d4ebed0c", "index": 9764, "step-1": "<mask token>\n\n\nclass AtomExtensionGrammar(extension.ExtensionGrammar):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AtomExtensionGrammar(extension.ExtensionGrammar):\n <mask t...
[ 1, 2, 3, 4 ]
import numpy as np import cPickle as pkl data_l = [] data_path = "/home/marc/data/" with open(data_path+'covtype.data') as fp: for line in fp: tmp_l = [ int(elem) for elem in line.split(',') ] data_l.append(tmp_l) data = np.array(data_l) np.random.shuffle(data) quintil = data.shape[0]/5 train_x = data[:qu...
normal
{ "blob_id": "c8975306473dda49be6c5f19f6663214ec7e7105", "index": 7655, "step-1": "import numpy as np\nimport cPickle as pkl\n\n\n\ndata_l = []\ndata_path = \"/home/marc/data/\"\nwith open(data_path+'covtype.data') as fp:\n for line in fp:\n\t\ttmp_l = [ int(elem) for elem in line.split(',') ]\n\t\tdata_l.appe...
[ 0 ]
<|reserved_special_token_0|> class TopoPlot(object): <|reserved_special_token_0|> def __init__(self, data=None, axes=None): """Setup defaults. Parameters ---------- data : Pandas.Series or dict Pandas Series with values indexed by electrodes. axes : matplo...
flexible
{ "blob_id": "5bd7160b6b2e283e221aeb0a6913e6d13511c1db", "index": 7073, "step-1": "<mask token>\n\n\nclass TopoPlot(object):\n <mask token>\n\n def __init__(self, data=None, axes=None):\n \"\"\"Setup defaults.\n\n Parameters\n ----------\n data : Pandas.Series or dict\n ...
[ 19, 22, 23, 25, 30 ]
def quick_sort(arr): q_sort(arr, 0, len(arr) - 1) def q_sort(arr, left, right): if left < right: pivot_index = partition(arr, left, right) q_sort(arr, left, pivot_index - 1) q_sort(arr, pivot_index + 1, right) <|reserved_special_token_0|> <|reserved_special_token_1|> def quick_sor...
flexible
{ "blob_id": "09a5c96b7f496aca6b34d7f0a83d5b1e182ca409", "index": 1627, "step-1": "def quick_sort(arr):\n q_sort(arr, 0, len(arr) - 1)\n\n\ndef q_sort(arr, left, right):\n if left < right:\n pivot_index = partition(arr, left, right)\n q_sort(arr, left, pivot_index - 1)\n q_sort(arr, piv...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def change_label(): var.set(random.choice(ch)) <|reserved_special_token_0|> def slove(): expr.set(eval(expr.get())) <|reserved_special_token_0|> def clear(): expr.set('') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> var.se...
flexible
{ "blob_id": "33938a28aad29e996255827825a0cdb1db6b70b7", "index": 5842, "step-1": "<mask token>\n\n\ndef change_label():\n var.set(random.choice(ch))\n\n\n<mask token>\n\n\ndef slove():\n expr.set(eval(expr.get()))\n\n\n<mask token>\n\n\ndef clear():\n expr.set('')\n\n\n<mask token>\n", "step-2": "<mas...
[ 3, 4, 5, 6, 7 ]
numero_uno=int(input("ingresa el primer numero ")) numero_dos=int(input("ingresa el segundo numero ")) print(numero_uno) print(numero_dos) total=numero_uno +numero_dos print("el total de la suma de : "+str(numero_uno)+" + "+str(numero_dos)+" es = a "+str(total))
normal
{ "blob_id": "5685befae923fc336a2a5e0eb5e382c2e7d82d04", "index": 9613, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(numero_uno)\nprint(numero_dos)\n<mask token>\nprint('el total de la suma de : ' + str(numero_uno) + ' + ' + str(\n numero_dos) + ' es = a ' + str(total))\n", "step-3": "numero...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> _base_ = '../model.py' model = dict(type='ImageClassifier', task='classification', pretrained=None, backbone=dict(), head=dict(in_channels=-1, loss=dict(type= 'CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) checkpoint_config = dict(type='Checkpoin...
flexible
{ "blob_id": "8bd5eff12e68f7145676f5e089b51376a82ab489", "index": 3231, "step-1": "<mask token>\n", "step-2": "_base_ = '../model.py'\nmodel = dict(type='ImageClassifier', task='classification', pretrained=None,\n backbone=dict(), head=dict(in_channels=-1, loss=dict(type=\n 'CrossEntropyLoss', loss_weight...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} INSTALLED_APPS = ('django.contrib.auth', 'django.contrib.admin', 'django.contrib.sessions', 'django.contrib.contenttypes', 'django.c...
flexible
{ "blob_id": "34ecf2bd9bc72a98aba4584880a198dd24899dbe", "index": 6218, "step-1": "<mask token>\n", "step-2": "<mask token>\nDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':\n ':memory:'}}\nINSTALLED_APPS = ('django.contrib.auth', 'django.contrib.admin',\n 'django.contrib.sessions'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def on_action(relay_option, number): """To turn on the chosen relay""" relay_option.on() print(f'relay {number} is turning on') <|reserved_special_token_0|> def toggle_action(relay_option, number): """To toggle the chosen relay""" print(f'relay {number} is toggling...
flexible
{ "blob_id": "d82412055affc96d634957c953a35ea69b7e702f", "index": 403, "step-1": "<mask token>\n\n\ndef on_action(relay_option, number):\n \"\"\"To turn on the chosen relay\"\"\"\n relay_option.on()\n print(f'relay {number} is turning on')\n\n\n<mask token>\n\n\ndef toggle_action(relay_option, number):\n...
[ 6, 7, 9, 10, 11 ]
#GUIcal.py from tkinter import * from tkinter import ttk import math GUI=Tk() GUI.title('My Cal Program') GUI.geometry('500x500') def calc(): height=v_height.get() base=v_base.get()#ดึงค่ามาจากv_base print(f'height is {height}') print(f'Basal length is {base}') length= math.isqrt((height*height)+(b...
normal
{ "blob_id": "77d7fb49ed4c3e78b148cd446e9a5c6a0e6fac8b", "index": 835, "step-1": "<mask token>\n\n\ndef calc():\n height = v_height.get()\n base = v_base.get()\n print(f'height is {height}')\n print(f'Basal length is {base}')\n length = math.isqrt(height * height + base * base)\n print('Lenght i...
[ 1, 2, 3, 4, 5 ]
# This is main file where we create the instances of Movie class # and run the file to view the movie website page # we have to import media where class Movie is defined and # fresh_tomatoes python files import fresh_tomatoes import media # Each instance has 8 arguments: Title, story line, poster image, # trailer url...
normal
{ "blob_id": "9dfc8414628a8b09de3c24c504dd4163efdd3d35", "index": 6010, "step-1": "<mask token>\n", "step-2": "<mask token>\nfresh_tomatoes.open_movies_page(movies)\n", "step-3": "<mask token>\nalien_covenant = media.Movie('Alien: Covenant',\n 'The crew of a colony ship, bound for a remote planet, discover...
[ 0, 1, 2, 3, 4 ]
from .factories import *
normal
{ "blob_id": "c036e6a0a9f06b08ee3eb43655dd833b46fd1e76", "index": 3690, "step-1": "<mask token>\n", "step-2": "from .factories import *\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|> krait.mvc.set_init_ctrl(ws.WsPageController()) <|reserved_special_token_1|> import krait from ctrl import ws krait.mvc.set_init_ctrl(ws.WsPageController())
flexible
{ "blob_id": "da2b946238b429188fe3fa50286658d4b5cdbf41", "index": 5752, "step-1": "<mask token>\n", "step-2": "<mask token>\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n", "step-3": "import krait\nfrom ctrl import ws\nkrait.mvc.set_init_ctrl(ws.WsPageController())\n", "step-4": null, "step-5": null, ...
[ 0, 1, 2 ]
""" Package for haasplugin. """
normal
{ "blob_id": "20518302b6a67f8f1ac01f1adf4fe06ab2eaf280", "index": 3098, "step-1": "<mask token>\n", "step-2": "\"\"\"\nPackage for haasplugin.\n\"\"\"\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Netonix: <|reserved_special_token_0|> def _get(self, url, params=None, timeout=15, **kwargs): full_url = 'https://' + self.ip + self.url[url] return self.s.get(full_url, params=params, timeout=timeout, **kwargs) <|reserved_special_token_0|> @staticm...
flexible
{ "blob_id": "743d261052e4532c1304647501719ad897224b4e", "index": 8991, "step-1": "<mask token>\n\n\nclass Netonix:\n <mask token>\n\n def _get(self, url, params=None, timeout=15, **kwargs):\n full_url = 'https://' + self.ip + self.url[url]\n return self.s.get(full_url, params=params, timeout=...
[ 9, 11, 13, 14, 20 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-11 03:58 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('produksi', '0055_auto_20190409_1316'), ] operations = [ migrations.R...
normal
{ "blob_id": "1eb5df463bbd39002c5dbc3f88459e2f26d4b465", "index": 8505, "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 = [('produksi', ...
[ 0, 1, 2, 3, 4 ]
#@@---------------------------@@ # Author: Chamil Jayasundara # Date: 5/18/17 # Description: Extract SFLOW data from slow logs #@@---------------------------@@ import itertools from collections import defaultdict """Flow Sample and Datagram Objects""" class Container(object): def __init__(self, id): ...
normal
{ "blob_id": "395ff2e7c052b57548151fc71fad971c94ebceea", "index": 3974, "step-1": "<mask token>\n\n\nclass WithinDatagram(object):\n\n def __init__(self, traceObj):\n self.Trace = traceObj\n self.current_datagram = None\n <mask token>\n\n\nclass WithinFlowsample(object):\n\n def __init__(se...
[ 9, 12, 14, 16, 23 ]
<|reserved_special_token_0|> class GenericPower(Entity): <|reserved_special_token_0|> def __init__(self, unique_id, entity_type=EntityType.find(100), name= 'Unnamed entity', state=STATE_UNKNOWN, state_value=None, last_checkin=0 ): Entity.__init__(self, unique_id, entity_type, name=nam...
flexible
{ "blob_id": "18e76df1693d4fc27620a0cf491c33197caa5d15", "index": 4055, "step-1": "<mask token>\n\n\nclass GenericPower(Entity):\n <mask token>\n\n def __init__(self, unique_id, entity_type=EntityType.find(100), name=\n 'Unnamed entity', state=STATE_UNKNOWN, state_value=None, last_checkin=0\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_duration(): ins = main.convert() names = ins.multiconvert() for name in names: induration, outduration = ins.ffprobe(name[0], name[1]) assert induration == approx(outduration) indurat...
flexible
{ "blob_id": "92c247b827d2ca4dce9b631a2c09f2800aabe216", "index": 6129, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_duration():\n ins = main.convert()\n names = ins.multiconvert()\n for name in names:\n induration, outduration = ins.ffprobe(name[0], name[1])\n assert...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_Dialog(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.se...
flexible
{ "blob_id": "3222dd7c2d19d86f2e085cb489ab4a48307ba132", "index": 7458, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Dialog(object):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectNam...
[ 0, 1, 2, 4, 5 ]
from math import pi from root_regula_falsi import * r = 1.0 ρs = 200.0 ρw = 1000.0 def f(h): Vw = 4*pi*r**3/3 - pi*h**2/3*(3*r - h) # displaced volume of water Vs = 4*pi*r**3/3 return ρw*Vw - ρs*Vs xr = root_regula_falsi(f, 0.0, 2*r)
normal
{ "blob_id": "3e7d2bacb15c39658ef5044685b73068deb1c145", "index": 6060, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f(h):\n Vw = 4 * pi * r ** 3 / 3 - pi * h ** 2 / 3 * (3 * r - h)\n Vs = 4 * pi * r ** 3 / 3\n return ρw * Vw - ρs * Vs\n\n\n<mask token>\n", "step-3": "<mask token>\nr ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def loadDataFrame(fileName, fileSchema): return spark.read.format('csv').schema(fileSchema).option('header', 'true' ).option('mode', 'DROPMALFORMED').csv('/FileStore/tables/%s' % fileName ) <|reserved_special_token_0|> def top_movies(user_id, n): """ This f...
flexible
{ "blob_id": "d22ebe24605065452ae35c44367ee21a726ae7a1", "index": 1892, "step-1": "<mask token>\n\n\ndef loadDataFrame(fileName, fileSchema):\n return spark.read.format('csv').schema(fileSchema).option('header', 'true'\n ).option('mode', 'DROPMALFORMED').csv('/FileStore/tables/%s' % fileName\n )\...
[ 2, 3, 4, 5, 6 ]
def progress_format(user): json = dict() json["progres_id"] = user[0] json["percentage"] = user[1] json["user_id"] = user[2] json["technology"] = user[3] return json def progresses_format(users): json = dict() json["users_progresses"] = list() for user in users: ...
normal
{ "blob_id": "6ebf6bdfc6a4a1fe49f4eed1a2c1802f8adeef08", "index": 1195, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef progresses_format(users):\n json = dict()\n json['users_progresses'] = list()\n for user in users:\n json['users_progresses'].append(progress_format(user))\n re...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def addBinary(self, a: str, b: str) ->str: if len(a) < len(b): a = '0' * (len(b) - len(a)) + a else: b = '0' * (len(a...
flexible
{ "blob_id": "227a56c970a74d515ab694d2c0924885e2209cfe", "index": 7089, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def addBinary(self, a: str, b: str) ->str:\n if len(a) < len(b):\n a = '0' * (len(b) - len(a)) + a\n e...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from __future__ import absolute_import from __future__ import division from __future__ import print_function from .BLWecc import curve, setCurve, getPublicKey, getPrivateKey, getAddress as getAddressByCode, pub2add as getAddressByPublicKey, sign, verifyTx as ...
flexible
{ "blob_id": "25ee13314c7cf828b8805d9f483bd5ee12073228", "index": 8004, "step-1": "<mask token>\n", "step-2": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom .BLWecc import curve, setCurve, getPublicKey, getPrivateKey, getAddress as getAddres...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TimezoneMiddleware(object): <|reserved_special_token_0|> def process_request(self, request): user = request.user if hasattr(user, 'profile'): user_tz = user.profile.timezone ...
flexible
{ "blob_id": "839d4182663983a03975465d3909631bd6db1d83", "index": 9919, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TimezoneMiddleware(object):\n <mask token>\n\n def process_request(self, request):\n user = request.user\n if hasattr(user, 'profile'):\n user_tz ...
[ 0, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def minimize_neldermead(func, x0, args=(), callback=None, maxiter=None, maxfev=None, disp=False, return_all=False, initial_simplex=None, xatol= 0.0001, fatol=0.0001, **unknown_options): """ Minimization of scalar...
flexible
{ "blob_id": "35921b081e8e8c4da2b16afc20b27b636e9a6676", "index": 4761, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef minimize_neldermead(func, x0, args=(), callback=None, maxiter=None,\n maxfev=None, disp=False, return_all=False, initial_simplex=None, xatol=\n 0.0001, fatol=0.0001, **unkno...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.7 on 2021-03-25 00:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('restaurante', '0003_auto_20210324_1932'), ] operations = [ migrations.AlterModelOptions( name='comprobantemodel', options={'...
normal
{ "blob_id": "f76a3fac75e7e2b156f4bff5094f11009b65b599", "index": 8822, "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 = [('restaurante...
[ 0, 1, 2, 3, 4 ]
import cv2 import numpy as np from math import * def appendimages(im1,im2): """ Return a new image that appends the two images side-by-side. """ # select the image with the fewest rows and fill in enough empty rows rows1 = im1.shape[0] rows2 = im2.shape[0] if rows1 < rows2: im1 = np.concat...
normal
{ "blob_id": "c3e313805c6f91f9aac77922edfd09650143f905", "index": 4862, "step-1": "<mask token>\n\n\ndef appendimages(im1, im2):\n \"\"\" Return a new image that appends the two images side-by-side. \"\"\"\n rows1 = im1.shape[0]\n rows2 = im2.shape[0]\n if rows1 < rows2:\n im1 = np.concatenate(...
[ 9, 11, 12, 15, 18 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-15 15:20 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('challenges', '0019_auto_20170310_1114'), ] operations = [ migrations.AddFie...
normal
{ "blob_id": "6b7ff00eb9a5d0837def5b245ba2d4a0acec972e", "index": 3466, "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 = [('challenges'...
[ 0, 1, 2, 3, 4 ]
import unittest from HTMLTestRunner import HTMLTestRunner discover = unittest.defaultTestLoader.discover(start_dir='./', pattern='test*.py', top_level_dir=None) f = open('report.html', 'wb+') runner = HTMLTestRunner(stream=f,...
normal
{ "blob_id": "051062a78d3f8b0caefd15f7a57a8500ddc019a6", "index": 9290, "step-1": "<mask token>\n", "step-2": "<mask token>\nrunner.run(discover)\nf.close()\n", "step-3": "<mask token>\ndiscover = unittest.defaultTestLoader.discover(start_dir='./', pattern=\n 'test*.py', top_level_dir=None)\nf = open('repo...
[ 0, 1, 2, 3, 4 ]
"""Settings module for test app.""" ENV = "development" TESTING = True SQLALCHEMY_DATABASE_URI = "sqlite://" SECRET_KEY = "not-so-secret-in-tests" DEBUG_TB_ENABLED = False SQLALCHEMY_TRACK_MODIFICATIONS = False APP_ENV = "testing" JWT_SECRET_KEY = ( "-----BEGIN RSA PRIVATE KEY-----\n" "MIICWwIBAAKBgQDdlatRjR...
normal
{ "blob_id": "909ea7b9335a858662f83abc71b4d58578bd0850", "index": 8261, "step-1": "<mask token>\n", "step-2": "<mask token>\nENV = 'development'\nTESTING = True\nSQLALCHEMY_DATABASE_URI = 'sqlite://'\nSECRET_KEY = 'not-so-secret-in-tests'\nDEBUG_TB_ENABLED = False\nSQLALCHEMY_TRACK_MODIFICATIONS = False\nAPP_EN...
[ 0, 1, 2 ]
from django import forms from django.core import validators class NameSearch(forms.Form): name = forms.CharField(label='Search By Name')
normal
{ "blob_id": "7620ff333422d0354cc41c2a66444c3e8a0c011f", "index": 1606, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NameSearch(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NameSearch(forms.Form):\n name = forms.CharField(label='Search By Name')\n", "step-4": "f...
[ 0, 1, 2, 3 ]
""" Auxiliary functions for calculating the utility of achieving a certain data rate (for a UE). Attention: The absolute reward that's achieved with different utilities cannot be compared directly (diff ranges)! """ import numpy as np from deepcomp.util.constants import MIN_UTILITY, MAX_UTILITY def linear_clipped_ut...
normal
{ "blob_id": "e3de072d6bce2ecc105306c06b9a9aa0362130ff", "index": 6234, "step-1": "<mask token>\n\n\ndef log_utility(curr_dr):\n \"\"\"\n More data rate increases the utility following a log function: High initial increase, then flattens.\n\n :param curr_dr: Current data rate\n :param factor: Factor t...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: speech.say('I am a DALEK - EXTERMINATE', speed=120, pitch=100, throat= 100, mouth=200) <|reserved_special_token_1|> from microbit import * import speech while True: speech.say('I am a DALEK - EXTERMI...
flexible
{ "blob_id": "dad78d7948fb1038f9cf66732f39c18a18f2a3c8", "index": 5233, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n speech.say('I am a DALEK - EXTERMINATE', speed=120, pitch=100, throat=\n 100, mouth=200)\n", "step-3": "from microbit import *\nimport speech\nwhile True:\n s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('admin/', admin.site.urls), path('', views.index, name= 'index')] <|reserved_special_token_1|> from django.contrib import admin from django.urls import path from django.conf.urls import url from . import...
flexible
{ "blob_id": "b0fad3847519bb18365a8cd4226d06e9d96a8308", "index": 1258, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', views.index, name=\n 'index')]\n", "step-3": "from django.contrib import admin\nfrom django.urls import path\nfrom django.con...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class FizzBuzzTest(unittest.TestCase): def check_fizz_buzz(self, value, expected): result = fizz_buzz(value) self.assertEqual(expected, result) <|reserved_special_token_0|> def test_fizz_buzz__fizz_buzz_2_2(self): self.check_fizz_buzz(2, '2') def...
flexible
{ "blob_id": "59d543ed443c156ac65f9c806ba5bada6bcd0c21", "index": 6891, "step-1": "<mask token>\n\n\nclass FizzBuzzTest(unittest.TestCase):\n\n def check_fizz_buzz(self, value, expected):\n result = fizz_buzz(value)\n self.assertEqual(expected, result)\n <mask token>\n\n def test_fizz_buzz_...
[ 7, 10, 11, 12, 14 ]
#coding=utf-8 import yaml import os import os.path import shutil import json import subprocess import sys sys.path.append(os.path.split(os.path.realpath(__file__))[0]) import rtool.taskplugin.plugin.MultiProcessRunner as MultiProcessRunner import rtool.utils as utils logger = utils.getLogger('CopyRes') def run(): lo...
normal
{ "blob_id": "364150d6f37329c43bead0d18da90f0f6ce9cd1b", "index": 4886, "step-1": "<mask token>\n\n\nclass CopyResAction:\n <mask token>\n default_option = None\n res_root = None\n packing_root = None\n ignore_list = []\n\n def setResRoot(self, root):\n self.res_root = root\n pass\...
[ 6, 8, 13, 14, 15 ]
#listas lista=[] print(lista) #lista semana listasemana=["Lunes","Martes","Miercoles","Jueves","Viernes"] print(listasemana[0]) #lista semana listasemana=["Lunes","Martes","Miercoles","Jueves","Viernes"] print(listasemana[-1]) #lista semana listasemana=["Lunes","Martes","Miercoles","Jueves","Viernes"] print(listase...
normal
{ "blob_id": "37b23dc520abc7cbb6798f41063696916065626f", "index": 2203, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(lista)\n<mask token>\nprint(listasemana[0])\n<mask token>\nprint(listasemana[-1])\n<mask token>\nprint(listasemana[0, 3])\n<mask token>\nprint(conjunto)\n<mask token>\nprint(lista1p...
[ 0, 1, 2, 3 ]
# coding: utf-8 ''' Created on 2013-7-8 @author: huqiming ''' import json import re import urllib2 ''' 图说内容 ''' class ts_content: ''' 图说标题 ''' title = '' ''' 图说日期 ''' date = '' ''' 图说段落 ''' parts = [] def __str__(self): return 'parts: ...
normal
{ "blob_id": "094f482ec6d36dfaed7e908bc445e6e015ec409d", "index": 2718, "step-1": "# coding: utf-8\r\n'''\r\nCreated on 2013-7-8\r\n@author: huqiming\r\n'''\r\nimport json\r\nimport re\r\nimport urllib2\r\n'''\r\n图说内容\r\n'''\r\nclass ts_content:\r\n '''\r\n 图说标题\r\n '''\r\n title = ''\r\n '''\r\n ...
[ 0 ]
from __future__ import absolute_import, division, print_function import time from flytekit.sdk.tasks import python_task, dynamic_task, inputs, outputs from flytekit.sdk.types import Types from flytekit.sdk.workflow import workflow_class, Input from six.moves import range @inputs(value1=Types.Integer) @outputs(out=T...
normal
{ "blob_id": "c30b0db220bdacd31ab23aa1227ce88affb79daa", "index": 2322, "step-1": "<mask token>\n\n\n@workflow_class\nclass FlyteDJOLoadTestWorkflow(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\n@workflow_class\nclass FlyteDJOLoadTestWorkflow(object):\n tasks_count = Input(Typ...
[ 1, 2, 4, 5, 6 ]
import pymongo import redis import json from time import time user_timeline_mongodb = "mongodb://user-timeline-mongodb.sdc-socialnetwork-db.svc.cluster.local:27017/" user_timeline_redis = "user-timeline-redis.sdc-socialnetwork-db.svc.cluster.local" def handle(req): """handle a request to the function Args: ...
normal
{ "blob_id": "37969899aa646f4cdd7a5513f17d26b334870f1b", "index": 6598, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef handle(req):\n \"\"\"handle a request to the function\n Args:\n req (str): request body\n \"\"\"\n start = time()\n event = json.loads(req)\n user_id = ev...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_fibonacci_zero(): actual = func.fibonacci(0) expected = 0 assert actual == expected def test_fibonacci_one(): actual = func.fibonacci(1) expected = 1 assert actual == expected def test_fibonacci_negative(): actual = func.fibonacci(-5) expected ...
flexible
{ "blob_id": "49722f640eec02029865fd702e13e485eda6391b", "index": 8126, "step-1": "<mask token>\n\n\ndef test_fibonacci_zero():\n actual = func.fibonacci(0)\n expected = 0\n assert actual == expected\n\n\ndef test_fibonacci_one():\n actual = func.fibonacci(1)\n expected = 1\n assert actual == ex...
[ 8, 9, 11, 13, 14 ]
<|reserved_special_token_0|> def get_tweets(filename): """ Process a json formatted file with tweets using pandas read_json """ try: tweets = [] pd_tweets = pd.read_json(filename, lines=True) pd_tweets = pd_tweets[pd_tweets.text.notnull()]['text'] tweets = pd_tweets.to_list() ...
flexible
{ "blob_id": "acd2d84529e197d6f9d134e8d7e25a51a442f3ae", "index": 8615, "step-1": "<mask token>\n\n\ndef get_tweets(filename):\n \"\"\" Process a json formatted file with tweets using pandas read_json \"\"\"\n try:\n tweets = []\n pd_tweets = pd.read_json(filename, lines=True)\n pd_twee...
[ 2, 3, 4, 5, 6 ]
""" Given a list of partitioned and sentiment-analyzed tweets, run several trials to guess who won the election """ import json import math import sys import pprint import feature_vector def positive_volume(f): return f['relative_volume'] * f['positive_percent'] def inv_negative_volume(f): return 1.0 - f['r...
normal
{ "blob_id": "d508cb0a8d4291f1c8e76d9d720be352c05ef146", "index": 8651, "step-1": "<mask token>\n\n\ndef positive_volume(f):\n return f['relative_volume'] * f['positive_percent']\n\n\n<mask token>\n\n\ndef normalized_sentiment(f):\n return (f['average_sentiment'] + 1) / 2\n\n\ndef normalized_square_sentimen...
[ 6, 7, 10, 12, 13 ]
from django.test import TestCase, Client from accounts.models import Account from .data import account from rest_framework import status class TestAccountRequests(TestCase): def setUp(self): self.client = Client() self.superuser = Account.objects.create_superuser(**account) def test_register...
normal
{ "blob_id": "3d43bf0d0ca1df06b3647a33f88cee067eeff9f4", "index": 2605, "step-1": "<mask token>\n\n\nclass TestAccountRequests(TestCase):\n\n def setUp(self):\n self.client = Client()\n self.superuser = Account.objects.create_superuser(**account)\n <mask token>\n <mask token>\n", "step-2"...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """BatchNorm (BN) utility functions and custom batch-size BN implementations""" from functools import partial import torch import torch.nn as nn from pytorchvideo.layers.batch_norm import ( NaiveSyncBatchNorm1d, Na...
normal
{ "blob_id": "4e5e1be289b32655736d8c6c02d354a85d4268b7", "index": 3027, "step-1": "<mask token>\n\n\nclass SubBatchNorm3d(nn.Module):\n <mask token>\n\n def __init__(self, num_splits, **args):\n \"\"\"\n Args:\n num_splits (int): number of splits.\n args (list): other arg...
[ 5, 6, 7, 8, 9 ]
# Generated by Django 3.0.3 on 2020-02-09 06:29 import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('devices_collect', '0004_auto_20200209_1304'), ] operations = [ migrations.AlterField( ...
normal
{ "blob_id": "b07d042c61e9e6647822989444e72db2e01c64d0", "index": 5751, "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 = [('devices_col...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def delete(request, pk): if delete_a_model(pk): return redirect('myapp:home') else: return HttpResponse('Error Occured') def search(request): if request.method == 'POST': pk = request.POST.get('pk') try: content = read_a_model(pk) ...
flexible
{ "blob_id": "dc4de382ab16f036c6174e711f5c9fe52868ccc9", "index": 8445, "step-1": "<mask token>\n\n\ndef delete(request, pk):\n if delete_a_model(pk):\n return redirect('myapp:home')\n else:\n return HttpResponse('Error Occured')\n\n\ndef search(request):\n if request.method == 'POST':\n ...
[ 2, 4, 5, 6, 7 ]
from __future__ import division # floating point division import csv import random import math import numpy as np import dataloader as dtl import classalgorithms as algs def getaccuracy(ytest, predictions): correct = 0 for i in range(len(ytest)): if ytest[i] == predictions[i]: correct ...
normal
{ "blob_id": "c8ab53c77ff3646a30ca49eaafc275afeadd2ca6", "index": 9545, "step-1": "from __future__ import division # floating point division\nimport csv\nimport random\nimport math\nimport numpy as np\n\nimport dataloader as dtl\nimport classalgorithms as algs\n \n \ndef getaccuracy(ytest, predictions):\n cor...
[ 0 ]
<|reserved_special_token_0|> def setup_to_transfer_learn(model): """Freeze all layers and compile the model""" for layer in model.layers: layer.trainable = False def add_new_last_layer(base_model, nb_classes): x = base_model.output x = Dropout(0.5, name='drop9')(x) x = Convolution2D(nb_c...
flexible
{ "blob_id": "39b9106a3b0305db8cc7316be3b76e58e5577b92", "index": 4980, "step-1": "<mask token>\n\n\ndef setup_to_transfer_learn(model):\n \"\"\"Freeze all layers and compile the model\"\"\"\n for layer in model.layers:\n layer.trainable = False\n\n\ndef add_new_last_layer(base_model, nb_classes):\n ...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> class GoogleTTS: <|reserved_special_token_0|> def check_google_connection(self): try: message = 'Hallo' filename = 'temp_voice.mp3' tts = gTTS(text=message, lang='de') tts.save(filename) os.remove(filename) ...
flexible
{ "blob_id": "9ed674513bebe65ece538e9ce2b3945bb0c532cc", "index": 1357, "step-1": "<mask token>\n\n\nclass GoogleTTS:\n <mask token>\n\n def check_google_connection(self):\n try:\n message = 'Hallo'\n filename = 'temp_voice.mp3'\n tts = gTTS(text=message, lang='de')\n...
[ 5, 7, 8, 9, 10 ]
import os import json from .utils import * def _unique_predict(solve_list): valid_solve_list = filter(lambda x: x[0] is not None, solve_list) valid_solve_list = sorted(valid_solve_list, key=lambda x: x[0]) unique_solve_list = list() current_no = -1 for e in valid_solve_list: if current_no ...
normal
{ "blob_id": "00a1b5f20f15994a659eda56201ba7c45d49a4db", "index": 4186, "step-1": "<mask token>\n\n\ndef _unique_predict(solve_list):\n valid_solve_list = filter(lambda x: x[0] is not None, solve_list)\n valid_solve_list = sorted(valid_solve_list, key=lambda x: x[0])\n unique_solve_list = list()\n cur...
[ 3, 4, 5, 6, 7 ]
{ # Theme information 'name' : 'Clarico CMS Blocks', 'category' : 'Website', 'version' : '1.0', 'summary': '13 CMS Building Blocks', 'description': """""", # Dependencies 'depends': [ 'snippet_style_1', 'snippet_style_2', 'snippet_style_3', 'snippet_style_4'...
normal
{ "blob_id": "34f98d4a6a15c9a7b42f237cab204b736dc97136", "index": 1372, "step-1": "<mask token>\n", "step-2": "{'name': 'Clarico CMS Blocks', 'category': 'Website', 'version': '1.0',\n 'summary': '13 CMS Building Blocks', 'description': '', 'depends': [\n 'snippet_style_1', 'snippet_style_2', 'snippet_sty...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GlobalTestOpenAcademySession(TransactionCase): <|reserved_special_token_0|> def setUp(self): super(GlobalTestOpenAcademySession, self).setUp() self.session = self.env['openacademy.session'] ...
flexible
{ "blob_id": "7edd833103e1de92e57559c8a75379c26266963b", "index": 7835, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GlobalTestOpenAcademySession(TransactionCase):\n <mask token>\n\n def setUp(self):\n super(GlobalTestOpenAcademySession, self).setUp()\n self.session = self....
[ 0, 4, 5, 6, 7 ]
import os def is_admin(): """ The function ``is_admin`` detects whether the calling process is running with administrator/superuser privileges. It works cross-platform on either Windows NT systems or Unix-based systems. """ if os.name == 'nt': try: # Only Windows users wit...
normal
{ "blob_id": "f1601d3d820b93631f9b1358627a5716016ad135", "index": 5473, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_admin():\n \"\"\"\n The function ``is_admin`` detects whether the calling process is running\n with administrator/superuser privileges. It works cross-platform on \n ...
[ 0, 1, 2, 3 ]
''' Temperature Container ''' class TempHolder: range_start = 0 range_end = 0 star_count_lst = [0,0,0,0,0,0] counter = 0 def __init__(self, in_range_start, in_range_end): self.range_start = in_range_start self.range_end = in_range_end self.counter = 0 self.s...
normal
{ "blob_id": "330b843501e0fdaff21cc4eff1ef930d54ab6e8d", "index": 747, "step-1": "<mask token>\n\n\nclass FRSHTTHolder:\n frshtt_code = ''\n star_count_lst = [0, 0, 0, 0, 0, 0]\n counter = 0\n\n def __init__(self, in_frshtt_code):\n self.frshtt_code = in_frshtt_code\n self.counter = 0\n ...
[ 11, 13, 15, 19, 23 ]
<|reserved_special_token_0|> class LicenseChecker(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LicenseChecker(object): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "c70aa1a373530ac73553753e62d3989f5bc79287", "index": 687, "step-1": "<mask token>\n\n\nclass LicenseChecker(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass LicenseChecker(object):\n <mask token>\n <mask token>\n\n def ...
[ 1, 3, 5, 6, 7 ]
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class RDt(RPackage): """A Wrapper of the JavaScript Library 'DataTables'. Data obje...
normal
{ "blob_id": "c88e2336432f93d95b4e2285aa532b673a4a410b", "index": 1095, "step-1": "<mask token>\n\n\nclass RDt(RPackage):\n <mask token>\n <mask token>\n version('0.23', sha256=\n '360ae2fcb1141125a1b16448570fc37d14c4dd3f78a872c26df4fda1787cdc70')\n version('0.20', sha256=\n 'c66d7f49ec1...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def collect_env(): """Collect the information of the running environments. Returns: dict: The environment information. The following fields are contained. - sys.platform: The variable of ``sys.platf...
flexible
{ "blob_id": "ee489c2e313a96671db79398218f8604f7ae1bf3", "index": 3569, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef collect_env():\n \"\"\"Collect the information of the running environments.\n\n Returns:\n dict: The environment information. The following fields are contained.\n\n ...
[ 0, 1, 2, 3 ]
""" CONVERT HOURS INTO SECONDS Write a function that converts hours into seconds. Examples: - how_many_seconds(2) -> 7200 - how_many_seconds(10) -> 36000 - how_many_seconds(24) -> 86400 Notes: - 60 seconds in a minute; 60 minutes in a hour. - Don't forget to return your answer. """ """ U.P.E...
normal
{ "blob_id": "34c7e6b6bc687bc641b7e3b9c70fd0844af8e340", "index": 8969, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef how_many_seconds(hrs_int):\n secs_int = None\n if hrs_int > 0 and hrs_int is not None:\n secs_int = hrs_int * 60 * 60\n return secs_int\n else:\n rai...
[ 0, 1, 2 ]
# Generated by Django 2.2.10 on 2020-03-13 14:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('system', '0005_location'), ] operations = [ migrations.AddField( model_name='setting', name='runned_locations_initi...
normal
{ "blob_id": "211ef4c64e42c54423ac8dab2128952874a2cf5a", "index": 7694, "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 = [('system', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Desc(Descriptive): name = 'desc' attrs = () class Metadata(Descriptive): name = 'metadata' attrs = () class Title(Descriptive): name = 'title' attrs = () <|reserved_special_token_1|> <|reserved_special_token_0|> class Descriptive(Element): <|rese...
flexible
{ "blob_id": "178570047458eb3eeda00f9153ef2159eb4cbef3", "index": 9188, "step-1": "<mask token>\n\n\nclass Desc(Descriptive):\n name = 'desc'\n attrs = ()\n\n\nclass Metadata(Descriptive):\n name = 'metadata'\n attrs = ()\n\n\nclass Title(Descriptive):\n name = 'title'\n attrs = ()\n", "step-2...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RNN_instruction_encoder(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class RNN_instruction_encoder(nn.Module): def __init...
flexible
{ "blob_id": "16106250548ef60b475b009116cfeb7a25101637", "index": 7727, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RNN_instruction_encoder(nn.Module):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass RNN_instruction_encoder(nn.Module):\n\n def __init__(self, vo...
[ 0, 1, 3, 4 ]
from aiogram import Dispatcher from create_bot import bot from data_base import sqlite_db # new user in group async def new_member(message): new_user = message.new_chat_members[0] user_id = new_user['id'] if new_user['username']: user_name = new_user['username'] elif new_user['first_name']: ...
normal
{ "blob_id": "dfcfa4fa036fe8c058d66fc0b9ea73ddb9d4446e", "index": 7524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_handlers_for_other(dp: Dispatcher):\n dp.register_message_handler(new_member, content_types=['new_chat_members'])\n dp.register_message_handler(left_member, content...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def compare(a): if a > 11: print('big') elif a == 10: print('reallybig') <|reserved_special_token_0|> <|reserved_special_token_1|> def drive(carspeed): if carspeed > 200: print('very fast...
flexible
{ "blob_id": "de3eaa5823fb396050527c148273c30bed6ce8ca", "index": 2644, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef compare(a):\n if a > 11:\n print('big')\n elif a == 10:\n print('reallybig')\n\n\n<mask token>\n", "step-3": "def drive(carspeed):\n if carspeed > 200:\n ...
[ 0, 1, 2, 3, 4 ]
import pandas as pd df1 = pd.read_csv('Tweets1.csv', names=['tweet']) df2 = pd.read_csv('Tweets2.csv', names=['tweet']) df3 = pd.read_csv('Tweets3.csv', names=['tweet']) df = pd.concat([df1, df2, df3], axis=0, join='outer', ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False, copy=True) d...
normal
{ "blob_id": "7d6196268b85861e76efaa53e14976f2eae09405", "index": 3226, "step-1": "<mask token>\n", "step-2": "<mask token>\ndf.to_csv('Tweets.csv', index=None, header=None)\n", "step-3": "<mask token>\ndf1 = pd.read_csv('Tweets1.csv', names=['tweet'])\ndf2 = pd.read_csv('Tweets2.csv', names=['tweet'])\ndf3 =...
[ 0, 1, 2, 3 ]
#include os #include math output_file = 'output/mvnt' def file_writeout(srvN, pos); with open(output_file, 'a') as f: f.write(srvN, ' to ', pos) return 0 class leg(legN): def __init__(legN): srvHY = 'srv' + legN + 'HY' srvHX = 'srv' + legN + 'HX' srvEY = 'srv' + le...
normal
{ "blob_id": "901f87752026673c41a70655e987ecc2d5cb369f", "index": 7273, "step-1": "#include os\n#include math\n\noutput_file = 'output/mvnt'\n\ndef file_writeout(srvN, pos);\n with open(output_file, 'a') as f:\n f.write(srvN, ' to ', pos)\n return 0\n \nclass leg(legN):\n def __init__(legN)...
[ 0 ]
<|reserved_special_token_0|> def get_choice(attempt): """ return an integer input from the user """ try: user_text = '' if attempt == 1: user_text = 'Guess a number between 0 and 99:' choice = int(input(user_text)) except ValueError: return get_choice() ...
flexible
{ "blob_id": "f7d487ec99e2fa901677ab9aec0760a396722e12", "index": 8245, "step-1": "<mask token>\n\n\ndef get_choice(attempt):\n \"\"\"\n return an integer input from the user\n \"\"\"\n try:\n user_text = ''\n if attempt == 1:\n user_text = 'Guess a number between 0 and 99:'\n...
[ 2, 3, 4, 5, 6 ]
import numpy as np import dxchange import ptychotomo if __name__ == "__main__": # read object u = dxchange.read_tiff('data/init_object.tiff') u = u+1j*u/2 nz, n, _ = u.shape # parameters center = n/2 ntheta = 384 ne = 3*n//2 ngpus = 1 pnz = nz//2 theta = np.linspace(0...
normal
{ "blob_id": "4ed6f4db4c9c3319d6289ba402f81bbd8accf915", "index": 9782, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n u = dxchange.read_tiff('data/init_object.tiff')\n u = u + 1.0j * u / 2\n nz, n, _ = u.shape\n center = n / 2\n ntheta = 384\n ne = 3 * n // ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # # nextskeleton - An assembler skeleton for the ZX Spectrum Next # # Copyright (C) 2020 Richard "Shred" Körber # https://github.com/shred/nextskeleton # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
normal
{ "blob_id": "0744ec646e7b9303c67c25dff2997568c6171b91", "index": 108, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('nex', help='path of the .nex file to be launched')\nparser.add_argument('file', help='autoexec.bas file to be generated')\n<mask token>\ncontents += bytearray((0, 10))...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def geoDistance(p1, p2): return Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x)['s12'] <|reserved_special_token_0|> def compare(f): return geoDistance(f.getLocation(), melbourne) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def g...
flexible
{ "blob_id": "920f00632599945397364dd0f52f21234e17f9ef", "index": 9445, "step-1": "<mask token>\n\n\ndef geoDistance(p1, p2):\n return Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x)['s12']\n\n\n<mask token>\n\n\ndef compare(f):\n return geoDistance(f.getLocation(), melbourne)\n\n\n<mask token>\n", "step-2...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT ) <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('user', include('user.urls')), path('ord...
flexible
{ "blob_id": "97cc29e0d54e5d5e05dff16c92ecc4046363185f", "index": 344, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT\n )\n", "step-3": "<mask token>\nurlpatterns = [path('user', include('user.urls...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_mongo_logging_client_persists_log(): """ Test to see if the mongodb client logger can persist a log entry to the database """ error_message = 'This is a test message.' logger = LoggingService(console_output=True) result = logger.log(LogEntry(LogLevel.E...
flexible
{ "blob_id": "a29cf9e7006d52cea8f5ccdcbc2087983ffa3ef3", "index": 2973, "step-1": "<mask token>\n\n\ndef test_mongo_logging_client_persists_log():\n \"\"\"\n Test to see if the mongodb client logger\n can persist a log entry to the database\n \"\"\"\n error_message = 'This is a test message.'\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class AdmiravelMundoNovo(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def transicao_estado(self, acao): if self._valor_estado == 2 and acao == 0: self._estado_6() elif self._valor_estado == 2 and acao == 1: self._e...
flexible
{ "blob_id": "38ffbb6a66837e975a611a57579bb365ab69a32c", "index": 9504, "step-1": "<mask token>\n\n\nclass AdmiravelMundoNovo(object):\n <mask token>\n <mask token>\n\n def transicao_estado(self, acao):\n if self._valor_estado == 2 and acao == 0:\n self._estado_6()\n elif self._v...
[ 18, 21, 23, 25, 28 ]
#!/usr/bin/env python # encoding: utf-8 """ @author: swensun @github:https://github.com/yunshuipiao @software: python @file: encode_decode.py @desc: 字符串编解码 @hint: """ def encode(strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str """ res = '' ...
normal
{ "blob_id": "2561db1264fe399db85460e9f32213b70ddf03ff", "index": 1864, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef encode(strs):\n \"\"\"Encodes a list of strings to a single string.\n :type strs: List[str]\n :rtype: str\n \"\"\"\n res = ''\n for string in strs.split(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- """Tests for the Spotlight Volume configuration plist plugin.""" import unittest # pylint: disable=unused-import from plaso.formatters import plist as plist_formatter from plaso.parsers import plist from plaso.parsers.plist_plugins import spotlight_volume from tests.parsers....
normal
{ "blob_id": "6d1b882af2a027f2eecaa3a881dbcab1e3a3b92b", "index": 9608, "step-1": "<mask token>\n\n\nclass SpotlightVolumePluginTest(test_lib.PlistPluginTestCase):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass SpotlightVolumePluginTest(test_lib.Pl...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('infile', help='the file list to be processed') parser.add_argument('-d', '--directory', default='./', help= 'directory where files are located') parser.add_argument('-s', '--suffix', default='_EmsRawEvent....
flexible
{ "blob_id": "58c7b405096a5fdc5eeacb5e5f314f2d1bb85af6", "index": 6229, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('infile', help='the file list to be processed')\nparser.add_argument('-d', '--directory', default='./', help=\n 'directory where files are located')\nparser.add_arg...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ActivityConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ActivityConfig(AppConfig): name = 'apps.activity' <|reserved_special_token_1|> from dj...
flexible
{ "blob_id": "2a69aa0cd9d0e39ad82d6a354e956bdad0648797", "index": 2252, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ActivityConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ActivityConfig(AppConfig):\n name = 'apps.activity'\n", "step-4": "from django.apps im...
[ 0, 1, 2, 3 ]
from . import * from ..utils.constants import NUM_SEARCH_RESULT def get_course_by_id(course_id): return Course.query.filter_by(id=course_id).first() def get_course_by_subject_and_course_num(subject_code, course_num): return Course.query.filter_by(subject_code=subject_code, course_num=course_num).first() d...
normal
{ "blob_id": "b3f0aae91c885d0e15ff3e456b5cab43fca65b67", "index": 4184, "step-1": "<mask token>\n\n\ndef get_course_by_id(course_id):\n return Course.query.filter_by(id=course_id).first()\n\n\n<mask token>\n\n\ndef create_course(subject_code, course_num, title):\n optional_course = get_course_by_subject_and...
[ 4, 5, 6, 7, 8 ]
import requests from bs4 import BeautifulSoup from urllib.request import urlretrieve import json import time #功能一:下载单一歌曲、歌词 def single_song(song_id,path,song_name): #下载单一歌曲,输入为歌曲id,保存路径,歌曲名称 song_url = "http://music.163.com/song/media/outer/url?id=%s" % song_id down_path = path +'...
normal
{ "blob_id": "3b11d514b15775e4c818a7a2adf9a80e89dca968", "index": 5801, "step-1": "<mask token>\n\n\ndef save2txt(songname, lyric, path):\n print('歌词下载完成:' + songname)\n lyric_path = path + '\\\\' + songname + '.txt'\n with open(lyric_path, 'a', encoding='utf-8') as f:\n f.write(lyric)\n\n\n<mask ...
[ 17, 20, 21, 24, 33 ]
<|reserved_special_token_0|> def save(): Names = Name.get() Ages = Age.get() Genders = Gender.get() Heights = height.get() weights = weight.get() rollnos = StudentId.get() Sports = Sport.get() cursor.execute( """ INSERT INTO Students(Name, Age, Gender, Height,_weight,Studen...
flexible
{ "blob_id": "8058ff209af03b7365ffad2a9ce2e2805b548f53", "index": 9927, "step-1": "<mask token>\n\n\ndef save():\n Names = Name.get()\n Ages = Age.get()\n Genders = Gender.get()\n Heights = height.get()\n weights = weight.get()\n rollnos = StudentId.get()\n Sports = Sport.get()\n cursor.ex...
[ 4, 5, 6, 7, 8 ]
from __future__ import division import numpy as np table = open("Tables\\table1.txt", "w") table.write("\\begin{tabular}{|c|c|c|c|} \\hline\n") table.write("Hidden Neurons & Loss & Training Acc. & Valid. Acc. \\\\ \\hline\n") H = [1,5,10,11,12,20,40] for h in H: file = open("Out\\out-h"+str(h)+".txt", "r") line = ...
normal
{ "blob_id": "3cace66ddf8484d285c2b2a8fabbb83778a2c4af", "index": 4352, "step-1": "<mask token>\n", "step-2": "<mask token>\ntable.write('\\\\begin{tabular}{|c|c|c|c|} \\\\hline\\n')\ntable.write(\n 'Hidden Neurons & Loss & Training Acc. & Valid. Acc. \\\\\\\\ \\\\hline\\n')\n<mask token>\nfor h in H:\n f...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MoneyFst(GraphFst): <|reserved_special_token_0|> def __init__(self, decimal: GraphFst, deterministic: bool=True): super().__init__(name='money', kind='verbalize', deterministic= deterministic) maj_singular_masc = pynutil.delete('currency_maj: "')...
flexible
{ "blob_id": "dccdca65cce2959b07657636e23e7c9ab8a4f96c", "index": 1382, "step-1": "<mask token>\n\n\nclass MoneyFst(GraphFst):\n <mask token>\n\n def __init__(self, decimal: GraphFst, deterministic: bool=True):\n super().__init__(name='money', kind='verbalize', deterministic=\n determinist...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def query_parse(GIVEN_QUERY): try: countryIds_query = list(map(lambda x: x['country_id'], GIVEN_QUERY[ 'countries'])) except: countryIds_query = None try: days_query = GIVEN_QUERY[...
flexible
{ "blob_id": "b52807a15cef8f07f685f8761a470d4a24d9c3dc", "index": 6603, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef query_parse(GIVEN_QUERY):\n try:\n countryIds_query = list(map(lambda x: x['country_id'], GIVEN_QUERY[\n 'countries']))\n except:\n countryIds_query...
[ 0, 1, 2, 3 ]
from reportlab.lib.pagesizes import letter from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import getSampleStyleSheet def paragraph_spacing(): doc = SimpleDocTemplate("paragraph_spacing.pdf", pagesize=letter) styles = getSampleStyleSheet() #Mengahasilkan spasi antar ...
normal
{ "blob_id": "d79e65b7aa09066230dec1a472f4535dff4123b5", "index": 4217, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef paragraph_spacing():\n doc = SimpleDocTemplate('paragraph_spacing.pdf', pagesize=letter)\n styles = getSampleStyleSheet()\n styles['Normal'].spaceBefore = 10\n styles[...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(img.shape) print(img[257][400]) <|reserved_special_token_0|> cv2.imshow('Image', img) cv2.waitKey(0) cv2.destroyAllWindows() <|reserved_special_token_1|> <|reserved_special_token_0|> img = cv2.imread('assets/logo.jpg', -1...
flexible
{ "blob_id": "35e66e5e154f5cd70f187a1cde33cef71102e1a6", "index": 6829, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(img.shape)\nprint(img[257][400])\n<mask token>\ncv2.imshow('Image', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('assets/logo.jpg', ...
[ 0, 1, 2, 3, 4 ]
import pylab,numpy as np from numpy import sin from matplotlib.patches import FancyArrowPatch fig=pylab.figure() w=1 h=1 th=3.14159/25. x=np.r_[0,0,w,w,0] y=np.r_[0,h,h-w*sin(th),0-w*sin(th),0] pylab.plot(x,y) x=np.r_[0,0,w/2.0,w/2.0,0] y=np.r_[0,h/6.0,h/6.0-w/2.0*sin(th),0-w/2.0*sin(th),0] pylab.plot(x...
normal
{ "blob_id": "c485466a736fa0a4f183092e561a27005c01316d", "index": 8616, "step-1": "<mask token>\n", "step-2": "<mask token>\npylab.plot(x, y)\n<mask token>\npylab.plot(x, y, '--')\npylab.text(w / 4.0, h / 12.0 - w / 4.0 * sin(th) - h / 30.0,\n '$A_{a,subcool}$', ha='center', va='center')\n<mask token>\npylab...
[ 0, 1, 2, 3, 4 ]
""" This module takes care of starting the API Server, Loading the DB and Adding the endpoints """ import os from flask import Flask, request, jsonify, url_for from flask_migrate import Migrate from flask_swagger import swagger from flask_cors import CORS from flask_jwt_extended import ( JWTManager, jwt_required, c...
normal
{ "blob_id": "36d596c1019dbaaf8dc394633ca464421517dc21", "index": 3381, "step-1": "\"\"\"\nThis module takes care of starting the API Server, Loading the DB and Adding the endpoints\n\"\"\"\nimport os\nfrom flask import Flask, request, jsonify, url_for\nfrom flask_migrate import Migrate\nfrom flask_swagger import...
[ 0 ]
<|reserved_special_token_0|> def remove_posts(data, index_list): data = data.drop(index_list) return data.reset_index(drop=True) <|reserved_special_token_0|> def preprocess(text): text = text.lower() text = text.replace('$', ' ') text = text.replace('-', ' ') text = text.replace('/', ' ') ...
flexible
{ "blob_id": "341fb4442ba1d1bb13dbbe123e1051e1ceeb91e7", "index": 4431, "step-1": "<mask token>\n\n\ndef remove_posts(data, index_list):\n data = data.drop(index_list)\n return data.reset_index(drop=True)\n\n\n<mask token>\n\n\ndef preprocess(text):\n text = text.lower()\n text = text.replace('$', ' '...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in f: l = line.strip() l = l.split(',') l = map(float, l) data.append(l) f.close() for i in range(100): shuffle(data) for l in data: train_data.append(l[0:-1]) train_class.append(int(l[-1])) <|...
flexible
{ "blob_id": "b8b20d6c977a6c1df6a592188c6e799f12da6a23", "index": 9734, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f:\n l = line.strip()\n l = l.split(',')\n l = map(float, l)\n data.append(l)\nf.close()\nfor i in range(100):\n shuffle(data)\nfor l in data:\n train_data.a...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `feat` package.""" from feat.detector import Detector from feat.data import Fex from feat.utils import get_resource_path from .utils import get_test_data_path import pandas as pd import feat import os import wget # def test_models(): # print("Downloading...
normal
{ "blob_id": "753bdbf080e7a8652c39e40beeae51f74382d606", "index": 1300, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_detector():\n detector = Detector(n_jobs=1)\n assert detector['n_jobs'] == 1\n assert type(detector) == Detector\n inputFname = os.path.join(get_test_data_path(),...
[ 0, 1, 2, 3 ]