code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import os import sys from tensor2tensor.bin import t2t_trainer def problem_args(problem_name): args = [ '--generate_data', '--model=transformer', '--hparams_set=transformer_librispeech_v1', '--problem=%s' % problem_name, '--data_dir=/tmp/refactor_test/problems/%s/data' % problem_name, '--t...
normal
{ "blob_id": "cc5ad95419571d3eb2689b428e5805ad69958806", "index": 4796, "step-1": "<mask token>\n\n\ndef problem_args(problem_name):\n args = ['--generate_data', '--model=transformer',\n '--hparams_set=transformer_librispeech_v1', '--problem=%s' %\n problem_name, '--data_dir=/tmp/refactor_test/pr...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from django.db import models from filebrowser.fields import FileBrowseField from localisations.models import Ville, Lieu from model_utils.managers import InheritanceManager from services.models import Service from equipements.models import Equipement from localisations.models import Ville from d...
normal
{ "blob_id": "596fe474ae60dd6a06123df6fe246f7e947b3482", "index": 1760, "step-1": "<mask token>\n\n\nclass SaisonCulturelle(Saison):\n\n def __unicode__(self):\n return self.nom\n\n\nclass Festival(Saison):\n saison_culture = models.ForeignKey(SaisonCulturelle)\n\n def __unicode__(self):\n ...
[ 30, 33, 34, 36, 39 ]
# Return min number of hacks (swap of adjacent instructions) # in p so that total damage <= d. # If impossible, return -1 def min_hacks(d, p): # list containing number of shoot commands per # damage level. Each element is represents a # damage level; 1, 2, 4, 8, ... and so on. shots = [0] damage = 0 for c ...
normal
{ "blob_id": "607700faebc2018327d66939419cc24a563c3900", "index": 6515, "step-1": "<mask token>\n", "step-2": "def min_hacks(d, p):\n shots = [0]\n damage = 0\n for c in p:\n if c == 'S':\n shots[-1] += 1\n damage += 2 ** (len(shots) - 1)\n else:\n shots.a...
[ 0, 1, 2, 3, 4 ]
"""" You are given a tree-like data structure represented as nested dictionaries. Implement a function collect_leaves that accepts a tree and returns a list of all its leaves. A leaf is a bottom-most node in a tree. Implement a kind of unit tests via assert operator. """ from typing import Union def collect...
normal
{ "blob_id": "603cce951dd0f78ef3ca9dce587042b3b7f6b449", "index": 8001, "step-1": "<mask token>\n\n\ndef collect_leaves(u: Union[dict, list]) ->list:\n flatten_list = []\n if isinstance(u, dict):\n for item in u.values():\n flatten_list.extend(collect_leaves(item))\n return flatten_...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @router.post('/create-job', response_model=ShowJob) def create_job(job: JobCreate, db: Session=Depends(get_db), current_user: User=Depends(get_current_user_from_token)): owner_id = current_user.id job = create_new_job(job=job, db=db, owner_id=owner_id) return job @router...
flexible
{ "blob_id": "e8092faed22607f9c8f18a79709022037ff647bf", "index": 9625, "step-1": "<mask token>\n\n\n@router.post('/create-job', response_model=ShowJob)\ndef create_job(job: JobCreate, db: Session=Depends(get_db), current_user:\n User=Depends(get_current_user_from_token)):\n owner_id = current_user.id\n ...
[ 4, 5, 6, 7, 8 ]
import openpyxl as opx import pyperclip from openpyxl import Workbook from openpyxl.styles import PatternFill wb = Workbook(write_only=True) ws = wb.create_sheet() def parseSeq(lines,seqName): '''splits each column''' data = [] for line in lines: data.append(line.split(' ')) '''remov...
normal
{ "blob_id": "19e387cb731dad21e5ee50b0a9812df984c13f3b", "index": 7890, "step-1": "<mask token>\n\n\ndef parseSeq(lines, seqName):\n \"\"\"splits each column\"\"\"\n data = []\n for line in lines:\n data.append(line.split(' '))\n \"\"\"removes any spaces\"\"\"\n for i in range(len(data)):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.autodiscover() <|reserved_special_token_0|> dajaxice_autodiscover() <|reserved_special_token_0|> urlpatterns += staticfiles_urlpatterns() urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) <|reser...
flexible
{ "blob_id": "68a503b2a94304530e20d79baf9fb094024ba67e", "index": 539, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.autodiscover()\n<mask token>\ndajaxice_autodiscover()\n<mask token>\nurlpatterns += staticfiles_urlpatterns()\nurlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Vasicek: def __init__(self, rs, vol): self.t = rs.columns self.ps = rs[-1:] self.sigma = vol <|reserved_special_token_0|> def loss(self, x): self.a = x[0] self.b = x[1] self.sim_rs = apply(self.get_TheoreticalP, self.ps) ...
flexible
{ "blob_id": "b6470ffda9040223951a99abc600ce1e99fe146b", "index": 7902, "step-1": "<mask token>\n\n\nclass Vasicek:\n\n def __init__(self, rs, vol):\n self.t = rs.columns\n self.ps = rs[-1:]\n self.sigma = vol\n <mask token>\n\n def loss(self, x):\n self.a = x[0]\n self...
[ 3, 5, 6, 8, 9 ]
class Solution: def containsDuplicate(self, nums) -> bool: d = {} # store the elements which already exist for elem in nums: if elem in d: return True else: d[elem] = 1 return False print(Solution().containsDuplicate([0]))
normal
{ "blob_id": "89256a38208be92f87115b110edc986cebc95306", "index": 8440, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def containsDuplicate(self, nums) ->bool:\n d = {}\n for elem in nums:\n if elem in ...
[ 0, 1, 2, 3, 4 ]
#!/bin/env python import sys import os import collections import re import json import urllib import urllib.request import uuid import time PROCESSOR_VERSION = "0.1" def process(trace_dir, out_dir): #order files trace_files = os.listdir(trace_dir) trace_files = sorted(trace_files) if trace_files[0] ==...
normal
{ "blob_id": "4b83887e8d8e5c5dc7065354d24044d3c3a48714", "index": 3387, "step-1": "<mask token>\n\n\ndef process(trace_dir, out_dir):\n trace_files = os.listdir(trace_dir)\n trace_files = sorted(trace_files)\n if trace_files[0] == 'error.log':\n print('Rotating to properly order logs.')\n t...
[ 2, 3, 4, 5, 6 ]
from django.urls import path from admin_panel import views urlpatterns = [path('admin_panel/', views.AdminPanel.as_view(), name= 'admin_panel'), path('admin_panel/connection/', views.Connection. as_view(), name='connect_group-teacher'), path( 'admin_panel/connection/<str:choiced_departament>', views.Connect...
normal
{ "blob_id": "34a7fd66a9e2eae25994336f22a76c24c11a6e1b", "index": 7408, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin_panel/', views.AdminPanel.as_view(), name=\n 'admin_panel'), path('admin_panel/connection/', views.Connection.\n as_view(), name='connect_group-teacher'),...
[ 0, 1, 2 ]
from rdflib import Graph from rdflib.plugins.sparql import prepareQuery def is_file_ontology(file_path): """ Method that, given a file, returns its URI. This method is in a separate file in case we want to extract additional metadata if required Parameters ---------- @param file_path: path of ...
normal
{ "blob_id": "c327f8f7aece1a9c25079613809df52e9a8e7a52", "index": 8763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_file_ontology(file_path):\n \"\"\"\n Method that, given a file, returns its URI.\n This method is in a separate file in case we want to extract additional metadata if ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MD(BaseEstimator, TransformerMixin): <|reserved_special_token_0|> def _init_graph(self): """ Init a tensorflow Graph containing: input data, variables, model, loss, optimizer """ self.graph = tf.Graph() with self.graph.as_default(): ...
flexible
{ "blob_id": "a9947884e805cc8fcb6bff010a5f6e0ff0bb01fe", "index": 8393, "step-1": "<mask token>\n\n\nclass MD(BaseEstimator, TransformerMixin):\n <mask token>\n\n def _init_graph(self):\n \"\"\"\n Init a tensorflow Graph containing: input data, variables, model, loss, optimizer\n \"\"\"...
[ 4, 8, 9, 11, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep' seed = 300 n_fold = 2 epoch = 50 resume_from = None batch_size = 32 num_workers = 32 imgsize = 768, 768 loss = dict(name='BCEWithLogitsLoss', params=dict()) optim = dict(name='AdamW...
flexible
{ "blob_id": "8030bdb6c9f0b7114916d7abc245ff680d1fc917", "index": 6790, "step-1": "<mask token>\n", "step-2": "workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep'\nseed = 300\nn_fold = 2\nepoch = 50\nresume_from = None\nbatch_size = 32\nnum_workers = 32\nimgsize = 768, 768\nloss = dict...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class mutasibankjurnal(ReportXlsx): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class mutasibankjurnal(ReportXlsx): def generate_xlsx_report(self, workbook, data, wizard): bold = workbook.add_f...
flexible
{ "blob_id": "950929edc82bf78ee33df117fba370b937255adc", "index": 1703, "step-1": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n\n def generate_xlsx_report(self, workbook, data, wizard):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class SingleTouchReading: <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, ribbon): self.ribbon = ribbon self.read_raw_lower() self.read_raw_upper() self.process_readings() def prepare_to_read(self): act...
flexible
{ "blob_id": "06caee24b9d0bb78e646f27486b9a3a0ed5f2502", "index": 6796, "step-1": "<mask token>\n\n\nclass SingleTouchReading:\n <mask token>\n <mask token>\n\n def __init__(self, ribbon):\n self.ribbon = ribbon\n self.read_raw_lower()\n self.read_raw_upper()\n self.process_re...
[ 20, 32, 40, 43, 50 ]
from turtle import * import time import random colormode(255) class Ball(Turtle): def __init__(self, x,y,dx,dy,r): Turtle.__init__(self) self.pu() self.goto(x,y) self.dx = dx self.dy = dy self.r = r self.shape("circle") self.shapesize(r/10) r ...
normal
{ "blob_id": "17cd6746e58a7f33bc239c1420d51c6810ed02d8", "index": 3575, "step-1": "<mask token>\n\n\nclass Ball(Turtle):\n\n def __init__(self, x, y, dx, dy, r):\n Turtle.__init__(self)\n self.pu()\n self.goto(x, y)\n self.dx = dx\n self.dy = dy\n self.r = r\n s...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> output.write("""{} {} {} {} {} {} {} """.format(line1, line2, line3, line4, line5, line6, line7)) <|reserved_special_token_1|> <|reserved_special_token_0|> bank_data = 'Resources/budget_data.csv' bank_df = pd.read_csv(bank_...
flexible
{ "blob_id": "1ad694c68ef264c6fbba4f4b9c069f22818d2816", "index": 9973, "step-1": "<mask token>\n", "step-2": "<mask token>\noutput.write(\"\"\"{}\n{}\n{}\n{}\n{}\n{}\n{}\n\"\"\".format(line1, line2, line3, line4,\n line5, line6, line7))\n", "step-3": "<mask token>\nbank_data = 'Resources/budget_data.csv'\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ui_MainWindow(QMainWindow): threads = [] keywordJudge = '' def __init__(self): super(Ui_MainWindow, self).__init__() self.buy_succeed_count = 0 for func in [self.output_buy_record, self.output_login_status, self .output_register_recor...
flexible
{ "blob_id": "bc0846397a5ad73b1c4b85e12864b27ef4fd08d7", "index": 5358, "step-1": "<mask token>\n\n\nclass Ui_MainWindow(QMainWindow):\n threads = []\n keywordJudge = ''\n\n def __init__(self):\n super(Ui_MainWindow, self).__init__()\n self.buy_succeed_count = 0\n for func in [self.o...
[ 25, 26, 30, 32, 33 ]
def tetrahedron_filled(tetrahedrons, water): var=0 br=0 tetrahedrons.sort() for numbers in tetrahedrons: v=(tetrahedrons[var]**3*(2**0.5))/12000 if v<water: br=br+1 water=water-v var=var+1 print (br) print (tetrahedron_filled([1000,10],10))
normal
{ "blob_id": "c926e16ef2daa5978b6c71e7794721d320bb9b1e", "index": 1224, "step-1": "<mask token>\n", "step-2": "def tetrahedron_filled(tetrahedrons, water):\n var = 0\n br = 0\n tetrahedrons.sort()\n for numbers in tetrahedrons:\n v = tetrahedrons[var] ** 3 * 2 ** 0.5 / 12000\n if v < w...
[ 0, 1, 2, 3 ]
#! /usr/bin/env python from thor.tree import TreeNode class Solution(object): def postorder_traversal(self, root: TreeNode): if not root: return [] else: return self.postorder_traversal(root.left) + self.postorder_traversal(root.right) + [root.val]
normal
{ "blob_id": "1d314a04625cfadf574f122b95577c1e677a8b35", "index": 3247, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution(object):\n\n def postorder_traversal(self, root: TreeNode):\n if not root:\n ...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.1 on 2020-10-10 07:38 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('socialapp', '0004_mesage...
normal
{ "blob_id": "38751da57ad7c786e9fc0722faf065380e5f7e60", "index": 4994, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def std_dev(L, is_sample=0): """calculate standard deviation of given List""" return math.sqrt(variance(L, is_sample)) def z_score(num, mean, std_dev): """calculate z-score given sample size, mean and standard deviation""" return (num - mean) / std_dev <|reserved_speci...
flexible
{ "blob_id": "34acb6da1dc9403a311ce3bca0a828a77b7b36da", "index": 7403, "step-1": "<mask token>\n\n\ndef std_dev(L, is_sample=0):\n \"\"\"calculate standard deviation of given List\"\"\"\n return math.sqrt(variance(L, is_sample))\n\n\ndef z_score(num, mean, std_dev):\n \"\"\"calculate z-score given sampl...
[ 7, 14, 15, 17, 19 ]
<|reserved_special_token_0|> def cauchy_model(x, a, loc, scale, y0): return a * cauchy.pdf(x, loc, scale) + y0 def cauchy_fit(x, y, d): if d is -1: a0 = -(max(y) - min(y)) * (max(x) - min(x)) / 10 loc0 = x[np.argmin(y)] scale0 = (max(x) - min(x)) / 10 y00 = max(y) elif d ...
flexible
{ "blob_id": "aee8fa7bc1426945d61421fc72732e43ddadafa1", "index": 3191, "step-1": "<mask token>\n\n\ndef cauchy_model(x, a, loc, scale, y0):\n return a * cauchy.pdf(x, loc, scale) + y0\n\n\ndef cauchy_fit(x, y, d):\n if d is -1:\n a0 = -(max(y) - min(y)) * (max(x) - min(x)) / 10\n loc0 = x[np....
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def get(restaurant_id): with thrift_client('ers') as ers: cert = ers.get_restaurant_certification(restaurant_id) cert.comment = cert.comment.encode('utf-8') return cert <|reserved_special_token_0|> def add(cert): with thrift_client('ers') as ers: ers.ad...
flexible
{ "blob_id": "746971cd6c5bf65268e89303c8f4ce98a56eb111", "index": 8011, "step-1": "<mask token>\n\n\ndef get(restaurant_id):\n with thrift_client('ers') as ers:\n cert = ers.get_restaurant_certification(restaurant_id)\n cert.comment = cert.comment.encode('utf-8')\n return cert\n\n\n<mask token>\n\...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> random.seed(1) np.random.seed(1) tf.random.set_random_seed(1) <|reserved_special_token_0|> for i in range(1, 6): df = pd.read_csv(random_sample_save_folder_path + 'power_demand_sample%i.csv' % i, index_col=0) regi...
flexible
{ "blob_id": "d78ac5188cad104ee1b3e214898c41f843b6d8c0", "index": 5185, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.seed(1)\nnp.random.seed(1)\ntf.random.set_random_seed(1)\n<mask token>\nfor i in range(1, 6):\n df = pd.read_csv(random_sample_save_folder_path + \n 'power_demand_sample%...
[ 0, 1, 2, 3, 4 ]
# Libraries from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.orm import relationship # Taskobra from taskobra.orm.base import ORMBase from taskobra.orm.relationships import SystemComponent class System(ORMBase): __tablename__ ...
normal
{ "blob_id": "2fc2fd6631cee5f3737dadaac1a115c045af0986", "index": 5058, "step-1": "<mask token>\n\n\nclass System(ORMBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def add_component(self, component):\n for system_component in self.s...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> def index(request): posts = Post.objects.order_by('-created_at').filter(status='Published') paginator = Paginator(posts, 9) page = request.GET.get('page') post_listings = paginator.get_page(page) context = {'posts': post_listings} return render(request, 'hub/index....
flexible
{ "blob_id": "ee3718dee869a58089e897489af2eec3ff72be56", "index": 3478, "step-1": "<mask token>\n\n\ndef index(request):\n posts = Post.objects.order_by('-created_at').filter(status='Published')\n paginator = Paginator(posts, 9)\n page = request.GET.get('page')\n post_listings = paginator.get_page(pag...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def article_list(request): articles = Article.objects.all() return render(request, 'board/list.html', {'articles': articles}) def article_detail(request, article_id): article = get_object_or_404(Article, id=article_id) comments = article.comment_set.all() return rend...
flexible
{ "blob_id": "6946601050802aaaa559d25612d0d4f5116559eb", "index": 1845, "step-1": "<mask token>\n\n\ndef article_list(request):\n articles = Article.objects.all()\n return render(request, 'board/list.html', {'articles': articles})\n\n\ndef article_detail(request, article_id):\n article = get_object_or_40...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- """ ORIGINAL PROGRAM SOURCE CODE: 1: from __future__ import division, print_function, absolute_import 2: 3: import os 4: from os.path import join 5: 6: from scipy._build_utils import numpy_nodepr_api 7: 8: 9: def configuration(parent_package='',top_path=None): 10: from numpy.distutils....
normal
{ "blob_id": "4453b8176cda60a3a8f4800860b87bddfdb6cafa", "index": 7963, "step-1": "<mask token>\n\n\n@norecursion\ndef configuration(localization, *varargs, **kwargs):\n global module_type_store\n str_32070 = get_builtin_python_type_instance(stypy.reporting.\n localization.Localization(__file__, 9, 3...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for classifier in classifiers: classifier.fit(training_data[:1500], validation_data[:1500]) expected = validation_data[681:] predicted = classifier.predict(training_data[681:]) print('Classification report for clas...
flexible
{ "blob_id": "3024359710148bfbb15677973555f214b1f878b7", "index": 1521, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor classifier in classifiers:\n classifier.fit(training_data[:1500], validation_data[:1500])\n expected = validation_data[681:]\n predicted = classifier.predict(training_data[68...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_lang_dirs(path): languages = [] for name in os.listdir(path): dir_path = os.path.join(path, name) if os.path.isdir(dir_path): cards_file = os.path.join(dir_path, 'cards_' + name + '.json') sets_file = os.path.join(dir_path, 'sets_' +...
flexible
{ "blob_id": "cc1b3c3c65e8832316f72cbf48737b21ee4a7799", "index": 3887, "step-1": "<mask token>\n\n\ndef get_lang_dirs(path):\n languages = []\n for name in os.listdir(path):\n dir_path = os.path.join(path, name)\n if os.path.isdir(dir_path):\n cards_file = os.path.join(dir_path, 'c...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class RoRo(Monument): def set_adm_location(self): counties = self.data_files['counties'] self.set_from_dict_match(counties, 'iso_code', 'judetul_iso', 'located_adm') <|reserved_special_token_0|> def set_heritage_id(self): self.add_statemen...
flexible
{ "blob_id": "5f8a9d82a3245671b438475d1fac7be4db769fbe", "index": 8493, "step-1": "<mask token>\n\n\nclass RoRo(Monument):\n\n def set_adm_location(self):\n counties = self.data_files['counties']\n self.set_from_dict_match(counties, 'iso_code', 'judetul_iso',\n 'located_adm')\n <mas...
[ 4, 5, 8, 9, 11 ]
<|reserved_special_token_0|> class MultiSpeakerBRIR(SimpleFreeFieldHRIR): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def add_metadata(self, database): super().add_metadata(database) database.Data.Type = 'FIRE' database.Room.Type = 'r...
flexible
{ "blob_id": "e30bd33ae18881307e7cf4f60d3c60eae91573bc", "index": 181, "step-1": "<mask token>\n\n\nclass MultiSpeakerBRIR(SimpleFreeFieldHRIR):\n <mask token>\n <mask token>\n <mask token>\n\n def add_metadata(self, database):\n super().add_metadata(database)\n database.Data.Type = 'FIR...
[ 2, 3, 4, 5, 6 ]
from .base import BaseLevel from map_objects import DefinedMap from entity.monster import Daemon from entity.weapons import Axe class FinalLevel(BaseLevel): def __init__(self): lvl_map = DefinedMap('levels/demon_lair.xp') super().__init__(lvl_map.width, lvl_map.height) self.map = lvl_map ...
normal
{ "blob_id": "7ba8f0bd962413f6ff825df27330447b11360f10", "index": 6089, "step-1": "<mask token>\n\n\nclass FinalLevel(BaseLevel):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FinalLevel(BaseLevel):\n\n def __init__(self):\n lvl_map = DefinedMap('levels/demon_lair.xp')\n ...
[ 1, 2, 3, 4 ]
# !/usr/bin/python # sudo mn --custom _mininet_topo.py --topo mytopo,5 # sudo mn --custom _mininet_topo.py --topo mytopo,3 --test simpletest # or just run this python file from mininet.topo import Topo from mininet.net import Mininet from mininet.util import dumpNodeConnections from mininet.log import setLogLevel fro...
normal
{ "blob_id": "8fd74287fbc653ea3ed4aa76a272486aa29185cf", "index": 1032, "step-1": "# !/usr/bin/python\n\n# sudo mn --custom _mininet_topo.py --topo mytopo,5\n# sudo mn --custom _mininet_topo.py --topo mytopo,3 --test simpletest\n# or just run this python file\n\nfrom mininet.topo import Topo\nfrom mininet.net imp...
[ 0 ]
<|reserved_special_token_0|> class AEalLayerColorTemplate(alShadersTemplate): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AEalLayerColorTemplate(alShadersTemplate): <|reserved_special_token_...
flexible
{ "blob_id": "c847e7abe36b62c4518bb535789064e22b5f1db7", "index": 5750, "step-1": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AEalLayerColorTemplate(alShadersTemplate):\n <mask token>\n <ma...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @conf def load_debug_linux_x64_settings(conf): """ Setup all compiler and linker settings shared over all linux_x64 configurations for the 'debug' configuration """ v = conf.env load_linux_x64_common_settings(v) @conf def load_profile_linux_x64_settings(conf): """ Se...
flexible
{ "blob_id": "5848273a76995825f01df53d6beed534e6f9f9fe", "index": 8730, "step-1": "<mask token>\n\n\n@conf\ndef load_debug_linux_x64_settings(conf):\n \"\"\"\n\tSetup all compiler and linker settings shared over all linux_x64 configurations for\n\tthe 'debug' configuration\n\t\"\"\"\n v = conf.env\n load...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(amount_of_bullets): print(i) baraban[i] = 1 print('Посмотрите на барабан', baraban) <|reserved_special_token_0|> for i in range(how_much): random.shuffle(baraban) if baraban[0] == 1: print('Б...
flexible
{ "blob_id": "6c0080aa62579b4cbdaf3a55102924bfe31ffb40", "index": 8107, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(amount_of_bullets):\n print(i)\n baraban[i] = 1\nprint('Посмотрите на барабан', baraban)\n<mask token>\nfor i in range(how_much):\n random.shuffle(baraban)\n if...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pathlib.Path(DIR).mkdir(parents=True, exist_ok=True) print('--------Query Topshot GraphQL Endpoint--------') for setsId in setsIdList: for setId in setsId: count += 1 query = gql( """ { ...
flexible
{ "blob_id": "df518fd719b7eafffd8fee92c926d4d24b65ce18", "index": 7877, "step-1": "<mask token>\n", "step-2": "<mask token>\npathlib.Path(DIR).mkdir(parents=True, exist_ok=True)\nprint('--------Query Topshot GraphQL Endpoint--------')\nfor setsId in setsIdList:\n for setId in setsId:\n count += 1\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if v % 4 == 0: print('Yeah!') else: print('End of the program') <|reserved_special_token_1|> v = 426 if v % 4 == 0: print('Yeah!') else: print('End of the program') <|reserved_special_token_1|> v = 426 # prin...
flexible
{ "blob_id": "ceca1be15aded0a842c5f2c6183e4f54aba4fd24", "index": 6752, "step-1": "<mask token>\n", "step-2": "<mask token>\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n", "step-3": "v = 426\nif v % 4 == 0:\n print('Yeah!')\nelse:\n print('End of the program')\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TeamWordBinding(ResourceBinding): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def group_names(self, instance, action): return [str(instance.user.group.team)] de...
flexible
{ "blob_id": "c2e0f2eda6ef44a52ee4e192b8eb71bde0a69bff", "index": 8954, "step-1": "<mask token>\n\n\nclass TeamWordBinding(ResourceBinding):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def group_names(self, instance, action):\n return [str(instance.user....
[ 13, 14, 15, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> curforth.execute(sql) <|reserved_special_token_0|> for record in result: print(record) <|reserved_special_token_1|> <|reserved_special_token_0|> forth = sqlite3.connect('databaserupin.db') sql = 'SELECT * from rupin;' curfo...
flexible
{ "blob_id": "a7f082737bf476a4bc6a40c962764c05bed9ee14", "index": 9247, "step-1": "<mask token>\n", "step-2": "<mask token>\ncurforth.execute(sql)\n<mask token>\nfor record in result:\n print(record)\n", "step-3": "<mask token>\nforth = sqlite3.connect('databaserupin.db')\nsql = 'SELECT * from rupin;'\ncur...
[ 0, 1, 2, 3, 4 ]
# https://leetcode-cn.com/problems/zigzag-conversion/ # 6. Z 字形变换 class Solution: def convert(self, s: str, numRows: int) -> str: res = '' for i in range(numRows): pass return res
normal
{ "blob_id": "aa952e8f9a1855b5578cb26d6e5aca42605ee585", "index": 5454, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def convert(self, s: str, numRows: int) ->str:\n res = ''\n for i in range(numRows):\n pass\n r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): n = int(input()) a_list = list(map(int, input().split())) a_list_reversed, num_reverse = bubble_sort(a_list, n) print(' '.join(map(str, a_list_reversed))) print(num_reverse) <|reserved_special_t...
flexible
{ "blob_id": "fef1273552350bfaf075d90279c9f10a965cae25", "index": 2939, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n n = int(input())\n a_list = list(map(int, input().split()))\n a_list_reversed, num_reverse = bubble_sort(a_list, n)\n print(' '.join(map(str, a_list_reversed...
[ 0, 1, 2, 3, 4 ]
import os # must pip install sox # type sudo apt install sox into cmd duration = .2 # seconds freq = 550 # Hz os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))
normal
{ "blob_id": "8397dcdcb9ec2f35dac0c26b8878a23f9149512b", "index": 3113, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('play -nq -t alsa synth {} sine {}'.format(duration, freq))\n", "step-3": "<mask token>\nduration = 0.2\nfreq = 550\nos.system('play -nq -t alsa synth {} sine {}'.format(durat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @pytest.fixture() def test_data(): """Return data used for tests in this file.""" x = np.array([8, 67, 79, 10, 52, 53, 98, 34, 15, 58], dtype=float) y = np.array([24, 87, 48, 94, 98, 66, 14, 24, 60, 16], dtype=float) z = np.array([0.064, 4.489, 6.241, 0.1, 2.704, 2.809, 9....
flexible
{ "blob_id": "9e987e057ee5322765415b84e84ef3c4d2827742", "index": 5466, "step-1": "<mask token>\n\n\n@pytest.fixture()\ndef test_data():\n \"\"\"Return data used for tests in this file.\"\"\"\n x = np.array([8, 67, 79, 10, 52, 53, 98, 34, 15, 58], dtype=float)\n y = np.array([24, 87, 48, 94, 98, 66, 14, ...
[ 7, 9, 10, 11, 13 ]
<|reserved_special_token_0|> def walkDockerfiles(path, splitFirt=True): """ 遍历目录中的所有dockerfile Arguments: path {string} -- 目录路径 Keyword Arguments: splitFirt {bool} -- 去除文件开头的path (default: {True}) Returns: array -- dockerfile文件列表 """ files_list = [] i...
flexible
{ "blob_id": "400f9b6fb0ab73a920e6b73373615b2f8d1103bb", "index": 2301, "step-1": "<mask token>\n\n\ndef walkDockerfiles(path, splitFirt=True):\n \"\"\" 遍历目录中的所有dockerfile\n \n Arguments:\n path {string} -- 目录路径\n \n Keyword Arguments:\n splitFirt {bool} -- 去除文件开头的path (default: {True...
[ 3, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class MTCNN: def __init__(self, device=None, model=None): if device is None: device = 'cuda' if torch.cuda.is_available() else 'cpu' self.device = device url = 'https://github.com/deepware/dFace/raw/master/models/mtcnn.pt' if model is None:...
flexible
{ "blob_id": "865121e7eb5f9c70adf44d33d21f30c22f13ec56", "index": 7012, "step-1": "<mask token>\n\n\nclass MTCNN:\n\n def __init__(self, device=None, model=None):\n if device is None:\n device = 'cuda' if torch.cuda.is_available() else 'cpu'\n self.device = device\n url = 'https...
[ 17, 18, 19, 21, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Book(models.Model): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Book(models.Model): title = models.TextField(max_length=32, blank=False, null=False) <|reserve...
flexible
{ "blob_id": "8286407987301ace7af97d6acdcf6299ce3d8525", "index": 5440, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Book(models.Model):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Book(models.Model):\n title = models.TextField(max_length=32, blank=False, null=False)\n", "s...
[ 0, 1, 2, 3, 4 ]
from django.http import HttpResponseRedirect from django.shortcuts import render from django.views.generic import TemplateView from pos.service.sumup import API_URL, create_checkout from pos.models.sumup import SumUpAPIKey, SumUpOnline from pos.forms import RemotePayForm from pos.models.user import User class Remote...
normal
{ "blob_id": "731d2891bbc29879fd8900a11077c93550e4e88d", "index": 4251, "step-1": "<mask token>\n\n\nclass RemotePayView(TemplateView):\n template_name = 'remotepay/pay.djhtml'\n\n\n<mask token>\n\n\ndef pay_callback(request, checkoutid):\n t = SumUpOnline.objects.get(transaction_id=checkoutid)\n if t.st...
[ 3, 4, 7, 8, 9 ]
import os from apps.app_base.app_utils.cryp_key import decrypt, get_secret_key BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = get_secret_key DEBUG = True ALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]'] # Application definition INSTALLED_APPS = [ 'corsheaders', 'd...
normal
{ "blob_id": "027a049ffced721f2cd697bc928bfdf718630623", "index": 4692, "step-1": "<mask token>\n", "step-2": "<mask token>\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nSECRET_KEY = get_secret_key\nDEBUG = True\nALLOWED_HOSTS = ['.localhost', '127.0.0.1', '[::1]']\nINSTALLED_APPS = [...
[ 0, 1, 2, 3 ]
from . import * from rest_framework import permissions from core.serializers import CategorySerializer from core.models.category_model import Category class CategoryViewSet(viewsets.ModelViewSet): serializer_class = CategorySerializer queryset = Category.objects.all() def get_permissions(self): ...
normal
{ "blob_id": "5723e7889663142832a8131bb5f4c35d29692a49", "index": 6325, "step-1": "<mask token>\n\n\nclass CategoryViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CategoryViewSet(viewsets.ModelViewSet):\n <mask token>\n <mask tok...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def evaluate(model, test_features, test_labels): predictions = model.predict(test_features) errors = abs(predictions - test_labels) mape = 100 * np.mean(errors / test_labels) accuracy = 100 - mape print('平均气温误差.', np.mean(errors)) print('Accuracy = {:0.2f}%.'.forma...
flexible
{ "blob_id": "de4e14a4fa8520c1aae60805084224337dd9620c", "index": 9009, "step-1": "<mask token>\n\n\ndef evaluate(model, test_features, test_labels):\n predictions = model.predict(test_features)\n errors = abs(predictions - test_labels)\n mape = 100 * np.mean(errors / test_labels)\n accuracy = 100 - m...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class FundOperationCreateView(CreateView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def form_valid(self, form): context = self.get_context_data() ...
flexible
{ "blob_id": "3c2fb3d09edab92da08ac8850f650a2fa22fad92", "index": 8806, "step-1": "<mask token>\n\n\nclass FundOperationCreateView(CreateView):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def form_valid(self, form):\n context = self.get_context_data()\n ...
[ 9, 10, 11, 12, 14 ]
class MyClass: name = "alice" def set_name(self, name): self.name = name def get_name(self): return self.name def say_hello(self): self.greet = "Hello" def say_hi(self): print("HI~~~~~") p1 = MyClass() p2 = MyClass() print(p1.name) p1.s...
normal
{ "blob_id": "babb5ac680c74e19db5c86c2c3323e8285d169ff", "index": 9939, "step-1": "class MyClass:\n <mask token>\n\n def set_name(self, name):\n self.name = name\n\n def get_name(self):\n return self.name\n\n def say_hello(self):\n self.greet = 'Hello'\n\n def say_hi(self):\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> LOGIN_USERNAME = 'YOUR_USERNAME' LOGIN_PASSWORD = 'YOUR_PASSWORD'
flexible
{ "blob_id": "5a092150896e4082431849828793f86adcd2211c", "index": 8202, "step-1": "<mask token>\n", "step-2": "LOGIN_USERNAME = 'YOUR_USERNAME'\nLOGIN_PASSWORD = 'YOUR_PASSWORD'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# -*- coding: utf-8 -*- import datetime from unittest.mock import patch from odoo.tests import common import odoo from .common import RunbotCase class TestSchedule(RunbotCase): def setUp(self): # entering test mode to avoid that the _schedule method commits records registry = odoo.registry() ...
normal
{ "blob_id": "aa515b1b919eb557cd8c7e5f4d22773980b5af96", "index": 8213, "step-1": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestSchedule(RunbotCase):\n <mask token>\n\n @patch('odoo.addons.runbot.models.build.os.path.getmt...
[ 1, 2, 3, 4, 5 ]
import subprocess import glob import os import time import sys import xml.etree.ElementTree as ET import getpass import psutil if len(sys.argv)==1: photoscanname = r"C:\Program Files\Agisoft\PhotoScan Pro\photoscan.exe" scriptname = r"C:\Users\slocumr\github\SimUAS\batchphotoscan\agiproc.py" #xmlnames ...
normal
{ "blob_id": "00f95733505b3e853a76bbdd65439bcb230fa262", "index": 3345, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) == 1:\n photoscanname = 'C:\\\\Program Files\\\\Agisoft\\\\PhotoScan Pro\\\\photoscan.exe'\n scriptname = (\n 'C:\\\\Users\\\\slocumr\\\\github\\\\SimUAS\\\\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "5cd767564e8a261561e141abeebb5221cb3ef2c2", "index": 6919, "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 = [('presentes',...
[ 0, 1, 2, 3, 4 ]
import random #quicksort a list of objects based on keys, which can be any of 3 values # done in O(n) time in one pass, and O(1) additional space complexity def quicksort(x, pivot_index): key1_idx, key2_idx, key3_idx = 0, 0, len(x) key1_val, key2_val= 'key1', 'key2' while key2_idx < key3_idx: if x...
normal
{ "blob_id": "f193094c551df2a32860948b1a8710b53ca0dfb6", "index": 2413, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef quicksort(x, pivot_index):\n key1_idx, key2_idx, key3_idx = 0, 0, len(x)\n key1_val, key2_val = 'key1', 'key2'\n while key2_idx < key3_idx:\n if x[key2_idx]['key']...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from svg_ros.srv import * import rospy from std_msgs.msg import String from geometry_msgs.msg import Twist from math import * import roslib from nav_msgs.msg import Odometry #Global variables base_distance_x0=0 base_distance_y0=0 base_angle_0=0 base_distance_x1=0 base_distance_y1=0 base_angle_1=...
normal
{ "blob_id": "402acaa263ee620fbd9bf7d271dce2e5de4eeae0", "index": 2005, "step-1": "#!/usr/bin/env python\nfrom svg_ros.srv import *\nimport rospy\nfrom std_msgs.msg import String\nfrom geometry_msgs.msg import Twist\nfrom math import *\nimport roslib\nfrom nav_msgs.msg import Odometry\n\n\n#Global variables\nbase...
[ 0 ]
from django.urls import path from . import apiviews from rest_framework.authtoken.views import obtain_auth_token urlpatterns = [path('contacts', apiviews.ContactsView.as_view(), name= 'contacts'), path('contact/<int:pk>', apiviews.ContactView.as_view(), name='contact'), path('signup', apiviews.create_user_with_...
normal
{ "blob_id": "5f56838ad0717c4f7a2da6b53f586a88b0166113", "index": 8629, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('contacts', apiviews.ContactsView.as_view(), name=\n 'contacts'), path('contact/<int:pk>', apiviews.ContactView.as_view(),\n name='contact'), path('signup', apiv...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('faculty.csv') as facultycsv: emails = list() for line in facultycsv: line = line.split(',') if line[0] == 'name': continue try: email = line[3].rstrip() ...
flexible
{ "blob_id": "5af5c10c149c7b0e2a969be7895780d26a4294d0", "index": 7326, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('faculty.csv') as facultycsv:\n emails = list()\n for line in facultycsv:\n line = line.split(',')\n if line[0] == 'name':\n continue\n try...
[ 0, 1, 2, 3 ]
# Copyright (c) 2011-2014 by California Institute of Technology # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice,...
normal
{ "blob_id": "707c83bc83f606b570af973094574e6675cfc83f", "index": 8793, "step-1": "<mask token>\n\n\nclass Ridge(object):\n \"\"\"A ridge.\n\n Attributes:\n\n - `E_r`: Equality set of a facet\n\n - `ar, br`: Affine hull of the facet\n s.t. P_{E_0} = P intersection {x | ar x = br}.\n \"\"\"\n\n...
[ 7, 9, 16, 18, 20 ]
# coding: utf-8 import sys #from operator import itemgetter sysread = sys.stdin.readline read = sys.stdin.read from heapq import heappop, heappush from collections import defaultdict sys.setrecursionlimit(10**7) import math #from itertools import product#accumulate, combinations, product #import bisect# lower_bound etc...
normal
{ "blob_id": "f73a3bd7665ac9cc90085fcac2530c93bef69d3d", "index": 6705, "step-1": "<mask token>\n\n\ndef run():\n mod = 1000000007\n N, *AB = map(int, read().split())\n A_B = []\n INF = float('inf')\n zerozero = 0\n for i in range(N):\n a = AB[2 * i]\n b = AB[2 * i + 1]\n if...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Conexion: def __init__(self, direccion, destino): self.set_direccion(direccion) self.set_destino(destino) <|reserved_special_token_0|> <|reserved_special_token_0|> def set_direccion(self, direccion): self._direccion = direccion <|reserve...
flexible
{ "blob_id": "f59e61977f7c72ab191aadccbd72d23f831b3a1c", "index": 7050, "step-1": "<mask token>\n\n\nclass Conexion:\n\n def __init__(self, direccion, destino):\n self.set_direccion(direccion)\n self.set_destino(destino)\n <mask token>\n <mask token>\n\n def set_direccion(self, direccion...
[ 20, 22, 25, 26, 27 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', url('^$', 'analyze.views.analyze', name='analyze')) <|reserved_special_token_1|> from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from djan...
flexible
{ "blob_id": "035de226c2d2ee85cb7e319de35fb09b21bc523d", "index": 9061, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^$', 'analyze.views.analyze', name='analyze'))\n", "step-3": "from django.conf.urls import patterns, include, url\nfrom django.contrib.auth.decorators im...
[ 0, 1, 2, 3 ]
import logging, os, zc.buildout, sys, shutil class ZipEggs: def __init__(self, buildout, name, options): self.name, self.options = name, options if options['target'] is None: raise zc.buildout.UserError('Invalid Target') if options['source'] is None: raise zc.buildou...
normal
{ "blob_id": "e7bec9018f25ba9e3c3ae8a5bbe11f8bc4b54a04", "index": 5714, "step-1": "import logging, os, zc.buildout, sys, shutil\n\nclass ZipEggs:\n def __init__(self, buildout, name, options):\n self.name, self.options = name, options\n if options['target'] is None:\n raise zc.buildout...
[ 0 ]
# Example solution for HW 5 # %% # Import the modules we will use import os import numpy as np import pandas as pd import matplotlib.pyplot as plt # %% # ** MODIFY ** # Set the file name and path to where you have stored the data filename = 'streamflow_week5.txt' #modified filename filepath = os.path.join('../data', ...
normal
{ "blob_id": "5024db0538f0022b84c203882df9c35979ba978a", "index": 4571, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(os.getcwd())\nprint(filepath)\n<mask token>\nprint(data.tail(14))\nprint(data.tail(14).describe())\nprint(data.tail(7).describe())\n<mask token>\nprint(data_2019['flow'].describe())...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "1aaace83af0235341d10b8ac3b47d00a944dac37", "index": 1422, "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 = [('story1', '0...
[ 0, 1, 2, 3, 4 ]
from nltk.tokenize import RegexpTokenizer from stop_words import get_stop_words from nltk.stem.porter import PorterStemmer from gensim import corpora, models import gensim tokenizer = RegexpTokenizer(r'\w+') # create English stop words list en_stop = get_stop_words('en') # Create p_stemmer of class PorterStemmer p_s...
normal
{ "blob_id": "3035ac8044b5629d0b5de7934e46890ad36ed551", "index": 7798, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in doc_set:\n raw = i.lower()\n tokens = tokenizer.tokenize(raw)\n stopped_tokens = [i for i in tokens if not i in en_stop]\n stemmed_tokens = [p_stemmer.stem(i) for i i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def readadc(adcnum, clockpin, mosipin, misopin, cspin): if adcnum > 7 or adcnum < 0: return -1 GPIO.output(cspin, True) GPIO.output(clockpin, False) GPIO.output(cspin, False) commandout = adcnum commandout |= 24 commandout <<= 3 for i in range(5): ...
flexible
{ "blob_id": "fcdb43e36a4610ca0201a27d82b1a583f1482878", "index": 8924, "step-1": "<mask token>\n\n\ndef readadc(adcnum, clockpin, mosipin, misopin, cspin):\n if adcnum > 7 or adcnum < 0:\n return -1\n GPIO.output(cspin, True)\n GPIO.output(clockpin, False)\n GPIO.output(cspin, False)\n comm...
[ 4, 5, 6, 7, 10 ]
<|reserved_special_token_0|> def rotate(files, dst, value=90): for file_ in files: img = Image.open(file_) img = img.rotate(value) name = '{}{}{}'.format(dst, os.sep, os.path.basename(file_)) img.save(name) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_s...
flexible
{ "blob_id": "cd104eec21be8a59e8fb3bd8ab061dd357fc126a", "index": 667, "step-1": "<mask token>\n\n\ndef rotate(files, dst, value=90):\n for file_ in files:\n img = Image.open(file_)\n img = img.rotate(value)\n name = '{}{}{}'.format(dst, os.sep, os.path.basename(file_))\n img.save(n...
[ 1, 2, 3, 4, 5 ]
import os, argparse,collections defaults ={'color':'red','user':'guest'} parser=argparse.ArgumentParser() parser.add_argument('-u','--user') parser.add_argument('-c','--color') #a simple Namespace object will be built up from attributes parsed out of the command lin namespace= parser.parse_args() command_line_args= ...
normal
{ "blob_id": "3c31e3f2a6f320bc5ae33f0ba1d234a089371899", "index": 9199, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-u', '--user')\nparser.add_argument('-c', '--color')\n<mask token>\nprint(combined['color'])\nprint(combined['user'])\n", "step-3": "<mask token>\ndefaults = {'colo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def hash_string(input_string: str) ->str: return hashlib.sha256(input_string.encode('utf-8')).hexdigest() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def hash_string(input_st...
flexible
{ "blob_id": "670a23aa910a6709735281b7e64e5254a19277c6", "index": 7924, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef hash_string(input_string: str) ->str:\n return hashlib.sha256(input_string.encode('utf-8')).hexdigest()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef hash_string(inp...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def func(i): if i % 2 != 0: return False visited = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] temp = i while i: x = i % 10 if visited[x] == 1 or x == 0: break visited[x] = 1 i = int(i / 10) if i == 0...
flexible
{ "blob_id": "1a8c9be389aad37a36630a962c20a0a36c449bdd", "index": 3809, "step-1": "<mask token>\n", "step-2": "def func(i):\n if i % 2 != 0:\n return False\n visited = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n temp = i\n while i:\n x = i % 10\n if visited[x] == 1 or x == 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def isPentagon(item): num = math.floor(math.sqrt(item * 2 // 3)) + 1 if num * (3 * num - 1) // 2 == item: return True return False <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def isPentagon(item): num = math.floor(m...
flexible
{ "blob_id": "0aec3fbc9f4b9f33aee021fa417c43f0feb0e3d1", "index": 3296, "step-1": "<mask token>\n\n\ndef isPentagon(item):\n num = math.floor(math.sqrt(item * 2 // 3)) + 1\n if num * (3 * num - 1) // 2 == item:\n return True\n return False\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef i...
[ 1, 3, 4, 5, 6 ]
""""Module for miscellaneous behavior stuff For example, stuff like extracting lick times or choice times. TrialSpeak shouldn't depend on stuff like that. # Also get the pldf and use that to get lick times ldf = ArduFSM.TrialSpeak.read_logfile_into_df(bdf.loc[idx, 'filename']) # Get the lick times ...
normal
{ "blob_id": "78761eda403ad8f54187e5858a23c23d3dd79b09", "index": 8821, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_choice_times(behavior_filename, verbose=False):\n \"\"\"Calculates the choice time for each trial in the logfile\"\"\"\n state_num2names = MCwatch.behavior.db.get_state_...
[ 0, 1, 2, 3, 4 ]
import re import ngram import smoothedNgram def split_into_sentences(text): text = text.lower() sentences = re.split(r'(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s', text) getSentences(sentences,text) return sentences def getTextWithoutSpaces(text): withoutLineBreaks = text.replace("\n", "") withoutS...
normal
{ "blob_id": "6d7db5b9a64ec25763f5af6ceec1a46d629d549c", "index": 472, "step-1": "<mask token>\n\n\ndef getTextWithoutSpaces(text):\n withoutLineBreaks = text.replace('\\n', '')\n withoutSpaces = re.sub(' +', ' ', withoutLineBreaks)\n return withoutSpaces\n\n\ndef getSentences(sentences, text):\n data...
[ 3, 5, 6, 7, 8 ]
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
normal
{ "blob_id": "8ae10aada79b0a687732e341d275eb3823ec0e4a", "index": 9475, "step-1": "<mask token>\n\n\nclass BucketDatasetGenerator:\n \"\"\"\n Provide data distribution of different gears for the bert network.\n\n Args:\n data_set (Dataset): The training dataset.\n batch_size (Int): The trai...
[ 8, 11, 12, 13, 14 ]
import random def multi(): scc = [6, 5, 4] sc = [6, 5] cc = [5, 4] crew = [4] captain = [5] ship = [6] n = 0 while n <= 2: inp = input("Hit enter to roll") if inp == "": roll5 = random.choices(range(1, 7), k=5) print(roll5) if set(scc)...
normal
{ "blob_id": "bb540ba4cd96e2485e77ba099f0a1a9ea03e1120", "index": 8144, "step-1": "<mask token>\n\n\ndef multi():\n scc = [6, 5, 4]\n sc = [6, 5]\n cc = [5, 4]\n crew = [4]\n captain = [5]\n ship = [6]\n n = 0\n while n <= 2:\n inp = input('Hit enter to roll')\n if inp == '':...
[ 1, 2, 3, 4, 5 ]
#---------------------------- # | # Instagram Bot- Devesh Kr. Verma # instagram- @felon_tpf # | #---------------------------- from selenium import webdriver from time import sleep from selenium.webdriver.common.keys import Keys import random import string from time import sleep from selenium import we...
normal
{ "blob_id": "6d18aa585c656b244d1e4272caa8419c04b20b6c", "index": 2363, "step-1": "<mask token>\n\n\ndef start():\n username = browser.find_element_by_name('username')\n username.send_keys('Username')\n password = browser.find_element_by_name('password')\n password.send_keys('Password')\n nextButto...
[ 1, 3, 4, 5, 6 ]
from dataclasses import dataclass from datetime import date @dataclass class Book: id: int title: str author: str genre: str published: date status: str = 'Available' def __str__(self): return f'{self.id}: {self.title} by {self.author}' def get_more_information(self): ...
normal
{ "blob_id": "dc13ca17bff8e2a5254c7758bd7274926bafd454", "index": 5312, "step-1": "<mask token>\n\n\n@dataclass\nclass Book:\n id: int\n title: str\n author: str\n genre: str\n published: date\n status: str = 'Available'\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\n@dat...
[ 1, 2, 3, 4, 5 ]
import torch from training import PointNetTrain, PointAugmentTrain, Model #from PointAugment.Augment.config import opts from data_utils.dataloader import DataLoaderClass from mpl_toolkits import mplot3d import matplotlib.pyplot as plt import numpy as np import yaml def visualize_batch(pointclouds, pred_labels, labels,...
normal
{ "blob_id": "0ced42c8bfaad32fc2b397326150e6c7bc5cedab", "index": 4991, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef visualize_batch(pointclouds, pred_labels, labels, categories):\n batch_size = len(pointclouds)\n fig = plt.figure(figsize=(8, batch_size / 2))\n ncols = 5\n nrows = ma...
[ 0, 1, 2, 3, 4 ]
import RPi.GPIO as GPIO import numpy as np import array import time import json import LED_GPIO as led import BUTTON_GPIO as btn import parseJson as gjs rndBtnState = False interval = .1 rndbtn = gjs.getJsonRnd() gpioValues = gjs.getJsonData() strArray = gpioValues[0] btnArray = gpioValues[1] ledArray = gpioValue...
normal
{ "blob_id": "1b741b34649193b64479724670244d258cfbbdfc", "index": 5055, "step-1": "import RPi.GPIO as GPIO\nimport numpy as np\nimport array\nimport time\nimport json\n\nimport LED_GPIO as led \nimport BUTTON_GPIO as btn\nimport parseJson as gjs\n\nrndBtnState = False\ninterval = .1\n\nrndbtn = gjs.getJsonRnd()\n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setuptools.setup(name='cppersist', install_requires=['Eve']) <|reserved_special_token_1|> import setuptools setuptools.setup(name='cppersist', install_requires=['Eve'])
flexible
{ "blob_id": "4f1956b34ac3b55b2d40220b79816c139b4a2f5c", "index": 9574, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetuptools.setup(name='cppersist', install_requires=['Eve'])\n", "step-3": "import setuptools\nsetuptools.setup(name='cppersist', install_requires=['Eve'])\n", "step-4": null, "step...
[ 0, 1, 2 ]
import socket END = bytearray() END.append(255) print(END[0]) def recvall(sock): # Odbiór danych BUFF_SIZE = 4096 # 4 KiB data = b'' while True: # odbieramy dane, pakiety 4KiB part = sock.recv(BUFF_SIZE) data += part if len(part) < BUFF_SIZE: # 0 lub koniec danych ...
normal
{ "blob_id": "aa13278a4686e9bab7948c2f212f87f9bd6eee00", "index": 969, "step-1": "<mask token>\n\n\ndef recvall(sock):\n BUFF_SIZE = 4096\n data = b''\n while True:\n part = sock.recv(BUFF_SIZE)\n data += part\n if len(part) < BUFF_SIZE:\n break\n return data\n\n\n<mask...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> import FWCore.ParameterSet.Config as cms from RecoTracker.MeasurementDet.UpdaterService_cfi import * from RecoTracker.MeasurementDet.MeasurementTrackerESProducer_cfi import *
flexible
{ "blob_id": "e79505e802a06f091bbb12708c45e04c4e80da60", "index": 7618, "step-1": "<mask token>\n", "step-2": "import FWCore.ParameterSet.Config as cms\nfrom RecoTracker.MeasurementDet.UpdaterService_cfi import *\nfrom RecoTracker.MeasurementDet.MeasurementTrackerESProducer_cfi import *\n", "step-3": null, ...
[ 0, 1 ]
<|reserved_special_token_0|> class Autoencoder(function.Function): <|reserved_special_token_0|> def hidden(self, x): h = _Encoder(self.W, self.b1)(x) if self.activation is not None: h = self.activation(h) h.unchain_backward() return h @property def paramet...
flexible
{ "blob_id": "97eb599ae8bf726d827d6f8313b7cf2838f9c125", "index": 4098, "step-1": "<mask token>\n\n\nclass Autoencoder(function.Function):\n <mask token>\n\n def hidden(self, x):\n h = _Encoder(self.W, self.b1)(x)\n if self.activation is not None:\n h = self.activation(h)\n h...
[ 11, 13, 14, 15, 17 ]
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
normal
{ "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 n_gram_hash(hash_bits=16, ngram_length=1, skip_length=0, all_lengths= True, seed=314489979, ordered=True, invert_hash=0, **params): """ **Description** Extracts NGrams from text and convert them to vector...
flexible
{ "blob_id": "fb1974ad7ac9ae54344812814cb95a7fccfefc66", "index": 5880, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef n_gram_hash(hash_bits=16, ngram_length=1, skip_length=0, all_lengths=\n True, seed=314489979, ordered=True, invert_hash=0, **params):\n \"\"\"\n **Description**\n ...
[ 0, 1, 2, 3 ]
''' Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Note: A leaf is a node with no children. ''' # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val...
normal
{ "blob_id": "fa081ccd8081f5c3319f482b7d8abd7415d8e757", "index": 1273, "step-1": "'''\nGiven a binary tree, find its maximum depth.\n\nThe maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.\n\nNote: A leaf is a node with no children.\n\n'''\n\n\n\n# Def...
[ 0 ]
# Generated by Django 3.0.4 on 2020-03-29 19:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0003_auto_20200330_0444'), ] operations = [ migrations.AlterField( model_name='information', name='comment'...
normal
{ "blob_id": "72c1226d40b3cdce29ef28493344c3cf68892149", "index": 6001, "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 = [('index', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class tgApp(object): def __init__(self): builder = gtk.Builder() builder.add_from_file('../tg.glade') self.window = builder.get_object('window1') self.text_area = builder.get_object('text_entry') self.window.show() self.opcao = '' ...
flexible
{ "blob_id": "6b6fac3bfb1b1478dd491fc4dd9c45a19aeb7bd8", "index": 6102, "step-1": "<mask token>\n\n\nclass tgApp(object):\n\n def __init__(self):\n builder = gtk.Builder()\n builder.add_from_file('../tg.glade')\n self.window = builder.get_object('window1')\n self.text_area = builder...
[ 6, 8, 9, 10, 12 ]
from selenium import webdriver; from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.keys import Keys import time driver = webdriver.Chrome(Chr...
normal
{ "blob_id": "1a1a217b382f3c58c6c4cd3c1c3f556ae945f5a7", "index": 7850, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.implicitly_wait(10)\ndriver.maximize_window()\ndriver.get('http://demo.automationtesting.in/Register.html')\n<mask token>\nactions.move_to_element(interactions).move_to_element(dra...
[ 0, 1, 2, 3, 4 ]
import sys, string, math s = input() print(ord(s))
normal
{ "blob_id": "ade300f2921ca860bbe92aa351df2c88238b7996", "index": 6039, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(ord(s))\n", "step-3": "<mask token>\ns = input()\nprint(ord(s))\n", "step-4": "import sys, string, math\ns = input()\nprint(ord(s))\n", "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2, 3 ]
from setuptools import setup, find_packages def find_version(): with open('pytest_defer.py') as fp: for line in fp: if '__version__' in line: version = line.split('=')[-1].strip() return version[1:-1] # trim '' with open('README.md') as fp: long_desc = fp...
normal
{ "blob_id": "7903484b4a36d4b6ea03b9eaf3bf2b2e056baad8", "index": 8148, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_version():\n with open('pytest_defer.py') as fp:\n for line in fp:\n if '__version__' in line:\n version = line.split('=')[-1].strip()\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NeuralNetworkClassifier: <|reserved_special_token_0|> def fit(self, X_train, Y_train): num_input_dimensions = X_train.shape[1] self._num_classes = Y_train.shape[1] training_set_size = X_train.shape[0] self._W_1 = 1 / np.sqrt(self._hidden_unit...
flexible
{ "blob_id": "6199a2ac12e80395f4a7a54877c5b639315e64aa", "index": 7702, "step-1": "<mask token>\n\n\nclass NeuralNetworkClassifier:\n <mask token>\n\n def fit(self, X_train, Y_train):\n num_input_dimensions = X_train.shape[1]\n self._num_classes = Y_train.shape[1]\n training_set_size = ...
[ 9, 15, 19, 21, 26 ]
import logging from django.contrib.auth.models import User import json from django.http import HttpResponse from enumfields.fields import EnumFieldMixin from Api.models import Status logger = logging.getLogger() logger.setLevel(logging.INFO) def check_cookie(request): # Post.objects.all().delete() result = ...
normal
{ "blob_id": "2bc3b0df720788e43da3d9c28adb22b3b1be8c58", "index": 5002, "step-1": "<mask token>\n\n\ndef check_cookie(request):\n result = {'status': True}\n try:\n user_id = request.GET.get('user_id')\n user = User.objects.get(pk=user_id)\n cookie_status = user.profile.cookie_status\n ...
[ 1, 2, 3, 4, 5 ]