code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# created by Angus Clark 9/2/17 updated 27/2/17 # ToDo impliment traceroute function into this # Perhaps get rid of unnecessary itemediate temp file import socket import os import json import my_traceroute s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = '130.56.253.43' #print host port = 5201 # Change ...
normal
{ "blob_id": "792f62c72f1667f651567314b062d862abbc9aa5", "index": 6692, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.bind((host, port))\ns.listen(5)\n<mask token>\nwhile True:\n c, addr = s.accept()\n f = open('temp.json', 'wb')\n l = c.recv(1024)\n while l:\n f.write(l)\n l ...
[ 0, 1, 2, 3, 4 ]
"""Vista de Autorizaciones (Clientes/Especialistas/Vendedores).""" from django.shortcuts import render from dashboard.json2table import convert from django.utils.translation import ugettext_lazy as _ from api.connection import api from login.utils.tools import role_admin_check from django.utils.decorators import method...
normal
{ "blob_id": "b78ad3a55eb27fd91f89c22db07fadca297640ab", "index": 2892, "step-1": "<mask token>\n\n\nclass Autorization:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AutorizationClient(Autorization):\n \"\"\"\n Manejo de autorizaciones de clientes,\n se listan los clientes, en...
[ 4, 5, 6, 7, 8 ]
import os,sys parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0,parentdir) import xmind from xmind.core.markerref import MarkerId xmind_name="数据结构" w = xmind.load(os.path.dirname(os.path.abspath(__file__))+"\\"+xmind_name+".xmind") s2=w.createSheet() s2.setTitle("二叉树——递归套路")...
normal
{ "blob_id": "b713e38824db13f919484b071fb35afb29e26baa", "index": 3803, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, parentdir)\n<mask token>\ns2.setTitle('二叉树——递归套路')\n<mask token>\nr2.setTitle('二叉树——递归套路')\n<mask token>\nxmind.build(content, r2)\nxmind.save(w, os.path.dirname(os.pat...
[ 0, 1, 2, 3, 4 ]
#!C:\Python27\python print('Content-Type:text/html\n\n') print (""" <html> <head> <link href="iconTech.png" rel="icon"/> <meta name="viewport" content="width=device-width,intial-scale=1.0"/> <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="../css/bootstrap-theme.min.css" rel=...
normal
{ "blob_id": "968cfcfe9d31adcd3a67a88a66e5ebe7b719be8d", "index": 2841, "step-1": "<mask token>\n", "step-2": "print('Content-Type:text/html\\n\\n')\nprint(\n \"\"\"\n<html>\n<head>\n<link href=\"iconTech.png\" rel=\"icon\"/>\n<meta name=\"viewport\" content=\"width=device-width,intial-scale=1.0\"/>\n<link h...
[ 0, 1, 2 ]
"""Tests for Node objects.""" import numpy as np import unittest import optimus.core as core import optimus.nodes as nodes import optimus.util as util def __relu__(x): "Numpy Rectified Linear Unit." return 0.5 * (np.abs(x) + x) class NodeTests(unittest.TestCase): def setUp(self): pass de...
normal
{ "blob_id": "8e74bd0c051b672bf22c2c8dfb03760805b105c5", "index": 8799, "step-1": "<mask token>\n\n\nclass NodeTests(unittest.TestCase):\n <mask token>\n\n def tearDown(self):\n pass\n <mask token>\n <mask token>\n\n def test_Add(self):\n x1 = core.Input(name='x1', shape=(2, 2))\n ...
[ 19, 20, 23, 25, 34 ]
""" Write a program that prompts for the user’s favorite number. Use json.dump() to store this number in a file. Write a separate program that reads in this value and prints the message, “I know your favorite number! It’s _____.” """ import json file_name = 'supporting_files/favourite_number.json' favourite_number = ...
normal
{ "blob_id": "7a359d4b31bd1fd35cd1a9a1de4cbf4635e23def", "index": 7932, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(file_name, 'a') as file_object:\n json.dump(favourite_number, file_object)\nprint(f'{favourite_number} is saved in {file_name}')\n", "step-3": "<mask token>\nfile_name = 's...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Prestamo(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class PrestamoInLine(admin.TabularInline): model = Prestamo extra = 1 class LibroA...
flexible
{ "blob_id": "86fdea2ae8e253aa4639bb3114de70c693536760", "index": 1046, "step-1": "<mask token>\n\n\nclass Prestamo(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass PrestamoInLine(admin.TabularInline):\n model = Prestamo\n extra = 1\n\n\ncla...
[ 7, 8, 12, 13, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Generator: <|reserved_special_token_0|> @staticmethod def generate(level): """ 根据 level 生成指定等级的算术题 0:小学;1:初中;2:高中 """ """ 生成操作数序列以及二元运算符序列 """ le...
flexible
{ "blob_id": "6e3bb17696953256af6d8194128427acebf1daac", "index": 524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Generator:\n <mask token>\n\n @staticmethod\n def generate(level):\n \"\"\"\n 根据 level 生成指定等级的算术题\n 0:小学;1:初中;2:高中\n \"\"\"\n \"\"\"\n...
[ 0, 2, 3, 4 ]
# Pose estimation and object detection: OpenCV DNN, ImageAI, YOLO, mpi, caffemodel, tensorflow # Authors: # Tutorial by: https://learnopencv.com/deep-learning-based-human-pose-estimation-using-opencv-cpp-python/ # Model file links collection (replace .sh script): Twenkid # http://posefs1.perception.cs.cmu.edu/OpenPose/...
normal
{ "blob_id": "c80ae9d2eb07fd716a80a5e2d7b5237925fda02c", "index": 5861, "step-1": "<mask token>\n\n\ndef yolo():\n root = 'Z:\\\\'\n name = '23367640.png'\n execution_path = os.getcwd()\n yolo_path = 'Z:\\\\yolo.h5'\n localdir = False\n detector = ObjectDetection()\n detector.setModelTypeAsYO...
[ 2, 3, 4, 5, 6 ]
''' mock_proto.py ''' from heron.common.src.python import constants import heron.proto.execution_state_pb2 as protoEState import heron.proto.physical_plan_pb2 as protoPPlan import heron.proto.tmaster_pb2 as protoTmaster import heron.proto.topology_pb2 as protoTopology # pylint: disable=no-self-use, missing-docstring c...
normal
{ "blob_id": "002ef36bd132f1ac258b3f8baf8098accbd8a8f2", "index": 6839, "step-1": "<mask token>\n\n\nclass MockProto(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def create_mock_spout(self, spout_name, output_streams, spout_parallelism):\n spout ...
[ 9, 10, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('--rs', type=str, nargs='+') <|reserved_special_token_0|> for f in args.rs: df = ss.read.json(f).select('id', 'subreddit', 'subreddit_id', 'title') post_df = df if post_df is None else post_df.union(df)...
flexible
{ "blob_id": "e6b3def6ed6f2523d88912832a876caf2742b786", "index": 7572, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('--rs', type=str, nargs='+')\n<mask token>\nfor f in args.rs:\n df = ss.read.json(f).select('id', 'subreddit', 'subreddit_id', 'title')\n post_df = df if post_df...
[ 0, 1, 2, 3 ]
import subprocess from whoosh.index import create_in from whoosh.fields import * import os import codecs from whoosh.qparser import QueryParser import whoosh.index as index import json from autosub.autosub import autosub from azure.storage.blob import AppendBlobService vedio_formats = ['mp4','avi','wmv','mov'] # 1 aud...
normal
{ "blob_id": "7b5a16fdc536eb4ae3fdc08f827663613560187a", "index": 8642, "step-1": "import subprocess\nfrom whoosh.index import create_in\nfrom whoosh.fields import *\nimport os\nimport codecs\nfrom whoosh.qparser import QueryParser\nimport whoosh.index as index\nimport json\nfrom autosub.autosub import autosub\nf...
[ 0 ]
#!/usr/bin/python try: fh = open('testfile','w') try: fh.write('This is my test file for this exception') finally: print "Going to close file" fh.close() except IOError: print" Error: can\'t find file or read data"
normal
{ "blob_id": "a538c6d8c9f99bc37def5817a54c831393c051f3", "index": 7395, "step-1": "#!/usr/bin/python\n\n\ntry:\n fh = open('testfile','w')\n try:\n fh.write('This is my test file for this exception')\n finally:\n print \"Going to close file\"\n fh.close()\n\nexcept IOError:\n prin...
[ 0 ]
# -*- coding: utf-8 -*- """ Created on Tue Sep 23 10:16:40 2014 @author: Yusuke """ import math result = [] for i in range(6 * 9**5): sum_num = 0 for j_digit in str(i): sum_num += int(j_digit) ** 5 if sum_num == i: print i result.append(i) print math.fsum(result)
normal
{ "blob_id": "08ccc58fe139db3f4712aa551b80f6ea57e0ad76", "index": 1888, "step-1": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Sep 23 10:16:40 2014\n\n@author: Yusuke\n\"\"\"\nimport math\n\nresult = []\nfor i in range(6 * 9**5):\n sum_num = 0\n for j_digit in str(i):\n sum_num += int(j_digit) **...
[ 0 ]
#!/usr/bin/env python import re pdfs_file = './pdf_names_2017.txt' sessions_file = './session_names_2017.txt' with open(pdfs_file) as f: pdf_names = f.read().splitlines() with open(sessions_file) as f: session_names = f.read().splitlines() #for i in xrange(0,len(pdf_names)): # print str(i+1).zfill(3) +...
normal
{ "blob_id": "e686d8617360c5a3ce35bd4d2bdeb2376b33f53a", "index": 9726, "step-1": "#!/usr/bin/env python\n\nimport re\n\n\npdfs_file = './pdf_names_2017.txt'\nsessions_file = './session_names_2017.txt'\n\nwith open(pdfs_file) as f:\n pdf_names = f.read().splitlines()\n\nwith open(sessions_file) as f:\n sess...
[ 0 ]
<|reserved_special_token_0|> def _func(filename, label): image_string = tf.io.read_file(filename) decode_image = tf.image.decode_jpeg(image_string, channels=3) decode_image = tf.image.resize(decode_image, [FLAGS.img_size - 8, FLAGS .img_size - 8]) / 255.0 if random() > 0.5: decode_imag...
flexible
{ "blob_id": "9ffe350ff9a568111620ef7dafef83d341f6f01e", "index": 9409, "step-1": "<mask token>\n\n\ndef _func(filename, label):\n image_string = tf.io.read_file(filename)\n decode_image = tf.image.decode_jpeg(image_string, channels=3)\n decode_image = tf.image.resize(decode_image, [FLAGS.img_size - 8, F...
[ 7, 8, 9, 10, 12 ]
# -*- coding: utf-8 -*- import pickle import pathlib from pathlib import Path from typing import List, Tuple, Dict import numpy as np import torch import torch.nn as nn from torch.optim import SGD, Adam from torch.utils.data import Dataset, DataLoader from torchtext.data import get_tokenizer from matplotlib import py...
normal
{ "blob_id": "9c653719ea511d78de9ddcc19442d9f9f7dc11dc", "index": 4560, "step-1": "<mask token>\n\n\nclass Vocabulary:\n \"\"\"\n Helper class that maps words to unique indices and the other way around\n \"\"\"\n\n def __init__(self, tokens: List[str]):\n self.word_to_idx = {'<PAD>': 0}\n ...
[ 20, 23, 25, 30, 31 ]
''' Can you print numbers from 1 to 100 without using any loop. ''' # Use Recursion
normal
{ "blob_id": "cc703690151acd17430b5a9715e71a694fdeca10", "index": 2116, "step-1": "<mask token>\n", "step-2": "'''\nCan you print numbers from 1 to 100 without using any loop.\n'''\n\n# Use Recursion", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.contrib import admin from pharma_models.personas.models import Persona admin.site.register(Persona)
normal
{ "blob_id": "59d04ebd9a45c6a179a2da1f88f728ba2af91c05", "index": 590, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Persona)\n", "step-3": "from django.contrib import admin\nfrom pharma_models.personas.models import Persona\nadmin.site.register(Persona)\n", "step-4": null, "ste...
[ 0, 1, 2 ]
from handler.auth import provider_required from handler.provider import ProviderBaseHandler from forms.provider import ProviderAddressForm, ProviderVanityURLForm import logging from data import db from util import saved_message class ProviderEditAddressHandler(ProviderBaseHandler): @provider_required def get(s...
normal
{ "blob_id": "454f885e2254295ce6508e70c0348f5cbe855520", "index": 5071, "step-1": "<mask token>\n\n\nclass ProviderEditAddressHandler(ProviderBaseHandler):\n <mask token>\n <mask token>\n\n\nclass ProviderChangeURLHandler(ProviderBaseHandler):\n\n @provider_required\n def post(self, vanity_url=None):\...
[ 3, 4, 5, 6, 7 ]
# 다이얼 dial = ['ABC', 'DEF', 'GHI','JKL','MNO','PQRS','TUV','WXYZ'] cha = input() num = 0 for i in range(len(cha)): for j in dial: if cha[i] in j: num = num + dial.index(j) + 3 print(num)
normal
{ "blob_id": "774e607c693fa2d5199582302e466674f65b6449", "index": 6213, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(cha)):\n for j in dial:\n if cha[i] in j:\n num = num + dial.index(j) + 3\nprint(num)\n", "step-3": "dial = ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', '...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class UnknownResponseFormat(Exception): pass
flexible
{ "blob_id": "e5e460eb704e2ab5f747d1beee05e012ea95fbd2", "index": 3871, "step-1": "<mask token>\n", "step-2": "class UnknownResponseFormat(Exception):\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from pptx import Presentation import csv prs = Presentation() slide_layout = prs.slide_layouts[1] slide = prs.slides.add_slide(slide_layout) shapes = slide.shapes title_shape = shapes.title body_shape = shapes.placeholders[1] title_shape.text = "Tekst" tf = body_shape.text_frame tf.text = "Zawartość tekst frame" wi...
normal
{ "blob_id": "e1f003b6a687e5654a1ee6c595e789ced02cd6c3", "index": 7086, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('report.csv') as csvfile:\n data = csv.reader(csvfile, delimiter=',')\n for row in data:\n p = tf.add_paragraph()\n p.text = row[0]\n p.level = 1\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def alt(h, dt): t = 0 while True: t = t + 1 a = -6 * t ** 4 + h * t ** 3 + 2 * t ** 2 + t if a <= 0: print('The balloon first touches ground at hour:') print(t) break elif t == dt: ...
flexible
{ "blob_id": "592f29f08637e511bd7d49a3b58f69b700721d89", "index": 8083, "step-1": "<mask token>\n", "step-2": "def alt(h, dt):\n t = 0\n while True:\n t = t + 1\n a = -6 * t ** 4 + h * t ** 3 + 2 * t ** 2 + t\n if a <= 0:\n print('The balloon first touches ground at hour:')...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.8 on 2020-07-29 18:30 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('scenario', '0005_auto_20200729_1149'), ] operations = [ migrations.RemoveField( model_name='weapon', name='vehicle', ...
normal
{ "blob_id": "b99093fb13c59d4b9bb0a4f32fb62423d6752118", "index": 6480, "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 = [('scenario', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def take_second(element): return element[1] <|reserved_special_token_0|> def get_random_name(): name = '' for i in range(random.randint(5, 15)): name += random.choice(string.ascii_letters) return name <|reserved_special_token_0|> <|reserved_special_token_1|...
flexible
{ "blob_id": "21ef8103a5880a07d8c681b2367c2beef727260f", "index": 6536, "step-1": "<mask token>\n\n\ndef take_second(element):\n return element[1]\n\n\n<mask token>\n\n\ndef get_random_name():\n name = ''\n for i in range(random.randint(5, 15)):\n name += random.choice(string.ascii_letters)\n r...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(count): print('Enter details for student', i + 1, 'below:') rollNo = int(input('Rollno: ')) name = input('Name: ') marks = float(input('Marks: ')) records = str(rollNo) + ',' + name + ',' + str(m...
flexible
{ "blob_id": "74cb06ffa41748af431b46c9ff98eb91771a5015", "index": 537, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(count):\n print('Enter details for student', i + 1, 'below:')\n rollNo = int(input('Rollno: '))\n name = input('Name: ')\n marks = float(input('Marks: '))\n r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Content-Type: text/html') print() <|reserved_special_token_0|> cgitb.enable() <|reserved_special_token_0|> print('Name of the user is:', name) <|reserved_special_token_0|> cursor.execute(name) <|reserved_special_token_0|> print(name) db.close() <|res...
flexible
{ "blob_id": "cb28e8bb98cbeed0b703fbfcf7cf30ebca52aa25", "index": 4247, "step-1": "<mask token>\n", "step-2": "print('Content-Type: text/html')\nprint()\n<mask token>\ncgitb.enable()\n<mask token>\nprint('Name of the user is:', name)\n<mask token>\ncursor.execute(name)\n<mask token>\nprint(name)\ndb.close()\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def CALCB2(NVAC, KGAS, LGAS, ELECEN, ISHELL, L1): global ELEV global NSDEG global AA global BB global SCR, SCR1 global PRSH global ESH global AUG global RAD global PRSHBT global IZ global INIOCC global ISHLMX global AMZ global NO...
flexible
{ "blob_id": "09698649510348f92ea3b83f89ffa1c844929b8f", "index": 3332, "step-1": "<mask token>\n\n\ndef CALCB2(NVAC, KGAS, LGAS, ELECEN, ISHELL, L1):\n global ELEV\n global NSDEG\n global AA\n global BB\n global SCR, SCR1\n global PRSH\n global ESH\n global AUG\n global RAD\n global...
[ 3, 4, 5, 6, 7 ]
from logupload import * log = LogUpload() log.uploadLogs(4)
normal
{ "blob_id": "421837698b7fc188c84a3221271f11a40d1625d9", "index": 7280, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.uploadLogs(4)\n", "step-3": "<mask token>\nlog = LogUpload()\nlog.uploadLogs(4)\n", "step-4": "from logupload import *\nlog = LogUpload()\nlog.uploadLogs(4)\n", "step-5": null, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print( '¡hola! te invito a jugar mi juego trivia, trataremos temas como termux xd y entre otras cosas' ) <|reserved_special_token_0|> print('\nmucho gusto', n1, ',empecemos') <|reserved_special_token_0|> print( 'me puedes decir con que comando en ...
flexible
{ "blob_id": "0c297e6f79682896e98c7a2933a4da6d9af7d7fe", "index": 9060, "step-1": "<mask token>\n", "step-2": "print(\n '¡hola! te invito a jugar mi juego trivia, trataremos temas como termux xd y entre otras cosas'\n )\n<mask token>\nprint('\\nmucho gusto', n1, ',empecemos')\n<mask token>\nprint(\n 'm...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^class/([^/]+)/?$', views.puppet_class, name='puppet-class'), url(r'^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'), url(r'^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='add-host'), url(r'^delete/([^/...
normal
{ "blob_id": "add56d52f3c88f814a166d12c3bc5a5906268864", "index": 484, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^class/([^/]+)/?$', views.puppet_class, name=\n 'puppet-class'), url('^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host,\n name='edit-host'), url('^add-host/(?P<fq...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # Developed by Hector Cobos import sys import csv import datetime def mapper(): # Using a reader in order to read the whole file reader = csv.reader(sys.stdin, delimiter='\t') # Jump to the next line. We want to avoid the line with the name of the fields reader.next() # loop for line in reade...
normal
{ "blob_id": "d959ed49a83fb63e0bce31b5c81c013f0986706b", "index": 4314, "step-1": "#!/usr/bin/python\n\n# Developed by Hector Cobos\n\nimport sys\nimport csv\nimport datetime\n\ndef mapper():\n\t# Using a reader in order to read the whole file\n\treader = csv.reader(sys.stdin, delimiter='\\t')\n\t# Jump to the ne...
[ 0 ]
<|reserved_special_token_0|> class task_NER: def __init__(self): self.name = 'NER_task_bio' self.controller_size = 128 self.controller_layers = 1 self.num_read_heads = 1 self.num_write_heads = 1 self.num_inputs = 200 self.num_outputs = 7 self.memory...
flexible
{ "blob_id": "eb99def75404bc3b674bcb633714009149f2d50d", "index": 5097, "step-1": "<mask token>\n\n\nclass task_NER:\n\n def __init__(self):\n self.name = 'NER_task_bio'\n self.controller_size = 128\n self.controller_layers = 1\n self.num_read_heads = 1\n self.num_write_heads...
[ 12, 20, 26, 27, 29 ]
<|reserved_special_token_0|> class Net(torch.nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Net(torch.nn.Module): def __init__(self, layer_sizes=[256, 128, 2], dropout_prob=None, device =None): sup...
flexible
{ "blob_id": "4711adcc7c95993ec13b9d06fa674aa064f79bfd", "index": 314, "step-1": "<mask token>\n\n\nclass Net(torch.nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Net(torch.nn.Module):\n\n def __init__(self, layer_sizes=[256, 128, 2], dropout_prob=None, device\n ...
[ 1, 2, 3, 4, 5 ]
import ordenador import pytest import contatempo class TestaOrdenador: @pytest.fixture def ordenad(self): return ordenador.Ordenador() @pytest.fixture def list_quase_ord(self): c = contatempo.ContaTempos() return c.lista_quase_ordenada(100) @pytest.fixture def list_al...
normal
{ "blob_id": "32bb6d5ad0a1398c9ab89190c087fe3916631878", "index": 7750, "step-1": "<mask token>\n\n\nclass TestaOrdenador:\n\n @pytest.fixture\n def ordenad(self):\n return ordenador.Ordenador()\n <mask token>\n <mask token>\n <mask token>\n\n def test_selecao_bolha_melhorada_aleatoria(se...
[ 5, 6, 8, 9, 11 ]
from datetime import datetime, timezone, timedelta import json import urllib.request from mysql_dbcon import Connection from model import SlackChannel, SlackUser, SlackMessage # TODO set timezone at config jst = timezone(timedelta(hours=+9), 'JST') def get_new_message_list(channel_id: int): with Connection() a...
normal
{ "blob_id": "2b141f12bec2006e496bf58a3fcb0167c95ab3b6", "index": 2530, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_new_message_list(channel_id: int):\n with Connection() as cn:\n token, channel = cn.s.query(SlackChannel.token, SlackChannel.channel\n ).filter(SlackChann...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def swap(arr, first, second): """ Swaps the first index with the second. arr: an input array first: an index in the array second: an index in the array This function has the side effect mentioned above. """ arr[first], arr[second] = arr[second], arr[first...
flexible
{ "blob_id": "1262d41be3bf873d003464cb23998dde20fde318", "index": 8115, "step-1": "<mask token>\n\n\ndef swap(arr, first, second):\n \"\"\"\n Swaps the first index with the second.\n\n arr: an input array\n first: an index in the array\n second: an index in the array\n\n This function has the si...
[ 5, 7, 8, 10 ]
<|reserved_special_token_0|> class Renderable: def __init__(self, material_name: str, attributes: Dict[str, np.ndarray ], model_mat=np.eye(4), uv_scale=1.0): self.model_mat = model_mat self.material_name = material_name self._attributes = attributes self._uv_scale = uv_sca...
flexible
{ "blob_id": "061c287d5f0a5feeeaedc80eea6b3fc4ff02286e", "index": 7191, "step-1": "<mask token>\n\n\nclass Renderable:\n\n def __init__(self, material_name: str, attributes: Dict[str, np.ndarray\n ], model_mat=np.eye(4), uv_scale=1.0):\n self.model_mat = model_mat\n self.material_name = ma...
[ 10, 11, 13, 16, 17 ]
import socket import time class FileTransProgram(object): def __init__(self, ADDR, file_name): self.ADDR = ADDR self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(ADDR) self.file_name = file_name def recv(self): self.sock.send(bytes("Connec...
normal
{ "blob_id": "231a07e63e40f2e4d204cde76c52e64b922da1b8", "index": 2619, "step-1": "<mask token>\n\n\nclass FileTransProgram(object):\n\n def __init__(self, ADDR, file_name):\n self.ADDR = ADDR\n self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n self.sock.connect(ADDR)\n ...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def __print_field_stats(tfield, field, label): good_mask = ~field.mask if not np.any(good_mask): print(f'{label}: no meaningful data') return good_data = field[good_mask] print( f"""{label} {tfield}: {good_data.min()}...{good_data.max()} mean={good_...
flexible
{ "blob_id": "2d5e147b081283047cd044746d73d91ee2e59052", "index": 4139, "step-1": "<mask token>\n\n\ndef __print_field_stats(tfield, field, label):\n good_mask = ~field.mask\n if not np.any(good_mask):\n print(f'{label}: no meaningful data')\n return\n good_data = field[good_mask]\n prin...
[ 3, 4, 5, 6, 7 ]
import scrapy from scrapy.loader import ItemLoader class BlogSpider(scrapy.Spider): name = 'blogspider' start_urls = ['https://blog.scrapinghub.com'] def content_title_parser(self, mystr): return mystr[0].split(' ')[3] def parse(self, response): for url in response.css('ul li a::attr...
normal
{ "blob_id": "4c79dcf394acbcc9a636bcc9b0aac13a2bafc7e3", "index": 9249, "step-1": "<mask token>\n\n\nclass BlogSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n for url in response.css('ul li a::attr(\"href\")').re('.*/category/.*'):\n ...
[ 4, 5, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(x) <|reserved_special_token_1|> x = 'Programming is like building a multilingual puzzle\n' print(x) <|reserved_special_token_1|> #!/usr/bin/env python3 x = "Programming is like building a multilingual puzzle\n" prin...
flexible
{ "blob_id": "95c0ba757b7561ef6cc0ad312034e2695f8420c3", "index": 3933, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x)\n", "step-3": "x = 'Programming is like building a multilingual puzzle\\n'\nprint(x)\n", "step-4": "#!/usr/bin/env python3\n\nx = \"Programming is like building a multilingua...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(h): Vw = 4 * pi * r ** 3 / 3 - pi * h ** 2 / 3 * (3 * r - h) Vs = 4 * pi * r ** 3 / 3 return ρw * Vw - ρs * Vs <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> r = 1.0...
flexible
{ "blob_id": "3e7d2bacb15c39658ef5044685b73068deb1c145", "index": 6060, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f(h):\n Vw = 4 * pi * r ** 3 / 3 - pi * h ** 2 / 3 * (3 * r - h)\n Vs = 4 * pi * r ** 3 / 3\n return ρw * Vw - ρs * Vs\n\n\n<mask token>\n", "step-3": "<mask token>\nr ...
[ 0, 1, 2, 3, 4 ]
#Script start print"This is the two number subtraction python program." a = 9 b = 2 c = a - b print c # Scrip close
normal
{ "blob_id": "a045423edd94d985dfc9660bcfe4a88c61bf4574", "index": 20, "step-1": "#Script start\nprint\"This is the two number subtraction python program.\"\na = 9\nb = 2\nc = a - b\nprint c\n\n# Scrip close\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import os import numpy as np import pycuda import pycuda.driver as driver import cudasim.solvers.cuda.Simulator_mg as sim import cudasim class Lsoda(sim.SimulatorMG): _param_tex = None _step_code = None _runtimeCompile = True _lsoda_source_ = """ extern "C"{ #include <stdio.h> ...
normal
{ "blob_id": "e9754530bef7614c16cdba0e818c1fa188e2d9a2", "index": 9940, "step-1": "<mask token>\n\n\nclass Lsoda(sim.SimulatorMG):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _compile(self, step_code):\n self._beta = 1\n fc = open(os.path.join(os.path.split(os....
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def getChromosome(str): if str == '*' or str[3:] == 'X': return -1 try: return int(str[3:]) except: return -1 <|reserved_special_token_1|> <|reserved_special_token_0|> def parseFile(file, frequency_tree): readnumber = re.compile('[r]+\\d+') ...
flexible
{ "blob_id": "227b71cb6d4cde8f498ad19c1c5f95f7fc572752", "index": 6995, "step-1": "<mask token>\n\n\ndef getChromosome(str):\n if str == '*' or str[3:] == 'X':\n return -1\n try:\n return int(str[3:])\n except:\n return -1\n", "step-2": "<mask token>\n\n\ndef parseFile(file, freque...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ProyectoSistemaViewSet(viewsets.ModelViewSet): queryset = ProyectoSistema.objects.all() serializer_class = ProyectoSistemaSerializer class UsuarioProyectoSistemaViewSet(viewsets.ModelViewSet): queryset = UsuarioProyectoSistema.objects.all() serializer_class = Usuar...
flexible
{ "blob_id": "bedae2621bfcc64deb0d13d7cbce3cfb89720245", "index": 4346, "step-1": "<mask token>\n\n\nclass ProyectoSistemaViewSet(viewsets.ModelViewSet):\n queryset = ProyectoSistema.objects.all()\n serializer_class = ProyectoSistemaSerializer\n\n\nclass UsuarioProyectoSistemaViewSet(viewsets.ModelViewSet):...
[ 6, 8, 9, 12, 14 ]
<|reserved_special_token_0|> @api(canonical_alias='nncf.torch.create_compressed_model') @tracked_function(NNCF_PT_CATEGORY, [CompressionStartedFromConfig(argname= 'config')]) def create_compressed_model(model: Module, config: NNCFConfig, compression_state: Optional[Dict[str, Any]]=None, dummy_forward_fn: ...
flexible
{ "blob_id": "cd1ada2d7979fffc17f707ed113efde7aa134954", "index": 3036, "step-1": "<mask token>\n\n\n@api(canonical_alias='nncf.torch.create_compressed_model')\n@tracked_function(NNCF_PT_CATEGORY, [CompressionStartedFromConfig(argname=\n 'config')])\ndef create_compressed_model(model: Module, config: NNCFConfi...
[ 2, 3, 5, 6, 7 ]
DEFAULT_SIZE = 512 class DataEncoding: @staticmethod def segment_decode(segment): arr = bytearray(segment) ack_binary = bytearray([arr[i] for i in range(4)]) tip_binary = bytearray([arr[4]]) len_binary = bytearray([arr[i] for i in (5,6)]) ack = int.from...
normal
{ "blob_id": "47c5375816ab35e8225e5f3695f7ee2ab5336076", "index": 4312, "step-1": "<mask token>\n\n\nclass DataEncoding:\n\n @staticmethod\n def segment_decode(segment):\n arr = bytearray(segment)\n ack_binary = bytearray([arr[i] for i in range(4)])\n tip_binary = bytearray([arr[4]])\n ...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class TestFileReadingFunctions(unittest.TestCase): def setUp(self): self.data_dir = os.path.join(os.path.dirname(os.path.realpath( __file__)), 'data') self.one_word_per_line_path = os.path.join(self.data_dir, 'one_word_per_line.txt') se...
flexible
{ "blob_id": "7c3798aa9cc5424656572dfaa87f7acb961613eb", "index": 8715, "step-1": "<mask token>\n\n\nclass TestFileReadingFunctions(unittest.TestCase):\n\n def setUp(self):\n self.data_dir = os.path.join(os.path.dirname(os.path.realpath(\n __file__)), 'data')\n self.one_word_per_line_p...
[ 4, 5, 6, 7, 8 ]
<|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": "bf160bd2fc924a11d340bd466b4a879d1cdcd86e", "index": 7639, "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 = [('restapp', '...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import ( StackingClassifier, RandomForestClassifier ) import pandas as pd from sklearn.metrics import f1_score # feel free to import any sklearn model here from sklearn.linear_model import LogisticRegression from ...
normal
{ "blob_id": "cf65966f5daf88bdefc7a8aa2ff80835cff0d0b6", "index": 4627, "step-1": "<mask token>\n\n\ndef load_data():\n \"\"\"\n Helper function for loading in the data\n\n ------\n # of training samples: 419\n # of testing samples: 150\n ------\n \"\"\"\n df = pd.read_csv('../../Data/brea...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Brokerage(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "174f744b641ee20272713fa2fe1991cb2c76830a", "index": 99, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Brokerage(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @ddt class ApiTest(unittest.TestCase): @classmethod def setUpClass(cls) ->None: cls.keyword = Keyword() cls.cookie = None cls.confData = LoadIni('config.ini') logger.info('----------用例开始执行----------') <|reserved_special_token_0|> <|reserved_s...
flexible
{ "blob_id": "b28bada020ac593783ac62994bb45311ebb78813", "index": 9055, "step-1": "<mask token>\n\n\n@ddt\nclass ApiTest(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls) ->None:\n cls.keyword = Keyword()\n cls.cookie = None\n cls.confData = LoadIni('config.ini')\n logge...
[ 2, 3, 4, 5, 6 ]
<|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": "7e11a33d82926ed544640a0192e905d373f575da", "index": 2766, "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 = [('main_app', ...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- # Author: washing # DateTime: 2022/5/18 10:28 # File: 0668.py # Desc: CV class Solution: def findKthNumber(self, m: int, n: int, k: int) -> int: return bisect_left(range(m * n), k, key=lambda x: x // n * n + sum(x // i for i in range(x // n + 1, m + 1)))
normal
{ "blob_id": "ec9efeca7eef7b8ee25c1e089e675bdb1e53413b", "index": 417, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def findKthNumber(self, m: int, n: int, k: int) ->int:\n return bisect_left(range(m * n), k, key=lambda x: x // n * n + s...
[ 0, 1, 2, 3 ]
import json import sys from pkg_resources import resource_string # Load a package data file resource as a string. This _conf = json.loads(resource_string(__name__, 'conf.json')) # Load a data file specified in "package_data" setup option for this pkg. _pkg_data = resource_string(__name__, 'data/pkg1.dat') # Load a d...
normal
{ "blob_id": "4689ee7f7178cef16ac1f5375481a9ee8a48f924", "index": 3780, "step-1": "<mask token>\n\n\ndef hello():\n print(_conf['greeting'])\n print(_pkg_data)\n print(_sys_data)\n\n\n<mask token>\n", "step-2": "<mask token>\ntry:\n _sys_data = open(sys.prefix + '/data/data1.dat').read()\nexcept Exc...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: content = f.read(num + '.txt').decode('utf-8') print(content) comments.append(f.getinfo(num + '.txt').comment.decode('utf-8')) match = re.search('Next nothing is (\\d+)', content) if match == None: ...
flexible
{ "blob_id": "b883e63c70f3dfeac3294989fab93c1331b6329c", "index": 7990, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n content = f.read(num + '.txt').decode('utf-8')\n print(content)\n comments.append(f.getinfo(num + '.txt').comment.decode('utf-8'))\n match = re.search('Next noth...
[ 0, 1, 2, 3, 4 ]
"""------------------------------------------------------------------------ MODULE FContactRegulatoryInfoBase - DESCRIPTION: This file provides the custom instance of RegulatoryInfo on the Contact which has all the RegulatoryInfo related methods VERSION: 1.0.25(0.25.7) RESTRICTIONS/ LIMITATIONS: 1. Any modi...
normal
{ "blob_id": "d4e62950f10efeb27d19c3d9c672969342ef8c7c", "index": 3095, "step-1": "<mask token>\n\n\nclass FContactRegulatoryInfoBase(object):\n\n def __init__(self, contact=None):\n \"\"\"class that maintains all data related to the regulatory on the FContact\"\"\"\n try:\n self.__con...
[ 13, 15, 18, 20, 23 ]
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
normal
{ "blob_id": "0719448e7eb8d48e636be1332c904beebf27e02d", "index": 4163, "step-1": "<mask token>\n\n\nclass PredictionQueryToken(Model):\n <mask token>\n <mask token>\n\n def __init__(self, session=None, continuation=None, max_count=None,\n order_by=None, tags=None, iteration_id=None, start_time=No...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class PhoneSerializer(serializers.ModelSerializer): class Meta: model = Phones fields = 'id', 'number', 'area_code', 'country_code' <|reserved_special_token_1|> from rest_framework import serializers fro...
flexible
{ "blob_id": "e3ba6395a8d7272fc7e5a8be37e6b0b18c355e14", "index": 9272, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PhoneSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Phones\n fields = 'id', 'number', 'area_code', 'country_code'\n", "step-3": "from re...
[ 0, 1, 2, 3 ]
# coding=utf-8 from datetime import datetime, timedelta from flask import current_app as app from flask_script import Command from main import db from models.payment import Payment from models.product import ProductGroup, Product, PriceTier, Price, ProductView, ProductViewProduct from models.purchase import Purchase ...
normal
{ "blob_id": "1de46ee2818b4cb2ae68ef5870581c341f8d9b04", "index": 4020, "step-1": "<mask token>\n\n\nclass CancelReservedTickets(Command):\n\n def run(self):\n payments = Purchase.query.filter(Purchase.state == 'reserved', \n Purchase.modified < datetime.utcnow() - timedelta(days=3), ~\n ...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @main.app_errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @main.app_errorhandler(404) def page_no...
flexible
{ "blob_id": "021cbd1bd22f9ec48db2e52b2a98be169bbfdbbd", "index": 5979, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef page_not_found(e):\n return render_template('404.html'), 404\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@main.app_errorhandler(404)\ndef ...
[ 0, 1, 2, 3, 4 ]
from os import environ as env import json import utils import utils.aws as aws import utils.handlers as handlers def put_record_to_logstream(event: utils.LambdaEvent) -> str: """Put a record of source Lambda execution in LogWatch Logs.""" log_group_name = env["REPORT_LOG_GROUP_NAME"] utils.Log.info("Fet...
normal
{ "blob_id": "01d545e77c211201332a637a493d27608721aad5", "index": 7004, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef put_record_to_logstream(event: utils.LambdaEvent) ->str:\n \"\"\"Put a record of source Lambda execution in LogWatch Logs.\"\"\"\n log_group_name = env['REPORT_LOG_GROUP_NAM...
[ 0, 1, 2, 3, 4 ]
import botocore class s3Obj: def __init__(self, name, bucket_name, size, last_modified, storage_class): self.name = name self.size = size self.last_modified = last_modified self.storage_class = storage_class self.bucket_name = bucket_name self.acl = [] ...
normal
{ "blob_id": "b3f376f4aec81cae853f996a74062e32bb4a8fa3", "index": 2569, "step-1": "<mask token>\n\n\nclass s3Obj:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass s3Obj:\n <mask token>\n\n def getACL(self, client_s3):\n \"\"\"\n get ACL info and update the object\n ...
[ 1, 2, 3, 4, 5 ]
<|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": "de286b94e09db477e3d920a9eff1a299474baf20", "index": 2614, "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def find_square_sum(num): _sum = 0 while num > 0: digit = num % 10 _sum += digit * digit num //= 10 return _sum <|reserved_special_token_0|> <|reserved_special_token_1|> def find_happy_nu...
flexible
{ "blob_id": "60b5e515c7275bfa0f79e22f54302a578c2f7b79", "index": 728, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef find_square_sum(num):\n _sum = 0\n while num > 0:\n digit = num % 10\n _sum += digit * digit\n num //= 10\n return _sum\n\n\n<mask token>\n", "step-...
[ 0, 1, 2, 3, 4 ]
# Overview file #import python classes import numpy as np import random as rn import math import matplotlib.pyplot as plt import pylab from mpl_toolkits.mplot3d import Axes3D #import self produced classes import forcemodule as fm import init_sys # independent parameters dt = 0.004 N=2048 lpnum = 1000 density = 0....
normal
{ "blob_id": "63c214d9e831356345ba2eee68634af36964dcff", "index": 550, "step-1": "# Overview file\n\n#import python classes\nimport numpy as np\nimport random as rn\nimport math\nimport matplotlib.pyplot as plt\nimport pylab\nfrom mpl_toolkits.mplot3d import Axes3D\n\n\n\n#import self produced classes\nimport for...
[ 0 ]
# -*- coding:utf-8 -*- from odoo import api, fields, _, models Type_employee = [('j', 'Journalier'), ('m', 'Mensuel')] class HrCnpsSettings(models.Model): _name = "hr.cnps.setting" _description = "settings of CNPS" name = fields.Char("Libellé", required=True) active = fields.Boolean("Ac...
normal
{ "blob_id": "4f7b689c06383673b510092932b051c644306b84", "index": 3500, "step-1": "<mask token>\n\n\nclass HrCnpsSettings(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass HrCnpsCotisationLineTe...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/python import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import time import seaborn as sns import os from pathlib import Path #import math #functions related to elasticity of WLC def f1(l,lp, kbt): return kbt/lp*(1./(4*(1.-l)*(1.-l))-.25+l) def derf1(l,lp,kbt): return k...
normal
{ "blob_id": "9817600759bc01e89f6c48bdc2d256651aedf74d", "index": 1788, "step-1": "<mask token>\n\n\ndef derf1(l, lp, kbt):\n return kbt / lp * (0.5 / ((1.0 - l) * (1.0 - l) * (1.0 - l)) + 1.0)\n\n\ndef xdefWLC(kbt, l, p, f):\n l0 = 0.9999\n lnew = l0 - (f1(l0, p, kbt) - f) / derf1(l0, p, kbt)\n if ab...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('<int:id>', api_photo_detail_view, name='user_detail'), path('', api_photos_view, name='users')] <|reserved_special_token_1|> from django.urls import path from photo.api.views import api_photo_detail_vie...
flexible
{ "blob_id": "ab4145ccc0b360dcca9b9aa6ebe919bdddac65a2", "index": 3962, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('<int:id>', api_photo_detail_view, name='user_detail'),\n path('', api_photos_view, name='users')]\n", "step-3": "from django.urls import path\nfrom photo.api.vie...
[ 0, 1, 2 ]
""" Client component of the Quartjes connector. Use the ClientConnector to create a connection to the Quartjes server. Usage ----- Create an instance of this object with the host and port to connect to. Call the start() method to establish the connection. Now the database and the stock_exchange variable can be used to...
normal
{ "blob_id": "a8f200e0ae1252df4ad6560e5756347cd0e4c8ba", "index": 5034, "step-1": "<mask token>\n\n\nclass ClientConnector(object):\n <mask token>\n\n def __init__(self, host=None, port=None):\n self._host = host\n if port:\n self._port = port\n else:\n from quartj...
[ 12, 16, 19, 20, 21 ]
a=[i for i in range(10)] del a[0] print a del a[-1] print a del a[1] print a del a[0:2] print a del a[1:3:1] print a #test del all del a[:] print a a.append(1) print a # Make sure that del's work correctly in sub-scopes: x = 1 def f1(): x = range(5) def f2(): del x[1] return f2 f1()()
normal
{ "blob_id": "d0e5cfc7b619c2eaec19248619d7d59e41503c89", "index": 4302, "step-1": "a=[i for i in range(10)]\ndel a[0]\nprint a\ndel a[-1]\nprint a\ndel a[1]\nprint a\n\ndel a[0:2] \nprint a \ndel a[1:3:1]\nprint a\n#test del all\ndel a[:]\nprint a\na.append(1)\nprint a\n\n# Make sure that del's work correctly in ...
[ 0 ]
<|reserved_special_token_0|> def lambda_handler(event, context): products = list(Product.scan(Product.do_crawl == True)) for product in products: product.search_lowest_price() print('{} product(s) crawled'.format(len(products))) <|reserved_special_token_1|> <|reserved_special_token_0|> if not D...
flexible
{ "blob_id": "76905171602cbeb53903a4b0259685288da3a083", "index": 6365, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n products = list(Product.scan(Product.do_crawl == True))\n for product in products:\n product.search_lowest_price()\n print('{} product(s) crawled'.format(len(p...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def formatName(name): arr = re.split(' |-', name) print(arr) gweight = '' gname = [] gnumber = '' for word in arr: if any(str.isdigit(c) for c in word): for weight in weights: pos = word.find(weight) if pos != -1:...
flexible
{ "blob_id": "b808daf8d1fbe3cc585db57e1049a502d3ca46f5", "index": 857, "step-1": "<mask token>\n\n\ndef formatName(name):\n arr = re.split(' |-', name)\n print(arr)\n gweight = ''\n gname = []\n gnumber = ''\n for word in arr:\n if any(str.isdigit(c) for c in word):\n for weigh...
[ 5, 6, 7, 8, 9 ]
import xarray as xr def precip_stats_to_climatology(fili, start_year=1981, end_year=2015): """ Calculates average climatology for annual data - either Jan to Dec or accummulation period """ nyear = end_year - start_year + 1 ds = xr.open_dataset(fili) year = ds['time'].dt.year #dsMsk ...
normal
{ "blob_id": "eb403fbb307332c18ffdcdf52589c714f0719960", "index": 3052, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef precip_stats_to_climatology(fili, start_year=1981, end_year=2015):\n \"\"\"\n Calculates average climatology for annual data - either Jan to Dec or accummulation period\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Geocode(address, apiKey): URL = 'https://geocode.search.hereapi.com/v1/geocode' params = {'q': address, 'apiKey': apiKey} import pdb pdb.set_trace() response = requests.get(URL, params=params).json() ...
flexible
{ "blob_id": "d32496c9bce86f455b24cd9c6dc263aee1bf82af", "index": 3552, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Geocode(address, apiKey):\n URL = 'https://geocode.search.hereapi.com/v1/geocode'\n params = {'q': address, 'apiKey': apiKey}\n import pdb\n pdb.set_trace()\n respo...
[ 0, 2, 3, 4, 5 ]
from secrets import randbelow print(randbelow(100))
normal
{ "blob_id": "18ae982c7fac7a31e0d257f500da0be0851388c2", "index": 8985, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(randbelow(100))\n", "step-3": "from secrets import randbelow\nprint(randbelow(100))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from django import forms from .models import Project from user.models import User from assets.models import Assets class CreateProjectForm(forms.ModelForm): project_name = forms.CharField( label='项目名', widget=forms.TextInput( attrs={"class": "form-control"} ) ) project_...
normal
{ "blob_id": "599c5c02397f283eb00f7343e65c5cb977442e38", "index": 3848, "step-1": "<mask token>\n\n\nclass CreateProjectForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Project\n fields = ['project_name', 'project_desc', 'a...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('-d', type=str, help='dataset') parser.add_argument('-o', type=str, default='dataset', help='output directory') parser.add_argument('-f', type=str, default='mp4', help='format') parser.add_argument('-c', type=s...
flexible
{ "blob_id": "479411727de14e8032b6d01cdb844632111af688", "index": 5275, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('-d', type=str, help='dataset')\nparser.add_argument('-o', type=str, default='dataset', help='output directory')\nparser.add_argument('-f', type=str, default='mp4', he...
[ 0, 1, 2, 3 ]
import math import numpy as np class incStat: def __init__(self, Lambda, isTypeJitter=False): # timestamp is creation time self.CF1 = 0 # linear sum self.CF2 = 0 # sum of squares self.w = 0 # weight self.isTypeJitter = isTypeJitter self.Lambda = Lambda # Decay Factor ...
normal
{ "blob_id": "7b2ca3db44c5f71c2975bd8af701dafca3b3d081", "index": 5492, "step-1": "<mask token>\n\n\nclass windowed_incStat:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass windowed_incStat_2D:\n\n def __init__(self, L):\n self.incSt...
[ 18, 32, 35, 44, 46 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_link(): parser = optparse.OptionParser() parser.add_option('-l', '--link', dest='url', help= 'direct link of file to download .pdf') url, argument = parser.parse_args() return url def download(u...
flexible
{ "blob_id": "22ddae977afd2a1b0a729cf0d56783eaaca3b0a0", "index": 9813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_link():\n parser = optparse.OptionParser()\n parser.add_option('-l', '--link', dest='url', help=\n 'direct link of file to download .pdf')\n url, argument = pa...
[ 0, 2, 3, 4, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logging.basicConfig(level='DEBUG') <|reserved_special_token_0|> client.sendto(message.encode('utf-8'), (serverName, serverPort)) <|reserved_special_token_0|> print(modifiedMessage.decode('utf-8')) client.close() <|reserved_speci...
flexible
{ "blob_id": "4d388c912915c3f1f9e433f1342289f0864b3a11", "index": 409, "step-1": "<mask token>\n", "step-2": "<mask token>\nlogging.basicConfig(level='DEBUG')\n<mask token>\nclient.sendto(message.encode('utf-8'), (serverName, serverPort))\n<mask token>\nprint(modifiedMessage.decode('utf-8'))\nclient.close()\n",...
[ 0, 1, 2, 3, 4 ]
import os _basedir = os.path.abspath(os.path.dirname(__file__)) DEBUG = True SECRET_KEY = '06A52C5B30EC2960310B45E4E0FF21C5D6C86C47D91FE19FA5934EFF445276A0' SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(_basedir, 'app.db') SQLALCHEMY_ECHO = True DATABASE_CONNECT_OPTIONS = {} THREADS_PER_PAGE = 8 CSRF_ENABL...
normal
{ "blob_id": "6ee71cf61ae6a79ec0cd06f1ddc7dc614a76c7b9", "index": 6547, "step-1": "<mask token>\n", "step-2": "<mask token>\n_basedir = os.path.abspath(os.path.dirname(__file__))\nDEBUG = True\nSECRET_KEY = '06A52C5B30EC2960310B45E4E0FF21C5D6C86C47D91FE19FA5934EFF445276A0'\nSQLALCHEMY_DATABASE_URI = 'sqlite:///...
[ 0, 1, 2, 3 ]
from django.db import models # Create your models here. class Advertisement(models.Model): title = models.CharField(max_length=1500, db_index=True, verbose_name='Заголовок') description = models.TextField(blank=True) created_at = models.DateTimeField(auto_now_add=True) update_at = models.DateTimeFiel...
normal
{ "blob_id": "c5bdbcc8ba38b02e5e5cf8b53362e87ba761443d", "index": 8654, "step-1": "<mask token>\n\n\nclass AdvertisementStatus(models.Model):\n name = models.CharField(max_length=100)\n\n def __str__(self):\n return self.name\n\n\nclass Authors(models.Model):\n name = models.CharField(max_length=2...
[ 6, 7, 8, 10, 11 ]
''' config -- config manipulator module for share @author: shimarin @copyright: 2014 Walbrix Corporation. All rights reserved. @license: proprietary ''' import json,argparse import oscar,groonga def parser_setup(parser): parser.add_argument("base_dir") parser.add_argument("operations", nargs="*") ...
normal
{ "blob_id": "8b4590cf2d8c040b6ab31c63baff0d83ab818641", "index": 5423, "step-1": "'''\nconfig -- config manipulator module for share\n\n@author: shimarin\n\n@copyright: 2014 Walbrix Corporation. All rights reserved.\n\n@license: proprietary\n'''\n\nimport json,argparse\nimport oscar,groonga\n\ndef parser...
[ 0 ]
from locations.storefinders.stockinstore import StockInStoreSpider class ScooterHutAUSpider(StockInStoreSpider): name = "scooter_hut_au" item_attributes = {"brand": "Scooter Hut", "brand_wikidata": "Q117747623"} api_site_id = "10112" api_widget_id = "119" api_widget_type = "product" api_origin...
normal
{ "blob_id": "e37f4422c1063df50453f7abf72a0a9a31156d8b", "index": 899, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ScooterHutAUSpider(StockInStoreSpider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\...
[ 0, 1, 2, 3, 4 ]
import os import z5py from shutil import copytree, copyfile ROOT = '/g/kreshuk/pape/Work/data/mito_em/data' SCRATCH = '/scratch/pape/mito_em/data' def create_file(out_path, ref_path): os.makedirs(out_path, exist_ok=True) copyfile( os.path.join(ref_path, 'attributes.json'), os.path.join(out_pa...
normal
{ "blob_id": "9d3db4ca5bf964c68e9778a3625c842e74bf9dbd", "index": 1228, "step-1": "<mask token>\n\n\ndef create_file(out_path, ref_path):\n os.makedirs(out_path, exist_ok=True)\n copyfile(os.path.join(ref_path, 'attributes.json'), os.path.join(\n out_path, 'attributes.json'))\n\n\ndef copy_to_scratch...
[ 3, 5, 6, 7, 8 ]
# Generated by Django 3.0.5 on 2020-04-25 15:35 from django.db import migrations, models import lots.models class Migration(migrations.Migration): dependencies = [ ('lots', '0012_auto_20200425_1720'), ] operations = [ migrations.AlterField( model_name='lots', nam...
normal
{ "blob_id": "b36f3ffed888edaa7716f712f1549dc205799caf", "index": 6338, "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 = [('lots', '001...
[ 0, 1, 2, 3, 4 ]
from ortools.sat.python import cp_model import os import math import csv import sys def ortoolsSolverReduceVar(num, cap, refill, fun, goal): model = cp_model.CpModel() token = [model.NewIntVar(-2147483648, 2147483647, 't%i' % i) for i in range(1, num + 1)] play = [model.NewIntVar(-2147483648, ...
normal
{ "blob_id": "da98835e48a759cbe7bd29ddba1fac20c006827d", "index": 4996, "step-1": "<mask token>\n\n\ndef ortoolsSolverRange(num, cap, refill, fun, goal):\n model = cp_model.CpModel()\n token = [model.NewIntVar(1, cap, 't%i' % i) for i in range(1, num + 1)]\n play = [model.NewIntVar(1, cap, 'q%i' % i) for...
[ 2, 4, 5, 6, 7 ]
# -*- coding: utf-8 # @paidatocandeira # Acessa arquivo do CADASTRO NACIONAL DE EMPRESAS INIDÔNEAS E SUSPENSAS (CEIS) que está no portal da Transparência # import pandas as pd # Parte 2 - pode rodar no Jupyter para ver resultados # Método lendo direto o arquivo disponível para download (http://www.portaltransparencia...
normal
{ "blob_id": "d2325b07d11e64df0b26d0de9992a6f496e92a30", "index": 2879, "step-1": "<mask token>\n", "step-2": "<mask token>\nceis_arquivo.reset_index()\nceis_arquivo.info()\n<mask token>\nceis_sp.to_csv('ceis_sp.csv')\n", "step-3": "<mask token>\nceis_arquivo = pd.read_csv('20180225_CEIS.csv', sep=';', encodi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Stack(object): def __init__(self): self.arr = [] def push(self, val): self.arr.append(val) def pop(self): if len(self.arr): return self.arr.pop() def inc(self, e, k): count = min(len(self.arr), e) for i in range...
flexible
{ "blob_id": "5ed439a2a7cfb9c941c40ea0c5eba2851a0f2855", "index": 24, "step-1": "<mask token>\n\n\nclass Stack(object):\n\n def __init__(self):\n self.arr = []\n\n def push(self, val):\n self.arr.append(val)\n\n def pop(self):\n if len(self.arr):\n return self.arr.pop()\n\...
[ 5, 6, 7, 8, 10 ]
#!/usr/bin/env python # encoding: utf-8 from tree import * def findKthNode(root, k): if not root: return None if root.number < k or k <= 0: return None if k == 1: return root if root.left and root.left.number >= k-1: return findKthNode(root.left, k - 1) else: ...
normal
{ "blob_id": "b9675bc65e06624c7f039188379b76da8e58fb19", "index": 1623, "step-1": "<mask token>\n\n\ndef findKthNode(root, k):\n if not root:\n return None\n if root.number < k or k <= 0:\n return None\n if k == 1:\n return root\n if root.left and root.left.number >= k - 1:\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class PR: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_...
flexible
{ "blob_id": "606a6e7ecc58ecbb11aa53602599e671514bc537", "index": 3890, "step-1": "<mask token>\n\n\nclass PR:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def init(self, d...
[ 7, 8, 9, 11, 14 ]
<|reserved_special_token_0|> class UserViewSet(viewsets.ModelViewSet): queryset = User.objects.all() model = User serializer_class = UserSerializer def get_permissions(self): return (AllowAny() if self.request.method == 'POST' else permissions.IsStaffOrTargetUser(),) class Group...
flexible
{ "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 ]
from openvino.inference_engine import IENetwork, IECore import numpy as np import time from datetime import datetime import sys import os import cv2 class MotionDetect: # Klasse zur Erkennung von Bewegung def __init__(self): self.static_back = None def detect_motion(self, frame, reset=False): ...
normal
{ "blob_id": "fbd7868a37a2270e5dc86843adff50a94436404d", "index": 5899, "step-1": "<mask token>\n\n\nclass MotionDetect:\n\n def __init__(self):\n self.static_back = None\n <mask token>\n <mask token>\n\n\nclass InferenceModel:\n\n def __init__(self, device='MYRIAD'):\n self.ie = IECore(...
[ 9, 10, 11, 12, 13 ]
import os import flask_sqlalchemy as sqlalchemy from flask import Flask, jsonify, request,render_template,redirect,url_for,json,flash from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class from flask_cors import CORS import datetime from flask_bootstrap import Bootstrap from flask_login i...
normal
{ "blob_id": "5dc17db0aca109720d1ba62d65b86d9b81714063", "index": 6622, "step-1": "<mask token>\n\n\n@login_manager.user_loader\ndef load_user(id):\n user = Student.query.get(int(id))\n if user is not None:\n return user\n else:\n return Instructor.query.get(int(id))\n\n\n<mask token>\n\n\n...
[ 9, 10, 13, 17, 18 ]
<|reserved_special_token_0|> def fileWrite(content): """ write result to result.txt """ file = open('./result.txt', 'w') file.write(content) file.close() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_data(query): """ fetch data from database ...
flexible
{ "blob_id": "612a3d168a09fc26530b95d258cbb4de6728419d", "index": 3721, "step-1": "<mask token>\n\n\ndef fileWrite(content):\n \"\"\" write result to result.txt \"\"\"\n file = open('./result.txt', 'w')\n file.write(content)\n file.close()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_d...
[ 1, 2, 5, 6, 7 ]
# coding: utf-8 from korean.morphophonemics.phonology import Syllable from notes.old_morphology import Noun, Verb class Case (object): pass class Nominative (Case): def apply(self, noun): if noun.has_tail(): noun.syllables.append(Syllable(u'이')) else: noun.syl...
normal
{ "blob_id": "1077efaa4379ff0e114a0b8d4d3b7156758e070f", "index": 9861, "step-1": "# coding: utf-8\n\nfrom korean.morphophonemics.phonology import Syllable\nfrom notes.old_morphology import Noun, Verb\n\n\nclass Case (object):\n pass \n\nclass Nominative (Case):\n def apply(self, noun):\n if n...
[ 0 ]