code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(seq.split(',')) print(tuple(seq.split(','))) <|reserved_special_token_1|> seq = input('write a sequence of numbers: ') print(seq.split(',')) print(tuple(seq.split(',')))
flexible
{ "blob_id": "be867d600f5f267986368f5573006f63004dbf9e", "index": 5094, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(seq.split(','))\nprint(tuple(seq.split(',')))\n", "step-3": "seq = input('write a sequence of numbers: ')\nprint(seq.split(','))\nprint(tuple(seq.split(',')))\n", "step-4": null...
[ 0, 1, 2 ]
import sys import numpy as np import bpcs as bp from PIL import Image if len(sys.argv)<4: print("USAGE: {0} <PATH> <COLOR> <BIT>".format(sys.argv[0])) print(" PATH: image path") print(" COLOR: GRAY=-1, RED=0, GREEN=1, BLUE=2") print(" BIT : 0~7 (0:MSB, 7:LSB)") exit(1) PATH = sys...
normal
{ "blob_id": "95ea811d38c314f5f19294500e16bae3d00d4fff", "index": 1328, "step-1": "<mask token>\n\n\ndef merge_bitplane_to_image(bitplane, arr, color):\n arr = bp.to_image(arr)\n img = np.zeros(arr.shape)\n img[:, :, color] = bitplane\n return img\n\n\n<mask token>\n", "step-2": "<mask token>\nif le...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def add_cliente(parametros): query = ( 'INSERT INTO clientes VALUES(%s,%s,%s,%s,%s,%s,%s,%s,NULL,NULL,%s,NULL,%s)' ) get_connection(query, parametros) print('Datos almacenados') get_clientes() <|reserved_special_token_0|> <|reserved_special_token_1|> <...
flexible
{ "blob_id": "035a87ccf21d45b2c147da4315c2143bea1ff21d", "index": 8173, "step-1": "<mask token>\n\n\ndef add_cliente(parametros):\n query = (\n 'INSERT INTO clientes VALUES(%s,%s,%s,%s,%s,%s,%s,%s,NULL,NULL,%s,NULL,%s)'\n )\n get_connection(query, parametros)\n print('Datos almacenados')\n ...
[ 1, 5, 7, 9, 10 ]
# Ex 1 numbers = [10,20,30, 9,-12] print("The sum of 'numbers' is:",sum(numbers)) # Ex 2 print("The largest of 'numbers' is:",max(numbers)) # Ex 3 print("The smallest of 'numbers' is:",min(numbers)) # Ex 4 for i in numbers: if (i % 2 == 0): print(i,"is even.") # Ex 5 for i in numbers: if (i > 0): ...
normal
{ "blob_id": "ce8879dae6c7585a727e35f588722bc28045256a", "index": 8569, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"The sum of 'numbers' is:\", sum(numbers))\nprint(\"The largest of 'numbers' is:\", max(numbers))\nprint(\"The smallest of 'numbers' is:\", min(numbers))\nfor i in numbers:\n if...
[ 0, 1, 2, 3 ]
import numpy as np import sklearn.cluster as sc import sklearn.metrics as sm import matplotlib.pyplot as mp x = np.loadtxt('C:\\Users\\Administrator\\Desktop\\sucai\\ml_data\\perf.txt', delimiter=',') # 准备训练模型相关数据 epsilons, scores, models = np.linspace(0.3, 1.2, 10), [], [] # 遍历所有的半径,训练模型,查看得分 for epsilon in eps...
normal
{ "blob_id": "01128ebd156b24791548c50c92d2fc1969c42e70", "index": 9756, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor epsilon in epsilons:\n model = sc.DBSCAN(eps=epsilon, min_samples=5)\n model.fit(x)\n score = sm.silhouette_score(x, model.labels_, sample_size=len(x),\n metric='eucli...
[ 0, 1, 2, 3, 4 ]
from rest_framework import serializers class BillBaseSerializer(serializers.Serializer): vendor = serializers.CharField(required=False) amount = serializers.FloatField() bill_date = serializers.DateField() due_date = serializers.DateField() class BillListSerializer(BillBaseSerializer): id = seri...
normal
{ "blob_id": "23160c2f030b0bd862360e944fbbc283c6cb45b2", "index": 6625, "step-1": "<mask token>\n\n\nclass BillListSerializer(BillBaseSerializer):\n id = serializers.SerializerMethodField()\n\n def get_id(self, object):\n return object.key.id()\n\n\nclass BillCreateSerializer(BillBaseSerializer):\n ...
[ 9, 10, 11, 12 ]
import logging import search_yelp import uuid from apiclient import errors from google.appengine.api import taskqueue def insert_worker(mirror_service, food_type=None): logging.info('zip1 food_type %s' % food_type) try: location = mirror_service.locations().get(id='latest').execute() latlong...
normal
{ "blob_id": "22c0b8c8d598bb91bb2333343aad285bbcb4ee5b", "index": 2669, "step-1": "import logging\nimport search_yelp\nimport uuid\nfrom apiclient import errors\nfrom google.appengine.api import taskqueue\n\n\n\ndef insert_worker(mirror_service, food_type=None):\n\n logging.info('zip1 food_type %s' % food_type...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--name', type=str, default='test') parser.add_argument('--input_dim', type=int, default=2) parser.add_argument('--output_dim', type=int, def...
flexible
{ "blob_id": "726aaa0ef129f950e6da6701bb20e893d2f7373b", "index": 3823, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = ArgumentParser()\n parser.add_argument('--name', type=str, default='test')\n parser.add_argument('--input_dim', type=int, default=2)\n pa...
[ 0, 1, 2, 3 ]
""" Routes and views for the flask application. """ from datetime import datetime from flask import render_template, redirect, url_for, request, jsonify from athena_App import app from athena_App.formClass import QuestionForm import time #attention: #this module include large word vector which need a lot of time to ...
normal
{ "blob_id": "3457a7c080da041ad279239bd6a3d214a3b8e49f", "index": 6695, "step-1": "<mask token>\n\n\n@app.route('/QAsearch', methods=['POST', 'GET'])\ndef QAsearch():\n \"\"\"Renders the QAsearch page.\"\"\"\n question = ''\n form = QuestionForm()\n question = form.question.data\n if form.validate_...
[ 9, 10, 11, 12, 13 ]
from typing import List, cast import numpy as np from ..dataset import Transition from .base import TransitionIterator class RandomIterator(TransitionIterator): _n_steps_per_epoch: int def __init__( self, transitions: List[Transition], n_steps_per_epoch: int, batch_size: in...
normal
{ "blob_id": "3b9193fcd69b0387222feab96c50bf3617606cdd", "index": 7329, "step-1": "<mask token>\n\n\nclass RandomIterator(TransitionIterator):\n _n_steps_per_epoch: int\n <mask token>\n\n def _reset(self) ->None:\n pass\n <mask token>\n\n def _has_finished(self) ->bool:\n return self....
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def Theorem4_9(n, b, R): if R >= n: raise ValueError('r* >= n') if b < 0 or b >= n: raise ValueError('b < 0 or b >= n') r, rr = n, b s, ss = 1, 0 t, tt = 0, 1 if r < R: return r, s, t if rr < R: return rr, ss, tt while rr != ...
flexible
{ "blob_id": "2b3a7d0c28d1bf7d4400b0e5558b0527a96af781", "index": 7658, "step-1": "<mask token>\n\n\ndef Theorem4_9(n, b, R):\n if R >= n:\n raise ValueError('r* >= n')\n if b < 0 or b >= n:\n raise ValueError('b < 0 or b >= n')\n r, rr = n, b\n s, ss = 1, 0\n t, tt = 0, 1\n if r <...
[ 3, 5, 6, 7, 8 ]
# %% import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns from sklearn.manifold import TSNE from sklearn.decomposition import PCA, TruncatedSVD import matplotlib.patches as mpatches import time from sklearn.linear_model import LogisticRegression from skle...
normal
{ "blob_id": "3923aed29006b4290437f2b0e11667c702da3241", "index": 4605, "step-1": "<mask token>\n\n\ndef plotTensorflowConfmat(confmat, classes):\n plt.imshow(confmat, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title('Confusion Matrix')\n plt.colorbar()\n tick_marks = np.arange(len(classes))\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class SslExporter(object): gauges = {} def __init__(self, cert_paths): self.cert_paths = cert_paths def collect(self): self.gauges['ssl_valid_days'] = GaugeMetricFamily('ssl_valid_days', 'Ssl cert valid days', value=None, labels=['domain', ...
flexible
{ "blob_id": "83be35b79dcaa34f9273281976ebb71e81c58cdd", "index": 8673, "step-1": "<mask token>\n\n\nclass SslExporter(object):\n gauges = {}\n\n def __init__(self, cert_paths):\n self.cert_paths = cert_paths\n\n def collect(self):\n self.gauges['ssl_valid_days'] = GaugeMetricFamily('ssl_va...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def get_response_carnes(): sparql.setQuery( """ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX saidi: <http://www.semanticweb.org/japor/ontologies/2021/5/PizzasLojanitas#> SELECT DISTINCT ?name WHERE { ?s rdfs:subClass...
flexible
{ "blob_id": "9690366a88a87951f5c51902118888cce8159ffc", "index": 7219, "step-1": "<mask token>\n\n\ndef get_response_carnes():\n sparql.setQuery(\n \"\"\"\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX saidi: <http://www.semanticweb.org/japor/ontologies/2021/5/PizzasLojan...
[ 6, 7, 8, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(""" 1. Lists of Numbers""") print('\t' + str([1, 2, 3])) print(""" 2. Lists of Strings""") print('\t' + str(['Lemon', 'Mango', 'Papaya'])) <|reserved_special_token_0|> print('\tMy favorite fruit is ' + list_fruits[1]) print(""" 3. List operations""") <|...
flexible
{ "blob_id": "4d35bb83378805daf4392a1752386ab1403404e0", "index": 1530, "step-1": "<mask token>\n", "step-2": "print(\"\"\"\n1. Lists of Numbers\"\"\")\nprint('\\t' + str([1, 2, 3]))\nprint(\"\"\"\n2. Lists of Strings\"\"\")\nprint('\\t' + str(['Lemon', 'Mango', 'Papaya']))\n<mask token>\nprint('\\tMy favorite ...
[ 0, 1, 2, 3 ]
import requests from bs4 import BeautifulSoup import time print("Put some unfamiliar skills") unfamilar_skills = input(">") print(f"Filtering result for {unfamilar_skills}...\n") def find_jobs(): html_text = requests.get('https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit...
normal
{ "blob_id": "92b71c67130cd37b2143fbd9ad71fe9a18b3f7e8", "index": 2622, "step-1": "<mask token>\n\n\ndef find_jobs():\n html_text = requests.get(\n 'https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=python&txtLocation='\n ).text\n soup = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(sys.argv) != 2: print('usage: part2.py puzzle_input') exit(1) <|reserved_special_token_0|> for i in range(sys.maxsize): digest = hashlib.md5(puzzle_input.encode('utf-8') + str(i).encode('utf-8') ).hexdig...
flexible
{ "blob_id": "1219f7b7ac335f3a69e289d1ab2b6318a2aef23f", "index": 1900, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) != 2:\n print('usage: part2.py puzzle_input')\n exit(1)\n<mask token>\nfor i in range(sys.maxsize):\n digest = hashlib.md5(puzzle_input.encode('utf-8') + str(i)....
[ 0, 1, 2, 3, 4 ]
# Standard Library imports: import argparse import os from pathlib import Path from typing import Dict, List # 3rd Party imports: import keras.backend as K from keras.layers import * from keras.models import Model import tensorflow as tf from tensorflow.python.framework import graph_io, graph_util from tensorflow.pyth...
normal
{ "blob_id": "a5f3af6fc890f61eecb35bd157fc51bb65b4c586", "index": 3958, "step-1": "<mask token>\n\n\ndef squeezenet_fire_module(input, input_channel_small=16,\n input_channel_large=64):\n channel_axis = 3\n input = Conv2D(input_channel_small, (1, 1), padding='valid')(input)\n input = Activation('relu'...
[ 2, 4, 5, 6, 8 ]
from math import * from numpy import * from random import * import numpy as np import matplotlib.pyplot as plt from colorama import Fore, Back, Style from gridworld import q_to_arrow N_ROWS = 6 N_COLUMNS = 10 class State(object): def __init__(self, i, j, is_cliff=False, is_goal=False): self.i = i ...
normal
{ "blob_id": "cb2e800cc2802031847b170a462778e5c0b3c6f9", "index": 40, "step-1": "<mask token>\n\n\nclass State(object):\n\n def __init__(self, i, j, is_cliff=False, is_goal=False):\n self.i = i\n self.j = j\n self.is_cliff = is_cliff\n self.is_goal = is_goal\n self.q_values =...
[ 14, 16, 20, 21, 22 ]
<|reserved_special_token_0|> class Plugin(LoggerPlugin): <|reserved_special_token_0|> def __init__(self, *args, **kwargs): super(Plugin, self).__init__(*args, **kwargs) self.setDeviceName(devicename) self.smallGUI = True self._last_value = 0 self._jump_allowed = True ...
flexible
{ "blob_id": "c3efaeab600ec9a7a9fffdfad5c9dc1faad8fee7", "index": 726, "step-1": "<mask token>\n\n\nclass Plugin(LoggerPlugin):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super(Plugin, self).__init__(*args, **kwargs)\n self.setDeviceName(devicename)\n self.smallGUI = True...
[ 5, 8, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', views.PostList.as_view(), name='blog_index'), path( '<slug:slug>/', views.post_detail, name='post_detail'), path( 'tag/<slug:slug>/', views.TagIndexView.as_view(), name='tag')] <|reserved_special_...
flexible
{ "blob_id": "09ea684cfb6f0a521d3bdadf977d9385636bdc83", "index": 7150, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.PostList.as_view(), name='blog_index'), path(\n '<slug:slug>/', views.post_detail, name='post_detail'), path(\n 'tag/<slug:slug>/', views.TagIndexView....
[ 0, 1, 2 ]
<|reserved_special_token_0|> class ChildAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ChildAdmin(admin.ModelAdmin): def queryset(self, request): """ Filter the Child objects to only ...
flexible
{ "blob_id": "582f2e6972bad85c2aaedd248f050f708c61973b", "index": 2332, "step-1": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n\n def queryset(self, request):\n \"\"\"\n Filter th...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def shape_list(x): ps = x.get_shape().as_list() ts = tf.shape(x) return [(ts[i] if ps[i] is None else ps[i]) for i in range(len(ps))] def bi_dir_lstm(X, c_fw, h_fw, c_bw, h_bw, units, scope='bi_dir_lstm'): with tf.variable_scope(scope) as sc: hs_fw = [] f...
flexible
{ "blob_id": "e550a2d46e46f0e07d960e7a214fbaa776bab0d5", "index": 4697, "step-1": "<mask token>\n\n\ndef shape_list(x):\n ps = x.get_shape().as_list()\n ts = tf.shape(x)\n return [(ts[i] if ps[i] is None else ps[i]) for i in range(len(ps))]\n\n\ndef bi_dir_lstm(X, c_fw, h_fw, c_bw, h_bw, units, scope='bi...
[ 6, 7, 8, 9, 12 ]
"""Module just for fun game""" # -*- coding: utf-8 -*- from __future__ import print_function from itertools import chain import tabulate import numpy class Game(object): """Класс игры""" def __init__(self): self.field = numpy.array([(-10, -10, -10), (-10, -10, -10), (-10, -10, -10)]) self.rende...
normal
{ "blob_id": "23ba9e498dd153be408e973253d5f2a858d4771b", "index": 6922, "step-1": "<mask token>\n\n\nclass Game(object):\n <mask token>\n <mask token>\n\n def render_field(self):\n \"\"\"Метод отрисовки поля\"\"\"\n print(tabulate.tabulate(self.rendered_field, tablefmt='grid'))\n\n def c...
[ 5, 6, 9, 11, 12 ]
<|reserved_special_token_0|> @router.get('/', response_model=List[ImageReturn]) def get_all_images(db: Session=Depends(ApiSession)): return image_service.get_all_images(db) @router.get('/{image_id}', response_model=ImageReturn) def get_image_by_id(image_id: int, db: Session=Depends(ApiSession)): return imag...
flexible
{ "blob_id": "874ca60749dba9ca8c8ebee2eecb1b80da50f11f", "index": 3782, "step-1": "<mask token>\n\n\n@router.get('/', response_model=List[ImageReturn])\ndef get_all_images(db: Session=Depends(ApiSession)):\n return image_service.get_all_images(db)\n\n\n@router.get('/{image_id}', response_model=ImageReturn)\nde...
[ 4, 5, 6, 7, 8 ]
class ConfigError(ValueError): pass
normal
{ "blob_id": "76dd4d2b5f68683c77f9502a2298e65c97db7c8d", "index": 1263, "step-1": "<mask token>\n", "step-2": "class ConfigError(ValueError):\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import logging from abc import ABC from thraxisgamespatterns.application.handler_map_factory import TGHandlerMapFactory from thraxisgamespatterns.eventhandling.event_distributor import TGEventDistributor from thraxisgamespatterns.factories.logging_rule_engine_factory import TGLoggingRuleEngineFactory class TGAbstract...
normal
{ "blob_id": "d499b4e189a0c3c6efa6a07871dbc6c2996a2dcb", "index": 2245, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TGAbstractRegistry(ABC):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TGAbstractRegistry(ABC):\n\n def __init__(self):\n self.rule_engine = TGLoggingRule...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestRectangle(unittest.TestCase): <|reserved_special_token_0|> def setUp(self): """ setUp """ Base._Base__nb_objects = 0 def tearDown(self): """ tearDown destroys any existing objects and processes """ pass def test_type(self): ...
flexible
{ "blob_id": "ca00091b7ebcb9ee45b77c919c458c75e3db5b1e", "index": 4783, "step-1": "<mask token>\n\n\nclass TestRectangle(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\" setUp \"\"\"\n Base._Base__nb_objects = 0\n\n def tearDown(self):\n \"\"\" tearDown destroys any e...
[ 23, 25, 26, 28, 31 ]
print('\n----------------概率与统计--------------------') import numpy as np import scipy import sympy as sym import matplotlib.pyplot as plt import sklearn.datasets as sd iris = sd.load_iris() x1 = np.random.random([10000]) # 均匀分布 x2 = np.random.normal(2, 1, [10000]) # 正态分布 x3 = np.random.normal(5, 1, [10000]) # 正态分布 #...
normal
{ "blob_id": "1ab5c6a56ac229c5a9892a9848c62a9a19a0dda7", "index": 3360, "step-1": "<mask token>\n\n\ndef conv(dt1, dt2):\n return np.mean((dt1 - np.mean(dt1)) * (dt2 - np.mean(dt2)))\n\n\n<mask token>\n\n\ndef rho(p1, p2):\n return conv(p1, p2) / np.std(p1) / np.std(p2)\n\n\n<mask token>\n", "step-2": "pr...
[ 2, 4, 5, 6, 7 ]
#!/usr/bin/env python # Copyright 2017 Google Inc. 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 require...
normal
{ "blob_id": "fb9ae5b3cdeac0c254669e214779ad43a02bff6d", "index": 4596, "step-1": "<mask token>\n\n\ndef read_dataset(mode, args):\n\n def decode_example(protos, vocab_size):\n features = {'key': tf.FixedLenFeature(shape=[1], dtype=tf.int64),\n 'indices': tf.VarLenFeature(dtype=tf.int64), 'va...
[ 3, 4, 5, 6, 7 ]
# Ques1: # To create a program that asks the user to enter their name and their age # and prints out a message addressed to them that tells them the year that # they will turn 100 years old. Additionally, the program asks the user for # another number and prints out that many copies of the previous message on ...
normal
{ "blob_id": "948b793359555f98872e0bdbf6db970ed1ff3b83", "index": 7046, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(msg * copies)\n", "step-3": "<mask token>\nname = input('Enter your name : ')\nage = int(input('Enter your age : '))\nyear = int(100 - age + datetime.now().year)\ncopies = int(inp...
[ 0, 1, 2, 3, 4 ]
# coding=UTF-8 ''' Created on Jul 21, 2013 @author: jin ''' from django import template register = template.Library() @register.filter def get_list_number(value,num): result=value[num] return result # register.filter('get_list_num', get_list_num) ''' test ''' if __name__=='__main__': print get_list_numb...
normal
{ "blob_id": "679d4b224733dbe264caeeda4e228edd090ea9de", "index": 7797, "step-1": "# coding=UTF-8\n'''\nCreated on Jul 21, 2013\n\n@author: jin\n'''\nfrom django import template\nregister = template.Library()\n@register.filter\ndef get_list_number(value,num):\n result=value[num]\n return result\n# register....
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def run(): parser = testg.OptionParser(description= 'Autonomous grasp and manipulation planning example.') parser.add_option('--scene', action='store', type='string', dest= 'scene', default='/home/user/ex...
flexible
{ "blob_id": "62857a015087500fec534ba1297d42a33ae61927", "index": 7153, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run():\n parser = testg.OptionParser(description=\n 'Autonomous grasp and manipulation planning example.')\n parser.add_option('--scene', action='store', type='string...
[ 0, 1, 2, 3, 4 ]
#Question: """ The parcel section of the Head Post Office is in a mess. The parcels that need to be loaded to the vans have been lined up in a row in an arbitrary order of weights. The Head Post Master wants them to be sorted in the increasing order of the weights of the parcels, with one exception. He wants the heavi...
normal
{ "blob_id": "92dea316889192824c353002670cdcf03dfbcd4c", "index": 1457, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(effort)\n", "step-3": "<mask token>\nsize, k = map(int, input().split())\nparcel = list(map(int, input().split()))\neffort = 2 * parcel[k - 1] * min(parcel) + max(parcel) * min(pa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urc.run(beam_neutrons_path, instrument, samplexmlpath, psi, hkl2Q, pixel, t_m2p, Q, E, hkl_projection, Nbuffer=100000) <|reserved_special_token_1|> <|reserved_special_token_0|> beam_neutrons_path = ( '/SNS/users/p63/ORN...
flexible
{ "blob_id": "47c5fb03cb427d5c9f7703e1715e026b6f2c7a35", "index": 4660, "step-1": "<mask token>\n", "step-2": "<mask token>\nurc.run(beam_neutrons_path, instrument, samplexmlpath, psi, hkl2Q, pixel,\n t_m2p, Q, E, hkl_projection, Nbuffer=100000)\n", "step-3": "<mask token>\nbeam_neutrons_path = (\n '/SN...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.InsureAdmitDTO import InsureAdmitDTO class AlipayInsSceneEcommerceInsureCheckModel(object): def __init__(self): self._insure_admit_dto_list = None self._partn...
normal
{ "blob_id": "e616d14827beaa08ab08219421cbf7990cf163fd", "index": 242, "step-1": "<mask token>\n\n\nclass AlipayInsSceneEcommerceInsureCheckModel(object):\n\n def __init__(self):\n self._insure_admit_dto_list = None\n self._partner_org_id = None\n self._product_code = None\n self._s...
[ 8, 10, 11, 12, 16 ]
from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required from django.views.generic import TemplateView from analyze import views #from lecture import views urlpatterns = patterns('', url(r'^$', 'analyze.views.analyze', name='analyze'), )
normal
{ "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 ]
#!/usr/bin/env python from cos_correct_v2 import * from angle_to_position import * import pandas as pd import datetime as dt def get_position_from_angle(razon, data, start, end): # Obtain cos factors and corrected data dni_df, altitude_angles, azimuth_angles = data cos_correct_df = razon.get_cos_factors(...
normal
{ "blob_id": "13a4fb5ce9ab0a3ef9ce503698615eae4157a637", "index": 7962, "step-1": "<mask token>\n\n\ndef get_position_from_angle(razon, data, start, end):\n dni_df, altitude_angles, azimuth_angles = data\n cos_correct_df = razon.get_cos_factors(altitude_angles, azimuth_angles)\n dni_df = razon.cos_correc...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def longestCommonPrefix(self, strs: [str]) ->str: if not strs: return '' strs.sort(key=len) ...
flexible
{ "blob_id": "80be5f49a179eebc4915bf734a8e362cc2f2ef7c", "index": 3213, "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 longestCommonPrefix(self, strs: [str]) ->str:\n if not strs:\n return ''\n strs....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ba1466.pngMap = [ '11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111' , '11111111111111111111111111111110000000011111111111111111111111111000000000000000011111111111111...
flexible
{ "blob_id": "dbefca59376e567a6116dec4e07c44b1fe301ca9", "index": 9911, "step-1": "<mask token>\n", "step-2": "ba1466.pngMap = [\n '11111111111111111111111111111100000000011111111111111111111111111000000000000000011111111111111111111111111111111111111111111111'\n ,\n '1111111111111111111111111111111000...
[ 0, 1, 2 ]
""" TODO: update description after everything (requirements) is (are) stable/concrete Description: Script to extract KeepingTrac's creative names and send team notification to start manual mapping as necessary. This step must happen BEFORE the processing of deduping of RenTrak creative names (step 2 in RenTrak p...
normal
{ "blob_id": "71c6d5e385e3db8444d7ef8b0231e72db8538eb7", "index": 8106, "step-1": "<mask token>\n\n\ndef notify_no_new_mapping_found():\n email_str = \"\"\"\n <p>Python script does not find any new creative names from keepingtrac data.\n Stage 2 of processing RenTrak data will begin when we load ...
[ 4, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class CloudSat(HDF4): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, **kwargs): super().__init__(**kwargs) @expects_file_info() def get_info(self, file_info, **kwargs): """Return a :class:...
flexible
{ "blob_id": "4328d526da14db756fad8d05457724a23e3e3ef6", "index": 3939, "step-1": "<mask token>\n\n\nclass CloudSat(HDF4):\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, **kwargs):\n super().__init__(**kwargs)\n\n @expects_file_info()\n def get_info(self, file_info, *...
[ 4, 7, 8, 9, 11 ]
<|reserved_special_token_0|> class RaumbelegungSerializer(serializers.ModelSerializer): class Meta: model = models.Raumbelegung fields = ['Belegt', 'Belegungsgrund'] <|reserved_special_token_1|> <|reserved_special_token_0|> class ZeitraumSerializer(serializers.ModelSerializer): class ...
flexible
{ "blob_id": "451c353a949458f5f71783c4aba1888c40018bfa", "index": 9400, "step-1": "<mask token>\n\n\nclass RaumbelegungSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = models.Raumbelegung\n fields = ['Belegt', 'Belegungsgrund']\n", "step-2": "<mask token>\n\n\nclass Zeitraum...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ProductSchema(ma.Schema): class Meta: fields = 'id', 'name', 'description', 'price', 'qty' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Product(db.Model): id = db.Column(db.Integer, primary_key=True) name =...
flexible
{ "blob_id": "ccb131171472d0a92d571e94453be97b323b4484", "index": 7081, "step-1": "<mask token>\n\n\nclass ProductSchema(ma.Schema):\n\n\n class Meta:\n fields = 'id', 'name', 'description', 'price', 'qty'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Product(db.Model):\n id = db.Column(...
[ 1, 3, 4, 5, 7 ]
# noinspection PyStatementEffect { 'name': 'ldap_user', 'summary': '', 'description': '域账号用户管理,登录及查询用户信息', 'author': '', 'website': '', 'source': {'git': 'https://github.com/LeiQiao/Parasite-Plugins.git', 'branch': 'master'}, 'category': '', 'version': '0.1', 'api': { '/use...
normal
{ "blob_id": "b95619f3f52ff3747e38ecc153123962d0122a4d", "index": 387, "step-1": "<mask token>\n", "step-2": "{'name': 'ldap_user', 'summary': '', 'description': '域账号用户管理,登录及查询用户信息',\n 'author': '', 'website': '', 'source': {'git':\n 'https://github.com/LeiQiao/Parasite-Plugins.git', 'branch': 'master'},\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class rocker_connection: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class rocker_connection: @api.multi def create_connection(self): _database_record = self _datasource = _database_record.name _driver = ...
flexible
{ "blob_id": "96131e3d6c67c0ee4ff7f69d4ffedcbf96470f14", "index": 7069, "step-1": "<mask token>\n\n\nclass rocker_connection:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass rocker_connection:\n\n @api.multi\n def create_connection(self):\n _database_record = self\n _datasource = _d...
[ 1, 2, 3, 4, 5 ]
# Jarvis interface class definition import kernel.service class interface(kernel.service.service): def __init__(self, name): self.name = name
normal
{ "blob_id": "237f1f72ac3ef381f115a88025518f387825ff79", "index": 9696, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass interface(kernel.service.service):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass interface(kernel.service.service):\n\n def __init__(self, name):\n self.n...
[ 0, 1, 2, 3, 4 ]
class User: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Admin(User): def __init__(self, username, password, phone, email): super().__init__(username, password) self.phone = phone self.email = email...
flexible
{ "blob_id": "fb26337be29ce06674ca2cb2a82eaff7624aa17f", "index": 9259, "step-1": "class User:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass Admin(User):\n\n def __init__(self, username, password, phone, email):\n super().__init__(username, password)\n self.ph...
[ 5, 8, 9, 10 ]
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.utils.translation import ugettext_lazy as _ from django import forms from programs.models import * from programs.forms import CustomUserCreationForm, CustomUserChangeForm import pdb class ProgramAdmin(admin.ModelAdmin): list...
normal
{ "blob_id": "77e4bbe625251254cdadaeeb23dddf51e729e747", "index": 832, "step-1": "<mask token>\n\n\nclass DepartmentAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def save_model(self, request, obj, form, change):\n if obj.code == '':\n obj...
[ 17, 23, 24, 27, 29 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "7ce471b3a6966c1a60ae2e2f3ec42369fe3d0f9c", "index": 6377, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# -*- mode: python; coding: utf-8 -*- # Copyright 2019-2021 the AAS WorldWide Telescope project # Licensed under the MIT License. from __future__ import absolute_import, division, print_function import numpy as np import numpy.testing as nt import os.path import pytest import sys from xml.etree import ElementTree as ...
normal
{ "blob_id": "618b6c74133e181ce5cbaf4e969d9fc3aa44ce98", "index": 1261, "step-1": "<mask token>\n\n\nclass TestMultiTan(object):\n <mask token>\n if sys.platform == 'darwin':\n WTML = WTML.replace('Dec=\"0.7438249862258411\"',\n 'Dec=\"0.743824986225841\"')\n <mask token>\n\n def tea...
[ 5, 6, 9, 10, 13 ]
from functools import wraps import maya.cmds as mc import maya.mel as mel import pymel.core as pm from PySide2 import QtCore, QtGui, QtWidgets import adb_core.Class__multi_skin as ms import adbrower from CollDict import pysideColorDic as pyQtDic from maya.app.general.mayaMixin import MayaQWidgetDockableMixin import a...
normal
{ "blob_id": "819607d89035413fc2800e9f16222619a74a5d64", "index": 6429, "step-1": "<mask token>\n\n\nclass MultiSkin_UI(MayaQWidgetDockableMixin, QtWidgets.QDialog):\n <mask token>\n <mask token>\n <mask token>\n\n def widgetsAndLayouts(self):\n\n def addLine():\n line = QtWidgets.QF...
[ 17, 18, 23, 24, 28 ]
# -*- coding: utf-8 -*- # import time from openerp.osv import osv, fields import logging import openerp.addons.decimal_precision as dp logger = logging.getLogger(__name__) class ebiz_supplier_account_create(osv.osv_memory): _name = 'ebiz.supplier.account.create.wizard' _description = "Ebiz Supplier Account" ...
normal
{ "blob_id": "309f8016dfebcc3595291b127edb4634f72298ec", "index": 4387, "step-1": "<mask token>\n\n\nclass ebiz_supplier_account_create(osv.osv_memory):\n <mask token>\n <mask token>\n\n def create_supplier_action(self, cr, uid, ids, context=None):\n active_ids = context.get('active_ids', False)\n...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> mathfont.save(f) <|reserved_special_token_0|> mathfont.save(f) <|reserved_special_token_0|> mathfont.save(f) <|reserved_special_token_0|> mathfont.save(f) <|reserved_special_token_0|> mathfont.save(f) <|reserved_special_token_0|> ...
flexible
{ "blob_id": "06638b361c1cbe92660d242969590dfa45b63a4d", "index": 75, "step-1": "<mask token>\n", "step-2": "<mask token>\nmathfont.save(f)\n<mask token>\nmathfont.save(f)\n<mask token>\nmathfont.save(f)\n<mask token>\nmathfont.save(f)\n<mask token>\nmathfont.save(f)\n<mask token>\nmathfont.save(f)\n", "step-...
[ 0, 1, 2, 3, 4 ]
# Uses python3 from decimal import Decimal def gcd_naive(a, b): x = 5 while x > 1: if a % b != 0: c = a % b a = b b = c else: x = 1 return b there = input() store = there.split() a = int(max(store)) b = int(min(store)) factor = gcd_naive(a,b) ...
normal
{ "blob_id": "c70681f5ff8d49a243b7d26164aa5430739354f4", "index": 6936, "step-1": "<mask token>\n\n\ndef gcd_naive(a, b):\n x = 5\n while x > 1:\n if a % b != 0:\n c = a % b\n a = b\n b = c\n else:\n x = 1\n return b\n\n\n<mask token>\n", "step-...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "6aa762165dba891a3638d13862019dd342a7e05a", "index": 7644, "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 = [('users', '00...
[ 0, 1, 2, 3, 4 ]
import datetime def year_choices(): return [(r, r) for r in range(1984, datetime.date.today().year + 1)] def current_year(): return datetime.date.today().year
normal
{ "blob_id": "90bb70b0a97c7872c8581a176ebacc50df8e1f72", "index": 464, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef year_choices():\n return [(r, r) for r in range(1984, datetime.date.today().year + 1)]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef year_choices():\n return [(r, ...
[ 0, 1, 2, 3 ]
from sklearn import cluster from sklearn.metrics import adjusted_rand_score import matplotlib.pyplot as plt def test_Kmeans(*data): x,labels_true = data clst = cluster.KMeans() clst.fit(x) predicted_labels = clst.predict(x) print("ARI: %s" % adjusted_rand_score(labels_true, predicted_labels)) p...
normal
{ "blob_id": "bd419d0a197a5e5a99a370e45cdb53a276ac5507", "index": 5633, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_Kmeans(*data):\n x, labels_true = data\n clst = cluster.KMeans()\n clst.fit(x)\n predicted_labels = clst.predict(x)\n print('ARI: %s' % adjusted_rand_score(lab...
[ 0, 2, 3, 4, 5 ]
#-*- coding: utf-8 -*- def print99(): """ 打印99乘法口诀表 :return: """ for i in range(1,10): for j in range(1, i+1): print('%dX%d=%2s ' %(j,i,i*j)) print('\n') print99()
normal
{ "blob_id": "90f1fd45d58c7e6f275a33cd9c693ff584b2df47", "index": 1396, "step-1": "<mask token>\n", "step-2": "def print99():\n \"\"\"\n 打印99乘法口诀表\n :return:\n \"\"\"\n for i in range(1, 10):\n for j in range(1, i + 1):\n print('%dX%d=%2s ' % (j, i, i * j))\n print('\\n'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(ext_modules=cythonize('utils.pyx')) <|reserved_special_token_1|> from setuptools import setup from Cython.Build import cythonize setup(ext_modules=cythonize('utils.pyx')) <|reserved_special_token_1|> from setuptools im...
flexible
{ "blob_id": "66c71111eae27f6e9fee84eef05cc1f44cc5a477", "index": 3745, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(ext_modules=cythonize('utils.pyx'))\n", "step-3": "from setuptools import setup\nfrom Cython.Build import cythonize\nsetup(ext_modules=cythonize('utils.pyx'))\n", "step-4": "fro...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ViewService(JsonRpcService): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ViewService(JsonRpcService): def json_create(self): return 'Hello, World!' <...
flexible
{ "blob_id": "1b091d139635e90fb53b3fecc09bb879514c7b38", "index": 7352, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ViewService(JsonRpcService):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ViewService(JsonRpcService):\n\n def json_create(self):\n return 'Hello, World!...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from .models import Cliente, Pack # Register your models here. admin.site.register(Pack) admin.site.register(Cliente)
normal
{ "blob_id": "2af590ad11704ecf21489a5d546e61f40dcceee6", "index": 2121, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Pack)\nadmin.site.register(Cliente)\n", "step-3": "from django.contrib import admin\nfrom .models import Cliente, Pack\nadmin.site.register(Pack)\nadmin.site.registe...
[ 0, 1, 2, 3 ]
from tw.core import *
normal
{ "blob_id": "ea25aedc4728c18ac3d5da22c76cb7f1ef65e827", "index": 4958, "step-1": "<mask token>\n", "step-2": "from tw.core import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import json, re, bcrypt, jwt from datetime import datetime, timedelta from django.core.exceptions import ObjectDoesNotExist from django.db.models import Avg from django.http import JsonResponse from django.views import View from room.models import Room, Category, Ro...
normal
{ "blob_id": "cc5b22a0246fcc9feaed6a0663095a6003e6cef1", "index": 6685, "step-1": "<mask token>\n\n\nclass RoomView(View):\n\n def get(self, request, room_id):\n try:\n room = Room.objects.get(id=room_id)\n rating_list = [field.name for field in Review._meta.get_fields(\n ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def findOrder(numCourses, prerequisites): if len(prerequisites) == 0: order = [] for i in range(0, numCourses): order.append(i) return order edges = {} for prerequisite in prerequisites: if prerequisite[...
flexible
{ "blob_id": "56892e125934d5de937b92a08bd7707c12c70928", "index": 689, "step-1": "<mask token>\n", "step-2": "def findOrder(numCourses, prerequisites):\n if len(prerequisites) == 0:\n order = []\n for i in range(0, numCourses):\n order.append(i)\n return order\n edges = {}\...
[ 0, 1, 2, 3 ]
from asteroidhunter import __version__ import unittest, requests, json, os, pytest from dotenv import load_dotenv load_dotenv() from asteroidhunter.asteroid_closest_approach import asteroid_closest_approach def test_version(): assert __version__ == '0.1.0' @pytest.mark.vcr() def test_asteroid_closest_approach()...
normal
{ "blob_id": "7dd4dc60b23c72ba450025bececb0e6d89df69c3", "index": 8263, "step-1": "<mask token>\n\n\ndef test_version():\n assert __version__ == '0.1.0'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_version():\n assert __version__ == '0.1.0'\n\n\n@pytest.mark.vcr()\ndef test_asteroid_closest...
[ 1, 2, 3, 4 ]
from ..models import Empleado, Puesto, Tareas from django.contrib.auth import login, logout from django.contrib.auth.models import User, Group from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework.views import APIView from .serializers import EmpleadoSeri...
normal
{ "blob_id": "cce85d8a34fd20c699b7a87d402b34231b0d5dbb", "index": 3186, "step-1": "<mask token>\n\n\nclass UserViewSet(viewsets.ModelViewSet):\n queryset = User.objects.all()\n model = User\n serializer_class = UserSerializer\n\n def get_permissions(self):\n return (AllowAny() if self.request.m...
[ 9, 11, 14, 16, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(os_join(here, 'README.md')) as f: README = f.read() setup(name='pyzohar', version='0.1.11', author='zoharslong', author_email= 'zoharslong@hotmail.com', description= 'a private package on data pre-processing....
flexible
{ "blob_id": "e0f7837731520ad76ca91d78c20327d1d9bb6d4f", "index": 9970, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(os_join(here, 'README.md')) as f:\n README = f.read()\nsetup(name='pyzohar', version='0.1.11', author='zoharslong', author_email=\n 'zoharslong@hotmail.com', description=\...
[ 0, 1, 2, 3, 4 ]
''' REFERENCE a table with a FOREIGN KEY In your database, you want the professors table to reference the universities table. You can do that by specifying a column in professors table that references a column in the universities table. As just shown in the video, the syntax for that looks like this: ALTER TABLE a A...
normal
{ "blob_id": "deaa458e51a7a53dd954d772f9e3b1734508cf28", "index": 6770, "step-1": "'''\nREFERENCE a table with a FOREIGN KEY\n\nIn your database, you want the professors table to reference the universities table. You can do that by specifying a column in professors table that references a column in the universiti...
[ 0 ]
<|reserved_special_token_0|> class NeuronsGenerator: def __init__(self, neuronsNumber, synapse, lowerBound=100.0 * 10 ** -3, upperBound=800.0 * 10 ** -3, randomVals=False): noramalLeakSourceConfigurator = NormalLeakSourceConfigurator() ozNeuronConfigurator = OZNeuronConfigurator() ...
flexible
{ "blob_id": "177401f25471cf1cbd32dd0770acdc12bf271361", "index": 8030, "step-1": "<mask token>\n\n\nclass NeuronsGenerator:\n\n def __init__(self, neuronsNumber, synapse, lowerBound=100.0 * 10 ** -3,\n upperBound=800.0 * 10 ** -3, randomVals=False):\n noramalLeakSourceConfigurator = NormalLeakSo...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 3.2.6 on 2021-08-19 22:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('chat', '0005_user_image'), ] operations = [ migrations.AlterField( model_name='user', name='first_name', ...
normal
{ "blob_id": "fac60a8967354e4f306b95fdb5c75d02dc2c1455", "index": 2247, "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 = [('chat', '000...
[ 0, 1, 2, 3, 4 ]
import random import json import os from pico2d import * import game_framework import game_world import menu_world import game_state from Start_menu import Menu name = "MenuState" boy = None Start_menu = None menu_time =None def enter(): global Start_menu Start_menu = Menu() menu_world.add_object(Start...
normal
{ "blob_id": "fee2ddca5888c9db00d2d7a4fe11ba20c4e31685", "index": 1909, "step-1": "<mask token>\n\n\ndef enter():\n global Start_menu\n Start_menu = Menu()\n menu_world.add_object(Start_menu, 0)\n\n\n<mask token>\n\n\ndef handle_events():\n global Start_menu, menu_time\n events = get_events()\n ...
[ 4, 6, 7, 8, 10 ]
# Copyright (c) 2018-2020, NVIDIA CORPORATION. import os import shutil import subprocess import sys import sysconfig from distutils.spawn import find_executable from distutils.sysconfig import get_python_lib import numpy as np import pyarrow as pa from Cython.Build import cythonize from Cython.Distutils import build_e...
normal
{ "blob_id": "b3095f181032727544ce3ee6f1ad3a70976c0061", "index": 7892, "step-1": "<mask token>\n\n\nclass build_ext_and_proto(build_ext):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\nif not CUDA_HOME:\n path_to_cuda_gdb = shutil.which('cuda-gdb')\n if path_to_cuda_gdb is None:\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index(request): listTopNews = News.objects.filter(category__category='topside-news') listBottomNews = News.objects.filter(category__category='bottomside-news') listLeftNews = News.objects.filter(category__categor...
flexible
{ "blob_id": "531d1cab3d0860de38f8d1fefee28f10fc018bdb", "index": 9005, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n listTopNews = News.objects.filter(category__category='topside-news')\n listBottomNews = News.objects.filter(category__category='bottomside-news')\n list...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def xd_element(name): """ Return the element of an atom as defined in it's label. """ try: name = name[:2] except: pass try: covalence_radius[name] except: name = name[0] return name <|reserved_special_token_0|> def get_a...
flexible
{ "blob_id": "27e685750e5caa2f80c5a6399b07435ee9aa9fb9", "index": 7936, "step-1": "<mask token>\n\n\ndef xd_element(name):\n \"\"\"\n Return the element of an atom as defined in it's label.\n \"\"\"\n try:\n name = name[:2]\n except:\n pass\n try:\n covalence_radius[name]\n ...
[ 23, 33, 40, 50, 51 ]
<|reserved_special_token_0|> def fbcmd(message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, int(port))) sock.send(message.encode()) if DEBUG: print('INFO: sent to ' + ip + ':' + port + ':' + message) data = sock.recv(1024) if DEBUG: print('INFO: ...
flexible
{ "blob_id": "8eb08fa497ccf3ddc8f4d2b886c9e5a9bdb2e052", "index": 8006, "step-1": "<mask token>\n\n\ndef fbcmd(message):\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock.connect((ip, int(port)))\n sock.send(message.encode())\n if DEBUG:\n print('INFO: sent to ' + ip + ':' + por...
[ 4, 5, 6, 7, 8 ]
N, M = map(int, input().split()) if N >= M // 2: print(M // 2) else: answer = N M -= 2 * N N = 0 print(answer + M // 4)
normal
{ "blob_id": "ba26aa2f33983019b515c5ea287bd5d5d190eeac", "index": 7685, "step-1": "<mask token>\n", "step-2": "<mask token>\nif N >= M // 2:\n print(M // 2)\nelse:\n answer = N\n M -= 2 * N\n N = 0\n print(answer + M // 4)\n", "step-3": "N, M = map(int, input().split())\nif N >= M // 2:\n pr...
[ 0, 1, 2 ]
# Sets up directories MusicDir = "AudioFiles\\" ModelsDir = "Models\\" MonstersDir = "Models\\Monsters\\"
normal
{ "blob_id": "a929bfbe2be6d8f93cafa5b6cc66c7506037ffca", "index": 4735, "step-1": "<mask token>\n", "step-2": "MusicDir = 'AudioFiles\\\\'\nModelsDir = 'Models\\\\'\nMonstersDir = 'Models\\\\Monsters\\\\'\n", "step-3": "# Sets up directories\nMusicDir = \"AudioFiles\\\\\"\nModelsDir = \"Models\\\\\"\nMonsters...
[ 0, 1, 2 ]
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField from wtforms.validators import InputRequired, Length, EqualTo, ValidationError from passlib.hash import pbkdf2_sha256 from models import User def invalid_credentials(form, field): ''' Username and password checker ''' userna...
normal
{ "blob_id": "623bd858923d5f9cc109af586fdda01cd3d5fff3", "index": 961, "step-1": "<mask token>\n\n\nclass CreateRoomForm(FlaskForm):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass CreateUsernameForm(FlaskForm):\n username = StringField('username', validators=[InputRequired(message=\n '...
[ 10, 11, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def openCsv(): """Open csv file.""" csvFile = 'BDO_app/modules/priceCheck/itemID.csv' return csvFile def importAll(): """Import all the items from csv file.""" csvFile = openCsv() items = [] with op...
flexible
{ "blob_id": "47ad08bb153801f592d90c48d62338d0f7703899", "index": 2788, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef openCsv():\n \"\"\"Open csv file.\"\"\"\n csvFile = 'BDO_app/modules/priceCheck/itemID.csv'\n return csvFile\n\n\ndef importAll():\n \"\"\"Import all the items from cs...
[ 0, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestReview: async def test_review_add_get(self, ac, fill_db): token = await register_and_get_token(ac) token2 = await register_and_get_token(ac, main_user=False) for param in [{'lesson_id': []}...
flexible
{ "blob_id": "3ec858c04a7622ae621bf322730b6b3ba9f4d07e", "index": 5826, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestReview:\n\n async def test_review_add_get(self, ac, fill_db):\n token = await register_and_get_token(ac)\n token2 = await register_and_get_token(ac, main_us...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Controller: def __init__(self, port_name, slave_address): self.__instrument = modbus.Instrument(port_name, slave_address, modbus.MODE_ASCII) self.__instrument.serial.baudrate = 9600 self.__instrument.serial.parity = modbus.serial.PARITY_NONE ...
flexible
{ "blob_id": "df3dcbf3c8d621f5db2a07765a0a28e7626387d9", "index": 3485, "step-1": "<mask token>\n\n\nclass Controller:\n\n def __init__(self, port_name, slave_address):\n self.__instrument = modbus.Instrument(port_name, slave_address,\n modbus.MODE_ASCII)\n self.__instrument.serial.bau...
[ 16, 19, 24, 27, 29 ]
#!/usr/bin/python import os from base_exploit import * from reporter import * from netfw import * import sys class remote_shell(base_exploit): id = EXPLOIT_ID_REMOTE_SHELL def exploit(self, ip, port): # Create a connection to requested destination s = socket(AF_INET, SOCK_DGRAM) s.con...
normal
{ "blob_id": "f19e853af675c16dfbb911bf2b756de0f1e3f2f8", "index": 7189, "step-1": "#!/usr/bin/python\n\nimport os\nfrom base_exploit import *\nfrom reporter import *\nfrom netfw import *\nimport sys\n\nclass remote_shell(base_exploit):\n id = EXPLOIT_ID_REMOTE_SHELL\n\n def exploit(self, ip, port):\n ...
[ 0 ]
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from django.utils import timezone from core import models class ChildTestCase(TestCase): def setUp(self): call_command('migrate', verbosity=0) def test...
normal
{ "blob_id": "135401ea495b80fc1d09d6919ccec8640cb328ce", "index": 3901, "step-1": "<mask token>\n\n\nclass TimerTestCase(TestCase):\n\n def setUp(self):\n call_command('migrate', verbosity=0)\n child = models.Child.objects.create(first_name='First', last_name=\n 'Last', birth_date=time...
[ 10, 17, 25, 26, 34 ]
<|reserved_special_token_0|> class profile: def __init__(self): self.name = firstNames[random.randrange(0, len(firstNames)) ] + ' ' + lastNames[random.randrange(0, len(lastNames))] self.years = 2020 self.ppg = [f(round(random.gauss(10.5, 2.4), 1))] self.apg = [f(round(...
flexible
{ "blob_id": "5607d4fea315fa7bf87337453fbef90a93a66516", "index": 3968, "step-1": "<mask token>\n\n\nclass profile:\n\n def __init__(self):\n self.name = firstNames[random.randrange(0, len(firstNames))\n ] + ' ' + lastNames[random.randrange(0, len(lastNames))]\n self.years = 2020\n ...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> def stringDataset(group, name, data, system=None): dset = group.create_dataset(name, (1,), dtype=dt, data=data) if system: addSystemAttribute(dset, system) return dset def addStringAttribute(dset_or_group, name, data): dset_or_group.attrs[name] = bytes(data, 'utf...
flexible
{ "blob_id": "d4ac5c6f08e9baa458fbe0ca7aa90c4d9372844f", "index": 408, "step-1": "<mask token>\n\n\ndef stringDataset(group, name, data, system=None):\n dset = group.create_dataset(name, (1,), dtype=dt, data=data)\n if system:\n addSystemAttribute(dset, system)\n return dset\n\n\ndef addStringAttr...
[ 4, 5, 7, 8, 9 ]
# -*- coding: utf-8 -*- """ Created on Fri Aug 21 12:39:59 2015 @author: user Needs to be run after the basic analysis which loads all the data into workspace """ import pandas as pd import numpy as np import matplotlib.pyplot as plt def AverageLeftRight(EyeData): #Take the average of two eyes to get more accurate gaz...
normal
{ "blob_id": "00ed68c68d51c5019fde0c489cd133be3d6985c3", "index": 9339, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef AverageLeftRight(EyeData):\n for eyes in EyeData:\n eyes['avg_x'] = (eyes['left_x'] + eyes['right_x']) / 2\n eyes['avg_y'] = (eyes['left_y'] + eyes['right_y']) / ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Sprite(Widget): def __init__(self, x, y, w, h, image=None, callback=None, **kw): """Sprite widget """ Widget.__init__(self, x, y, w, h, **kw) if image: self.image = pygame.image.load(image).convert() else: self.ima...
flexible
{ "blob_id": "0003d104a4dcd5a5b2357016cbc0317738c2cd3c", "index": 2007, "step-1": "<mask token>\n\n\nclass Sprite(Widget):\n\n def __init__(self, x, y, w, h, image=None, callback=None, **kw):\n \"\"\"Sprite widget\n \"\"\"\n Widget.__init__(self, x, y, w, h, **kw)\n if image:\n ...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': req = 'https://jsonplaceholder.typicode.com/todos' response = requests.get(req).json() d = {} req_user = 'https://jsonplaceholder.typicode.com/users' users = requests.get(req_user).js...
flexible
{ "blob_id": "53de53614b3c503a4232c00e8f2fd5a0f4cb6615", "index": 1624, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n req = 'https://jsonplaceholder.typicode.com/todos'\n response = requests.get(req).json()\n d = {}\n req_user = 'https://jsonplaceholder.typicode.c...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestWorker(mp.Process): <|reserved_special_token_0|> <|reserved_special_token_0|> def rollout(self): batch_question, batch_question_len, batch_head, batch_answers = (self .env.return_batch_data()) if self.return_trace: l_search_tr...
flexible
{ "blob_id": "c7333d838b87d4c275d9dbb6d7e3047c313b4bc0", "index": 9212, "step-1": "<mask token>\n\n\nclass TestWorker(mp.Process):\n <mask token>\n <mask token>\n\n def rollout(self):\n batch_question, batch_question_len, batch_head, batch_answers = (self\n .env.return_batch_data())\n ...
[ 6, 9, 10, 12, 14 ]
# Generated by Django 2.2 on 2020-11-05 16:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0011_auto_20201104_0936'), ] operations = [ migrations.AddField( model_name='users', name='isadmin', ...
normal
{ "blob_id": "37f610457e51599a29168accd95eaa6699c6f777", "index": 677, "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 = [('accounts', '...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import argparse from speaker.main import run def parse_args(): parser = argparse.ArgumentParser(description='Network speaker device.') parser.add_argument('-d', '--debug', action='store_true', help='enable debugging messages') parser.add_argument('--host', t...
normal
{ "blob_id": "bb173d8869039f8bbd3e35529cf2d99b26d2b8ff", "index": 7130, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_args():\n parser = argparse.ArgumentParser(description='Network speaker device.')\n parser.add_argument('-d', '--debug', action='store_true', help=\n 'enable de...
[ 0, 1, 2, 3, 4 ]
text = input('Ввести имя файла: ') def a(): lines = 0 words = 0 letters = 0 for line in open(f'{text}.txt', 'r'): lines += 1 letters += len(line.strip('.,:-()!?;)"\'\n}')) words += len(line.split()) return f'Lines = {lines}, words = {words}, letters = {letters}' print(a()...
normal
{ "blob_id": "2a65287588fe1337ba1a6f7c2e15e0505611d739", "index": 2228, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef a():\n lines = 0\n words = 0\n letters = 0\n for line in open(f'{text}.txt', 'r'):\n lines += 1\n letters += len(line.strip('.,:-()!?;)\"\\'\\n}'))\n ...
[ 0, 1, 2, 3 ]
<|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": "7bf81954bef81004b6c9838ed00c624d24fcf0c6", "index": 3839, "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 = [('application...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> scraper.scrape('spongebob squarepants', 1, 'path/to/output/directory') <|reserved_special_token_1|> <|reserved_special_token_0|> scraper = DuckDuckGoScraper() scraper.scrape('spongebob squarepants', 1, 'path/to/output/directory...
flexible
{ "blob_id": "d234034f7f232e842d0b4e465ea6ec314af6964d", "index": 4209, "step-1": "<mask token>\n", "step-2": "<mask token>\nscraper.scrape('spongebob squarepants', 1, 'path/to/output/directory')\n", "step-3": "<mask token>\nscraper = DuckDuckGoScraper()\nscraper.scrape('spongebob squarepants', 1, 'path/to/ou...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RRConnection: <|reserved_special_token_0|> <|reserved_special_token_0|> def stop(self): self._isRunning = False self._listenerSocket.close() self._inSock.close() <|reserved_special_token_0|> <|reserved_special_token_0|> def sendAnswe...
flexible
{ "blob_id": "2ccc5e01a3b47a77abcb32160dee74a6a74fcfbb", "index": 5808, "step-1": "<mask token>\n\n\nclass RRConnection:\n <mask token>\n <mask token>\n\n def stop(self):\n self._isRunning = False\n self._listenerSocket.close()\n self._inSock.close()\n <mask token>\n <mask toke...
[ 7, 12, 13, 16, 19 ]
""" Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. find - Find if there exists any pair of numbers which sum is equal to the value. Example 1: add(1); add(3); add(5); find(4) -> true find(7) -> false Example 2: add(3);...
normal
{ "blob_id": "025c740813f7eea37abadaa14ffe0d8c1bedc79d", "index": 6275, "step-1": "<mask token>\n\n\nclass TwoSum:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TwoSum:\n\n def __init__(self):\n \"\"\"\n Initialize your data structure here.\n ...
[ 1, 2, 3, 4, 5 ]
from app.request import send_tor_signal from app.utils.session_utils import generate_user_keys from app.utils.gen_ddg_bangs import gen_bangs_json from flask import Flask from flask_session import Session import json import os from stem import Signal app = Flask(__name__, static_folder=os.path.dirname( os...
normal
{ "blob_id": "26fb607623fda333c37e254470ca6d07708671a8", "index": 5877, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.exists(app.config['CONFIG_PATH']):\n os.makedirs(app.config['CONFIG_PATH'])\nif not os.path.exists(app.config['SESSION_FILE_DIR']):\n os.makedirs(app.config['SESSION_...
[ 0, 1, 2, 3, 4 ]
from random import choice, random from tabulate import tabulate from Constants import * from time import sleep import numpy as np import os class QLearn(): def __init__(self, alfa, gama, epsilon, epsilonDecay, epsilonMin, rewards, environment): self.alfa = alfa self.gama = gama self.epsilon...
normal
{ "blob_id": "221b6ad6035276fb59addc4065c4ccee3f5a2d84", "index": 6351, "step-1": "<mask token>\n\n\nclass QLearn:\n <mask token>\n <mask token>\n\n def checkBoundaries(self, state, action):\n row, column = int(state[0]), int(state[1])\n if action == Directions.UP:\n return f'{ma...
[ 5, 7, 9, 10, 12 ]
import argparse import sys import subprocess import getpass # Process arguments parser = argparse.ArgumentParser(description='Setup a new apache virtual host on an Ubuntu system. Only tested on versions 18.04 and 20.04') parser.add_argument('domain_name', metavar='D', type=str, nargs='+', help='domain name to give to ...
normal
{ "blob_id": "a8e67ddbb741af6a9ff7540fef8c21468321ede0", "index": 7996, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('domain_name', metavar='D', type=str, nargs='+', help=\n 'domain name to give to virtual host. multiple domains can be specified at once'\n )\n<mask token>\nprin...
[ 0, 1, 2, 3, 4 ]