code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
import typing import torch.nn as nn from .torch_utils import get_activation, BatchNorm1d from dna.models.torch_modules.torch_utils import PyTorchRandomStateContext class Submodule(nn.Module): def __init__(self, layer_sizes: typing.List[int], activation_name: str, use_batch_norm: bool, use_skip: bool=Fals...
normal
{ "blob_id": "950b2906853c37cdeaa8ed1076fff79dbe99b6f8", "index": 8327, "step-1": "<mask token>\n\n\nclass Submodule(nn.Module):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Submodule(nn.Module):\n\n def __init__(self, layer_sizes: typing.List[int], activation_name: str,\n ...
[ 1, 2, 3, 4 ]
import os import sys import pandas as pd import pickle as pkl from src.utils import image as im if __name__ == '__main__': pickled = True create_sets = True normed = False if len(sys.argv) > 2: filename = sys.argv[1] else: filename = os.path.join(os.path.pardir, os.path.pardir, 'data...
normal
{ "blob_id": "18a17c7326a6ae96f74c843d1a902074b377a6d2", "index": 2701, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n pickled = True\n create_sets = True\n normed = False\n if len(sys.argv) > 2:\n filename = sys.argv[1]\n else:\n filename = os.pat...
[ 0, 1, 2 ]
from django.db import connection from .models import Order from .models import Package from .models import DeliveryStatus from .models import CalcParameters class DataService: def __init__(self): pass @staticmethod def get_all_orders(): orders = Order.objects.order_by('-order_date') ...
normal
{ "blob_id": "2e66a31638eb4e619f14a29d5d3847482d207003", "index": 3996, "step-1": "<mask token>\n\n\nclass StaticDataDao(type):\n\n @property\n def delivery_statuses(cls):\n if getattr(cls, '_delivery_statuses', None) is None:\n cls._delivery_statuses = list(DeliveryStatus.objects.all())\n...
[ 5, 6, 7, 8, 12 ]
import webbrowser import time total = 3 count = 0 while count < total: webbrowser.open('https://www.youtube.com/watch?v=GoSBNNgf_Vc') time.sleep(5 * 60 * 60) count += 1
normal
{ "blob_id": "e11a04cad967ae377449aab8b12bfde23e403335", "index": 8391, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile count < total:\n webbrowser.open('https://www.youtube.com/watch?v=GoSBNNgf_Vc')\n time.sleep(5 * 60 * 60)\n count += 1\n", "step-3": "<mask token>\ntotal = 3\ncount = 0\n...
[ 0, 1, 2, 3 ]
import numpy from math import cos, sin, radians, tan class Window: # construtor def __init__(self, world, xyw_min=None, xyw_max=None): self.world = world # caso em q é None if xyw_min is None or xyw_max is None: self.xyw_min = (-100, -100) self.xyw_max = (100, 10...
normal
{ "blob_id": "deb0cd745eae97a6dbabdfab37e1c6d75e5372f0", "index": 8422, "step-1": "<mask token>\n\n\nclass Window:\n\n def __init__(self, world, xyw_min=None, xyw_max=None):\n self.world = world\n if xyw_min is None or xyw_max is None:\n self.xyw_min = -100, -100\n self.xyw_...
[ 15, 16, 18, 20, 22 ]
# coding: utf-8 # In[1]: import numpy as np import pandas as pd from sklearn.svm import SVR # In[2]: from sklearn.preprocessing import StandardScaler # In[3]: #import matplotlib.pyplot as plt # %matplotlib inline # In[90]: aapl = pd.read_csv('return_fcast.csv') # In[79]: y = aapl['return'] # In[80]: ...
normal
{ "blob_id": "4a8d203872a1e86c54142dea6cd04c1cac6bcfb2", "index": 5067, "step-1": "<mask token>\n", "step-2": "<mask token>\nregressor.fit(X, y)\n<mask token>\nX_test.shape\n<mask token>\ny_pred\n<mask token>\ny_pred\nfor i in range(len(y_pred)):\n print(y_pred[i])\n<mask token>\nVIX.iloc[40:2476]\n<mask tok...
[ 0, 1, 2, 3, 4 ]
from __future__ import division from collections import deque import os import warnings import numpy as np import keras.backend as K import keras.layers as layers import keras.optimizers as optimizers from rl.core import Agent from rl.util import * def mean_q(y_true, y_pred): return K.mean(K.max(y_pred, axis=-1...
normal
{ "blob_id": "a2fe62b6bbb6b753ef6aec6f44758b8aceeeafe6", "index": 9691, "step-1": "<mask token>\n\n\nclass UBDDPGAgent(Agent):\n <mask token>\n <mask token>\n <mask token>\n\n def compile(self, optimizer, metrics=[]):\n metrics += [mean_q]\n if type(optimizer) in (list, tuple):\n ...
[ 9, 12, 15, 17, 18 ]
#/usr/bin/env python3 """Demonstrates how to do deterministic task generation using l2l""" import random def fixed_random(func): """Create the data""" def _func(self, i): state = random.getstate() if self.deterministic or self.seed is not None: random.seed(self.seed + i) ...
normal
{ "blob_id": "7ee5779625d53ff1e18f73b20ba5849666f89b55", "index": 2111, "step-1": "<mask token>\n\n\nclass RandomTest:\n\n def __init__(self, seed=42, deterministic=False):\n self.seed = seed\n self.deterministic = deterministic\n\n @fixed_random\n def test_function(self, i):\n retur...
[ 3, 4, 6, 7, 8 ]
import librosa import librosa.display import matplotlib.pyplot as plt import os import numpy as np import time import multiprocessing as mp from tempfile import TemporaryFile class DataSet(): def __init__(self,training_folder): self.training_folder = training_folder print("load Data") def load...
normal
{ "blob_id": "ba09dbe3fbca51ece8a7d482324a2dec32e7dc8a", "index": 5016, "step-1": "<mask token>\n\n\nclass DataSet:\n\n def __init__(self, training_folder):\n self.training_folder = training_folder\n print('load Data')\n <mask token>\n\n def readFiles(self, queue, file_list, start, end):\n ...
[ 3, 4, 5, 6, 7 ]
from django.contrib import admin, messages from django.conf.urls import url from django.shortcuts import render from django.contrib.sites.models import Site from django.http import HttpResponseRedirect, HttpResponse from website_data.models import * from website_data.forms import * import logging # Get an instance of ...
normal
{ "blob_id": "614d6484678890df2ae0f750a3cad51a2b9bd1c6", "index": 2315, "step-1": "<mask token>\n\n\nclass WebsitePreferencesInstanceInline(admin.TabularInline):\n model = WebsitePreferences\n\n\nclass SiteAdmin(admin.ModelAdmin):\n list_filter = 'domain', 'name'\n inlines = [CustomSiteInstanceInline, We...
[ 4, 10, 12, 14, 15 ]
from typing import List import glm import pxng import OpenGL.GL as gl class VertexArrayObject: def __init__(self, primitive): self._primitive = primitive self._buffers: List[pxng.BufferObject] = [] self._indices = pxng.BufferObject(data_type=self.index_data_type, ...
normal
{ "blob_id": "7530c2c85f83d1714840ba97c1ec702f063658c5", "index": 379, "step-1": "<mask token>\n\n\nclass VertexArrayObject:\n\n def __init__(self, primitive):\n self._primitive = primitive\n self._buffers: List[pxng.BufferObject] = []\n self._indices = pxng.BufferObject(data_type=self.ind...
[ 9, 11, 12, 13, 17 ]
#!/usr/bin/env python3 # # Display all tags in the specified file for neoview. # Author: Andrew Pyatkov <mrbiggfoot@gmail.com> # License: MIT # """ Display all tags in the specified file for neoview. Output: {file_name}\t{tag_address}\t{displayable_tag_info} """ import argparse #import os #import re import subprocess ...
normal
{ "blob_id": "b220cacc2530ca62b5599a9c1894e979bcfd5109", "index": 9633, "step-1": "<mask token>\n\n\ndef displayable_info(tagname, comment):\n cs = comment.split('\\t', 1)\n return ('{}{:<' + str(max_tag_len) + '}{} {}|{}{}{}|{} {}{}{}').format(\n COLOR_TAGNAME, tagname, COLOR_RESET, COLOR_BAR, COLOR...
[ 1, 2, 3, 4, 5 ]
from Graph import * from PrioQueue import * from GShortestPath import * from GSpanTree import * from User import * infinity = float("inf") # 这是根据关键字找地点的方法,已经形成了某个依据属性的表后,通过关键词匹配来解决问题 # 最终输出一个yield出的迭代器,将其list化后就可以向末端输出了 def find_by_word(lst, word): # 这个是字符串匹配函数,word是客户输入,lst是循环的东西 # 最好排成优先队列 ...
normal
{ "blob_id": "b5ec6e0fc4239a53a882b455a113eaac4db6cef5", "index": 2331, "step-1": "<mask token>\n\n\nclass web:\n\n def __init__(self, lnum=0, land_list=[], graph_money=GraphAL(),\n graph_time=GraphAL(), graph_line=GraphAL()):\n self.graph_money = graph_money\n self.graph_time = graph_time...
[ 15, 21, 24, 29, 32 ]
# A program to display and find the sum of a list of numbers using for loop list=[10,20,30,40,50] sum=0; for i in list: print(i) sum=sum+i print('sum =',sum)
normal
{ "blob_id": "88e34ee5cd5af7d3b04321c4aa4fc815f926add1", "index": 7110, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =', sum)\n", "step-3": "list = [10, 20, 30, 40, 50]\nsum = 0\nfor i in list:\n print(i)\n sum = sum + i\nprint('sum =',...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- import unittest from selenium import webdriver from appium import webdriver from time import sleep import os from PublicResour import Desired_Capabilities """ 登录状态下检查“我的”界面的所有的功能模块 大部分执行用例时在“我的”界面 """ #Return ads path relative to this file not cwd PATH = lambda p: ...
normal
{ "blob_id": "883a50cf380b08c479c30edad3a2b61a6f3075cc", "index": 4030, "step-1": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\nimport unittest\nfrom selenium import webdriver\nfrom appium import webdriver\nfrom time import sleep\nimport os\nfrom PublicResour import Desired_Capabilities\n\n\"\"\"\n 登录状态下检查“我...
[ 0 ]
from tkinter import * # Everything in tkinter is a widget # We start with the Root Widget root = Tk() # Creating a Label Widget myLabel1 = Label(root, text="Hello User!") myLabel2 = Label(root, text="Welcome to medBOT") # Put labels onto the screen myLabel1.grid(row=0, column=0) myLabel2.grid(row=1, column=0) # Grid...
normal
{ "blob_id": "93fe16e5a97ec2652c4f6b8be844244d9776ea2e", "index": 4921, "step-1": "<mask token>\n", "step-2": "<mask token>\nmyLabel1.grid(row=0, column=0)\nmyLabel2.grid(row=1, column=0)\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nmyLabel1 = Label(root, text='Hello User!')\nmyLabel2 = Label(ro...
[ 0, 1, 2, 3, 4 ]
A = input("입력해주세요.\n") #입력값을 in_AAA로 칭한다 #\n은 문법의 줄바꾸기 print(A.upper()+" World!") #in_AAA를 출력 + "World!") #upper()는 앞의 값을 대문자화+"
normal
{ "blob_id": "8a54a71b08d10c5da9ca440e8e4f61f908e00d54", "index": 9496, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(A.upper() + ' World!')\n", "step-3": "A = input('입력해주세요.\\n')\nprint(A.upper() + ' World!')\n", "step-4": "A = input(\"입력해주세요.\\n\") #입력값을 in_AAA로 칭한다\r\n ...
[ 0, 1, 2, 3 ]
from django.db import models from django.contrib.auth.models import AbstractUser, BaseUserManager class UserManager(BaseUserManager): #Necesar pentru a scoate username de la required def create_user(self, email, password, **kwargs): user = self.model(email=email, **kwargs) user.set_password(...
normal
{ "blob_id": "85b8ffe1bca879acd86251e4662b33648b713588", "index": 7243, "step-1": "<mask token>\n\n\nclass Utilizator(AbstractUser):\n \"\"\" Tabel info utilizator \n nume - extras automat din email ([nume]@gmail.com)\n email - se va loga cu emailul\n parola -...
[ 4, 5, 6, 7, 9 ]
""" ============================== Visualize Cylinder with Wrench ============================== We apply a constant body-fixed wrench to a cylinder and integrate acceleration to twist and exponential coordinates of transformation to finally compute the new pose of the cylinder. """ import numpy as np from pytransform...
normal
{ "blob_id": "2019a2a5588e57164ff4226ef3bcbbc506f2b315", "index": 7432, "step-1": "<mask token>\n\n\ndef animation_callback(step, cylinder, cylinder_frame, prev_cylinder2world,\n Stheta_dot, inertia_inv):\n if step == 0:\n prev_cylinder2world[:, :] = np.eye(4)\n Stheta_dot[:] = 0.0\n wrench...
[ 1, 3, 4, 5, 6 ]
#PortableKanban 4.3.6578.38136 - Encrypted Password Retrieval #Python3 -m pip install des #or #pip install des import json import base64 from des import * #python3 -m pip install des, pip install des import sys def decode(hash): hash = base64.b64decode(hash.encode('utf-8')) key = DesKey(b"7ly6UznJ") r...
normal
{ "blob_id": "136215a3ba99f74160373181c458db9bec4bb6b7", "index": 977, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef decode(hash):\n hash = base64.b64decode(hash.encode('utf-8'))\n key = DesKey(b'7ly6UznJ')\n return key.decrypt(hash, initial=b'XuVUm5fR', padding=True).decode('utf-8')\n\n...
[ 0, 1, 2, 3, 4 ]
# Import packages import pandas import requests import lxml # Get page content url = "https://archive.fantasysports.yahoo.com/nfl/2017/189499?lhst=sched#lhstsched" html = requests.get(url).content df_list = pandas.read_html(html) # Pull relevant URLs
normal
{ "blob_id": "d46035699bee1ad9a75ea251c2c3ab8817d6a740", "index": 4343, "step-1": "<mask token>\n", "step-2": "<mask token>\nurl = (\n 'https://archive.fantasysports.yahoo.com/nfl/2017/189499?lhst=sched#lhstsched'\n )\nhtml = requests.get(url).content\ndf_list = pandas.read_html(html)\n", "step-3": "imp...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- def testeum(): a = 10 print(id(a)) def testedois(): a = 10 print(id(a))
normal
{ "blob_id": "a2e2528f560f6117d4ceeb9cd20d3f6f6b2a30a7", "index": 213, "step-1": "<mask token>\n", "step-2": "def testeum():\n a = 10\n print(id(a))\n\n\n<mask token>\n", "step-3": "def testeum():\n a = 10\n print(id(a))\n\n\ndef testedois():\n a = 10\n print(id(a))\n", "step-4": "# -*- co...
[ 0, 1, 2, 3 ]
from numpy import* a=int(input('numero: ')) b='*' c='o' for i in range(a): d=(b*(a-i))+(c*(a-(a-i)))+(c*(a-(a-i)))+(b*(a-i)) print(d)
normal
{ "blob_id": "155b243ad7d93bcf2b74cd5b2bd3409ab7ec7473", "index": 8488, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(a):\n d = b * (a - i) + c * (a - (a - i)) + c * (a - (a - i)) + b * (a - i)\n print(d)\n", "step-3": "<mask token>\na = int(input('numero: '))\nb = '*'\nc = 'o'\nfo...
[ 0, 1, 2, 3, 4 ]
import pygame import textwrap import client.Button as Btn from client.ClickableImage import ClickableImage as ClickImg from client.CreateDisplay import CreateDisplay import client.LiverpoolButtons as RuleSetsButtons_LP import client.HandAndFootButtons as RuleSetsButtons_HF import client.HandManagement as HandManagement...
normal
{ "blob_id": "1cdd315eec6792a8588dc2e6a221bc024be47078", "index": 7885, "step-1": "<mask token>\n\n\nclass HandView:\n <mask token>\n\n def __init__(self, controller, display, ruleset):\n self.controller = controller\n self.display = display\n self.ruleset = ruleset\n self.Meld_T...
[ 7, 9, 11, 12, 13 ]
print('hello world123')
normal
{ "blob_id": "004a02f7ff49cb1b63ebedfcfcb4937377859099", "index": 1187, "step-1": "<mask token>\n", "step-2": "print('hello world123')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# Generated by Django 3.2.3 on 2021-07-24 12:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('profiles', '0018_userprofile_membership_fee_pending'), ] operations = [ migrations.RenameField( model_name='userprofile', ol...
normal
{ "blob_id": "464980a2f17aeedfa08548d6c4e247f8c047e2cb", "index": 5743, "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 = [('profiles', ...
[ 0, 1, 2, 3, 4 ]
import logging class ConsoleLogger: handlers = [ (logging.StreamHandler, dict(), "[%(name)s]\t %(asctime)s [%(levelname)s] %(message)s ", logging.DEBUG) ] def set_level(self, level): self.logger.setLevel(level) def debug(self, message): self.logger...
normal
{ "blob_id": "5299f2c66fd287be667ecbe11b8470263eafab5c", "index": 702, "step-1": "<mask token>\n\n\nclass ConsoleLogger:\n <mask token>\n\n def set_level(self, level):\n self.logger.setLevel(level)\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __...
[ 3, 6, 7, 8, 11 ]
from os import environ from flask import Flask from flask_restful import Api from flask_migrate import Migrate from applications.db import db from applications.gamma_api import add_module_gamma app = Flask(__name__) app.config["DEBUG"] = True app.config['SQLALCHEMY_DATABASE_URI'] = environ.get('DATABASE') app.config...
normal
{ "blob_id": "fbb081fd52b14336ab4537bb795105bcd6a03070", "index": 3045, "step-1": "<mask token>\n\n\n@app.before_first_request\ndef create_tables():\n pass\n\n\n<mask token>\n", "step-2": "<mask token>\ndb.init_app(app)\n<mask token>\n\n\n@app.before_first_request\ndef create_tables():\n pass\n\n\nadd_mod...
[ 1, 2, 3, 4, 5 ]
''' we have source files with a certain format and each file has 200 columns and there is a process that takes the source files and loads into hbase and moves it into sql data warehouse. We have to create automated test scripts that compares with with is with hbase and sql data warehouse. load into hbase and query the ...
normal
{ "blob_id": "7b38c64174656d1c4ec2b0541e6ed8d6680af7d7", "index": 9565, "step-1": "<mask token>\n", "step-2": "<mask token>\nconnection.open()\nprint('list of hbase tables {}'.format(connection.tables()))\n<mask token>\nfor key, data in customers.scan():\n keys.append(key)\n data_list.append(data)\n<mask ...
[ 0, 1, 2, 3, 4 ]
##Arithmatic Progression a = int(input ('Enter first number: ')) d = int(input('Enter common difference: ')) n = int(input('Number of term: ')) tn = a while tn <= a + (n - 1) * d: print(tn, end=" ") tn += d
normal
{ "blob_id": "e748261d1e5fd7921a022afefe5a5bea1fbfc67c", "index": 9095, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile tn <= a + (n - 1) * d:\n print(tn, end=' ')\n tn += d\n", "step-3": "a = int(input('Enter first number: '))\nd = int(input('Enter common difference: '))\nn = int(input('Numb...
[ 0, 1, 2, 3 ]
from pyspark.sql import SQLContext, Row from pyspark import SparkContext, SparkConf from pyspark.sql.functions import col import collections # Create a Spark Session (the config bit is only for windows) #conf = SparkConf().setAppName("SQL App").setMaster("local") sc = SparkContext() sqlCtx = SQLContext(sc) def mapp...
normal
{ "blob_id": "e4bc2e97b70e2dc91dc86457866ec6b3531ef803", "index": 8772, "step-1": "<mask token>\n\n\ndef mapper(line):\n fields = line.split(',')\n return Row(ID=int(fields[0]), name=fields[1].encode('utf-8'), age=int(\n fields[2]), numFriends=int(fields[3]))\n\n\n<mask token>\n", "step-2": "<mask ...
[ 1, 2, 3, 4, 5 ]
"""CPU functionality.""" import sys HLT = 0b00000001 LDI = 0b10000010 PRN = 0b01000111 MUL = 0b10100010 PUSH = 0b01000101 POP = 0b01000110 CMP = 0b10100111 CALL = 0b01010000 RET = 0b00010001 ADD = 0b10100000 CMP = 0b10100111 JMP = 0b01010100 JEQ = 0b01010101 JNE = 0b01010110 AND = 0b10101000 NOT = 0b01101001 OR = 0b10...
normal
{ "blob_id": "58d144b2c6c307719cef0b5097945c8206135ccf", "index": 6048, "step-1": "<mask token>\n\n\nclass CPU:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def op_ldi(self, operand_a, operand_b):\n self.reg[operand_a] = operand_b\n\n def op_prn(self, ...
[ 13, 22, 23, 27, 32 ]
# -*- coding: utf-8 -*- ''' Задание 12.3 Создать функцию print_ip_table, которая отображает таблицу доступных и недоступных IP-адресов. Функция ожидает как аргументы два списка: * список доступных IP-адресов * список недоступных IP-адресов Результат работы функции - вывод на стандартный поток вывода таблицы вида: ...
normal
{ "blob_id": "dd7e8556405f07172ce2b1e9f486c2cd2f4bad58", "index": 7613, "step-1": "<mask token>\n\n\ndef ping_ip_addresses(ip_addresses):\n result1 = []\n result2 = []\n for ip_address in ip_addresses:\n reply = subprocess.run(['ping', '-c', '3', '-n', ip_address],\n stdout=subprocess.P...
[ 2, 3, 4, 5, 6 ]
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AtmEbrMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AtmEbrMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
normal
{ "blob_id": "202670314ad28685aaa296dce4b5094daab3f47a", "index": 4889, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusTable.setStatus('mandatory')\n<mask token>\nif mibBuilder.loadTexts:\n mscAtmIfVpcSrcEbrOvRowStatusEntry.setStatus('mandatory'...
[ 0, 1, 2, 3 ]
# Formatters example # # Requirements: # Go to the ../hello_world directory and do: python prepare_data.py # # Instructions: # # Just run this file: # # python table.py # Output: # * standard input – text table # * table.html # * cross_table.html # from cubes import Workspace, create_forma...
normal
{ "blob_id": "55e743cb027d27cc6b668424c1584f27a8e8c51a", "index": 5707, "step-1": "# Formatters example\n#\n# Requirements:\n# Go to the ../hello_world directory and do: python prepare_data.py\n#\n# Instructions:\n#\n# Just run this file:\n#\n# python table.py\n# Output:\n# * standard inp...
[ 0 ]
""" Proyecto SA^3 Autor: Mario Lopez Luis Aviles Joaquin V Fecha: Octubre del 2012 versión: 1 """ #Manejo de temlates en el HTML import jinja2 from jinja2 import Environment, PackageLoader import os import cgi import datetime import urllib # for hashing import hashlib...
normal
{ "blob_id": "51cb750082ce93b6d14fe3aa40711836d493129c", "index": 3692, "step-1": "\"\"\"\r\nProyecto SA^3\r\nAutor: \tMario Lopez\r\n Luis Aviles\r\n\t\tJoaquin V\r\nFecha: Octubre del 2012\r\nversión: 1\r\n\"\"\"\r\n\r\n#Manejo de temlates en el HTML\r\nimport jinja2 \r\nfrom jinja2 i...
[ 0 ]
import boto3 from app.models import * from app.config import * from app.lib.log import save_races_to_db, save_laptimes_to_db from app.utils.utils import get_sec import pandas as pd def import_csv_from_aws(): client = boto3.client( 's3', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCE...
normal
{ "blob_id": "b573db8ea0845fb947636b8d82ed462904c6005d", "index": 5519, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef import_csv_from_aws():\n client = boto3.client('s3', aws_access_key_id=AWS_ACCESS_KEY_ID,\n aws_secret_access_key=AWS_SECRET_ACCESS_KEY)\n client.download_file('ergas...
[ 0, 1, 2, 3 ]
""" Tests for parsers.py @author Kevin Wilson <khwilson@gmail.com> """ import crisis.parsers as undertest import datetime import unittest class TestParsers(unittest.TestCase): def test_parse_date(self): date = '8/5/2013 16:14' self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.parse_date(da...
normal
{ "blob_id": "253d37f29e33f61d7e1a5ec2f9a1d6307a2ae108", "index": 6921, "step-1": "<mask token>\n\n\nclass TestParsers(unittest.TestCase):\n <mask token>\n\n def test_part_date_short(self):\n date = '8/5/13 16:14'\n self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14), undertest.\n ...
[ 3, 4, 5, 6, 7 ]
l = input().split("+") l.sort() print('+'.join(l))
normal
{ "blob_id": "30d891c18f3635b7419fa0d0539b2665ad60b22c", "index": 4748, "step-1": "<mask token>\n", "step-2": "<mask token>\nl.sort()\nprint('+'.join(l))\n", "step-3": "l = input().split('+')\nl.sort()\nprint('+'.join(l))\n", "step-4": "l = input().split(\"+\")\r\r\nl.sort()\r\r\nprint('+'.join(l))\r\r\n", ...
[ 0, 1, 2, 3 ]
from django import forms from basic_app_new.models import * class UpdateFood(forms.ModelForm): class Meta: model = Old_Food_Diary fields = ['mfg_code', 'food_name', 'description', 'food_type', 'calories', 'fats', 'protein', 'carbohydrates', 'link_of_image', 'link_of_recip...
normal
{ "blob_id": "3a1b0b9891fec7b3d722f77cd2f3f6efa878a7a0", "index": 4255, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UpdatePurchaseFood(forms.ModelForm):\n\n\n class Meta:\n model = purchase_cards\n fields = ['food_name', 'description', 'ss_code', 'calorie', 'fat',\n ...
[ 0, 1, 2, 3 ]
# Generated by Django 3.2 on 2021-05-03 17:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('orders', '0005_alter_orderitem_price'), ] operations = [ migrations.AddField( model_name='order', name='being_delivere...
normal
{ "blob_id": "f3b466dc5b6149be82b096791ca8445faf169380", "index": 5216, "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 = [('orders', '0...
[ 0, 1, 2, 3, 4 ]
import os import json import pytest from datetime import datetime from collections import OrderedDict import numpy as np import pandas as pd from sqlalchemy.exc import ProgrammingError import pawprint def test_create_table_with_default_options(pawprint_default_tracker_db): """Ensure the table is correctly crea...
normal
{ "blob_id": "89a75ae980b7b48d33d0e8aa53ec92296dbfbc8e", "index": 2843, "step-1": "<mask token>\n\n\ndef test_create_table_with_default_options(pawprint_default_tracker_db):\n \"\"\"Ensure the table is correctly created with the default schema.\"\"\"\n tracker = pawprint_default_tracker_db\n assert track...
[ 8, 15, 18, 20, 21 ]
# Make an array of dictionaries. Each dictionary should have keys: # # lat: the latitude # lon: the longitude # name: the waypoint name # # Make up three entries of various values. waypoints = [ { 'lat': 106.72888 }, { 'lon': 0.69622 }, { 'name': 'Kepulauan Riau' } ] # Write a loop that prints out all the...
normal
{ "blob_id": "5eee3953193e0fc9f44b81059ce66997c22bc8f1", "index": 6960, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor dict in waypoints:\n print(dict)\n", "step-3": "waypoints = [{'lat': 106.72888}, {'lon': 0.69622}, {'name': 'Kepulauan Riau'}]\nfor dict in waypoints:\n print(dict)\n", "ste...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Mon Jan 22 20:21:16 2018 @author: Yijie """ #Q4: #(1) yours = ['Yale','MIT','Berkeley'] mine = ['Harvard','CAU','Stanford'] ours1 = mine + yours ours2=[] ours2.append(mine) ours2.append(yours) print(ours1) print(ours2) # Difference:the print out results indicate that the list 'o...
normal
{ "blob_id": "bf65d4a4e066e3e06b888d4b9ed49e10e66b4e78", "index": 8145, "step-1": "<mask token>\n", "step-2": "<mask token>\nours2.append(mine)\nours2.append(yours)\nprint(ours1)\nprint(ours2)\n<mask token>\nprint(ours1)\nprint(ours2)\n", "step-3": "<mask token>\nyours = ['Yale', 'MIT', 'Berkeley']\nmine = ['...
[ 0, 1, 2, 3 ]
#!/usr/bin/evn python #-*-coding:utf8 -*- import os, sys, json class settings(object): filename = '' config = {} def __init__(self): self.DEBUG = os.environ.get('RdsMonitor_DEBUG', 0) def get_settings(self): """Parses the settings from redis-live.conf. """ # TODO: Consider YAML. Human writable, mac...
normal
{ "blob_id": "2c960685eaa14861c1c5b3ddb38b366a3e0e8e86", "index": 1339, "step-1": "#!/usr/bin/evn python\n#-*-coding:utf8 -*-\n\n\nimport os, sys, json\n\nclass settings(object):\n\tfilename = ''\n\tconfig = {}\n\t\n\tdef __init__(self):\n\t\tself.DEBUG = os.environ.get('RdsMonitor_DEBUG', 0)\n\t\t\n\tdef get_set...
[ 0 ]
import torch from torchelie.data_learning import * def test_pixel_image(): pi = PixelImage((1, 3, 128, 128), 0.01) pi() start = torch.randn(3, 128, 128) pi = PixelImage((1, 3, 128, 128), init_img=start) assert start.allclose(pi() + 0.5, atol=1e-7) def test_spectral_image(): pi = SpectralIm...
normal
{ "blob_id": "73cacc1317c8624b45c017144bc7449bc99bd045", "index": 9542, "step-1": "<mask token>\n\n\ndef test_pixel_image():\n pi = PixelImage((1, 3, 128, 128), 0.01)\n pi()\n start = torch.randn(3, 128, 128)\n pi = PixelImage((1, 3, 128, 128), init_img=start)\n assert start.allclose(pi() + 0.5, at...
[ 2, 3, 4, 5, 6 ]
input = open('in.txt') output = open('out.py', 'w+') def opstr(op): if op == 'RSHIFT': return '>>' if op == 'LSHIFT': return '<<' if op == 'OR': return '|' if op == 'AND': return '&' if op == 'NOT': return '~' raise RuntimeError('Unknown {0}'.format(op)) def funstr(fun): return '{0}_fn'.f...
normal
{ "blob_id": "e68588dff0e54fa03dbb1c629c39d8312a0df26d", "index": 7230, "step-1": "<mask token>\n\n\ndef opstr(op):\n if op == 'RSHIFT':\n return '>>'\n if op == 'LSHIFT':\n return '<<'\n if op == 'OR':\n return '|'\n if op == 'AND':\n return '&'\n if op == 'NOT':\n ...
[ 3, 4, 5, 6, 7 ]
# 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 ]
#/usr/bin/env python #v0.2 import random, time mapHeight = 30 mapWidth = 30 fillPercent = 45 def generateNoise(): #generate a grid of cells with height = mapHeight and width = mapWidth with each cell either "walls" (true) or "floors" (false) #border is guaranteed to be walls and all other spaces have a fi...
normal
{ "blob_id": "7feac838f17ef1e4338190c0e8c284ed99369693", "index": 1628, "step-1": "<mask token>\n\n\ndef generateNoise():\n caveMap = []\n column = 1\n row = 1\n while column <= mapWidth:\n while row <= mapHeight:\n if (column == 1 or column == mapWidth or row == 1 or row ==\n ...
[ 5, 6, 8, 9, 11 ]
class Solution(object): def removeNthFromEnd(self, head, n): dummy = ListNode(-1) dummy.next = head first, second = dummy, dummy for i in range(n): first = first.next while first.next: first = first.next second = second.next second...
normal
{ "blob_id": "7e71c97070285b051b23448c755e3d41b2909dda", "index": 3884, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def removeNthFromEnd(self, head, n):\n dummy = ListNode(-1)\n dummy.next = head\n first, s...
[ 0, 1, 2 ]
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import sys import json import math from klpmln import MVPP dprogram = ''' img(i1). img(i2). addition(A,B,N) :- digit(A,1,N...
normal
{ "blob_id": "70b08b9e8c1510a9be48a4bc1de39c6c85b36eed", "index": 2426, "step-1": "<mask token>\n\n\nclass Net(nn.Module):\n\n def __init__(self):\n super(Net, self).__init__()\n self.encoder = nn.Sequential(nn.Conv2d(1, 6, 5), nn.MaxPool2d(2, 2),\n nn.ReLU(True), nn.Conv2d(6, 16, 5), ...
[ 5, 6, 7, 8, 10 ]
class State: def __init__(self, id): self.id = id def NotinClosed(problem, node): #restituisce 1 se lo stato non è stato già visitato (al netto di controlli sulla depth) è quindi bisogna aggiungerlo NotVisited = 1 for tuple in problem.closed: if node.state.id == tuple[0].id and node.depth...
normal
{ "blob_id": "200deda300e39b07e0e558277a340b7ad01c7dee", "index": 2216, "step-1": "<mask token>\n", "step-2": "class State:\n <mask token>\n\n\n<mask token>\n", "step-3": "class State:\n\n def __init__(self, id):\n self.id = id\n\n\n<mask token>\n", "step-4": "class State:\n\n def __init__(s...
[ 0, 1, 2, 3, 4 ]
import thinkbayes2 as thinkbayes from thinkbayes2 import Pmf import thinkplot class Dice2(Pmf): def __init__(self, sides): Pmf.__init__(self) for x in range(1, sides + 1): self.Set(x, 1) self.Normalize() if __name__ == "__main__": d6 = Dice2(6) dices = [d6] * 6 th...
normal
{ "blob_id": "236dd70dec8d53062d6c38c370cb8f11dc5ef9d0", "index": 556, "step-1": "<mask token>\n\n\nclass Dice2(Pmf):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Dice2(Pmf):\n\n def __init__(self, sides):\n Pmf.__init__(self)\n for x in range(1, sides + 1):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python ############################################################################### # \file # # $Id:$ # # Copyright (C) Brno University of Technology # # This file is part of software developed by Robo@FIT group. # # Author: Tomas Lokaj # Supervised by: Michal Spanel (spanel@fit.vutbr.cz) # Date: 12/...
normal
{ "blob_id": "3bf1b4cfce55820605653d9dc57bab839f2dea55", "index": 5864, "step-1": "#!/usr/bin/env python\n###############################################################################\n# \\file\n#\n# $Id:$\n#\n# Copyright (C) Brno University of Technology\n#\n# This file is part of software developed by Robo@FI...
[ 0 ]
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def swapPairs(self, head: ListNode) -> ListNode: dummy_head=ListNode(0) dummy_head.next=head pre=dummy_head cur=head ...
normal
{ "blob_id": "4afc2ceed860c20af071e1d9ccaca17973cb9a8e", "index": 7553, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def swapPairs(self, head: ListNode) ->ListNode:\n dummy_head = ListNode(0)\n dummy_head.next = head\n pre ...
[ 0, 1, 2, 3 ]
subworkflow data: workdir: "../../data/SlideSeq/Puck_180819_10" include: "../Snakefile"
normal
{ "blob_id": "9847a9cd360649819f51abfe584fb51a81306f68", "index": 4224, "step-1": "subworkflow data:\n workdir:\n \"../../data/SlideSeq/Puck_180819_10\"\n\ninclude: \"../Snakefile\"\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# #----------------------------------------# # 3.4 # # Question: # Write a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10]. #
normal
{ "blob_id": "8c71bc5d53bf5c4cb20784659eddf8a97efb86ef", "index": 8336, "step-1": "#\t#----------------------------------------#\n#\t3.4\n#\t\n#\tQuestion:\n#\tWrite a program which can map() to make a list whose elements are square of elements in [1,2,3,4,5,6,7,8,9,10].\n#\t\n", "step-2": null, "step-3": nul...
[ 1 ]
""" Like Places but possibly script based and temporary. Like a whisper command where is keeps tracks of participants. """
normal
{ "blob_id": "378c07c512425cb6ac6c998eaaa86892b02a37b8", "index": 6905, "step-1": "<mask token>\n", "step-2": "\"\"\"\nLike Places but possibly script based and temporary.\nLike a whisper command where is keeps tracks of participants.\n\"\"\"", "step-3": null, "step-4": null, "step-5": null, "step-ids":...
[ 0, 1 ]
def play(): print("playing tank games...") print("runing tank now!!!")
normal
{ "blob_id": "8c7fe90972feec19e280d3bccd39391af666608a", "index": 9410, "step-1": "<mask token>\n", "step-2": "def play():\n print('playing tank games...')\n\n\n<mask token>\n", "step-3": "def play():\n print('playing tank games...')\n\n\nprint('runing tank now!!!')\n", "step-4": "def play():\n pri...
[ 0, 1, 2, 3 ]
from practice.demo4 import paixu if __name__ == '__main__': n=int(input("请输入最大的数字范围:")) paixu(n)
normal
{ "blob_id": "a777c6d76ef2ae15544a91bcfba0dbeabce0470a", "index": 5377, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:'))\n paixu(n)\n", "step-3": "from practice.demo4 import paixu\nif __name__ == '__main__':\n n = int(input('请输入最大的数字范围:')...
[ 0, 1, 2, 3 ]
#!/usr/local/bin/python3.3 ''' http://projecteuler.net/problem=127() abc-hits Problem 127 The radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42. We shall define the triplet of positive integers (a, b, c) to be an abc-hit if: GCD(a, b) = ...
normal
{ "blob_id": "646f6a0afc3dc129250c26270dda4355b8cea080", "index": 1003, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef problem127():\n GOAL = 120000\n rad = {}\n for primes in genFactors(GOAL):\n rad[product(primes)] = set(primes), product(set(primes))\n\n def relprime(s, t):\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import codecs import time import json import os class OitYitikuscrapyDataPipeline(object): def open_spider(self, spider): ...
normal
{ "blob_id": "315996a783d7b95fd87374a8fe2602a572de071e", "index": 3495, "step-1": "<mask token>\n\n\nclass OitYitikuscrapyDataPipeline(object):\n\n def open_spider(self, spider):\n path = 'D:\\\\xiti10001\\\\data\\\\{}\\\\'.format(time.strftime('%Y%m%d',\n time.localtime()))\n isExists...
[ 2, 3, 4, 5, 6 ]
from __future__ import print_function import math import db from db import writer from enum import Enum from Definitions.Graph import Task class Constraint(Enum): deadline = 1 budget = 2 none = 3 def f_range(x, y, jump): while x < y: yield x x += jump clas...
normal
{ "blob_id": "567076af26b8c93c68647103aeddf43aeb24db13", "index": 2054, "step-1": "<mask token>\n\n\nclass Resources(object):\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 @property\n def ...
[ 22, 28, 32, 36, 40 ]
import numpy as np import matplotlib.pyplot as plt def sample_1(N): numeros=np.array([-10, -5, 3, 9]) return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3])#devuelve distro aleatoria con las probabilidades indicadas def sample_2(N): return np.random.exponential(0.5,N)#devuelve numeros aleatorios con distro ex...
normal
{ "blob_id": "d2d04686b3d7f8d01ca195750ca625baa06ed098", "index": 2835, "step-1": "<mask token>\n\n\ndef sample_1(N):\n numeros = np.array([-10, -5, 3, 9])\n return np.random.choice(numeros, N, p=[0.1, 0.4, 0.2, 0.3])\n\n\ndef sample_2(N):\n return np.random.exponential(0.5, N)\n\n\ndef get_mean(sampling...
[ 3, 4, 5, 6, 7 ]
""" OBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays. The steps are: 1. Pick an element, called a pivot, from the array. 2. Par...
normal
{ "blob_id": "04099c46c029af37a08b3861809da13b3cc3153b", "index": 997, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef quick_sort(array: list) ->list:\n return []\n", "step-3": "\"\"\"\nOBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm\n\nQuicksort first divides ...
[ 0, 1, 2 ]
from django.urls import path from django.views.decorators.csrf import csrf_exempt from .views import TestView, index, setup_fraud_detection, verify_testing_works urlpatterns = [ path('test/<str:name>/', index, name='index'), path('ml/setup/', setup_fraud_detection, name='fraud_detection_setup'), path('ml/...
normal
{ "blob_id": "263347d1d445643f9c84e36a8cbb5304581ebaf6", "index": 3888, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('test/<str:name>/', index, name='index'), path(\n 'ml/setup/', setup_fraud_detection, name='fraud_detection_setup'), path\n ('ml/verify/', verify_testing_works, ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v1/proto/services/user_interest_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobu...
normal
{ "blob_id": "654586443e96f84aae70b3ce3263b0458a27334b", "index": 473, "step-1": "<mask token>\n", "step-2": "<mask token>\n_sym_db.RegisterFileDescriptor(DESCRIPTOR)\n<mask token>\n_sym_db.RegisterMessage(GetUserInterestRequest)\n<mask token>\n_sym_db.RegisterServiceDescriptor(_USERINTERESTSERVICE)\n<mask toke...
[ 0, 1, 2, 3, 4 ]
from modeller import * from modeller.automodel import * # This part was within the script loop_modelling_2 # Here is is in a separate file for loop_modelling_3 so the script can be run in parallel class MyLoop(dopehr_loopmodel): def select_atoms(self): # Here only the second loop atoms are allowed to move s...
normal
{ "blob_id": "d058c3df8513e07e4ff7035aa5c5885819e43687", "index": 7295, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass MyLoop(dopehr_loopmodel):\n <mask token>\n\n def select_loop_atoms(self):\n return selection(self.residue_range('218:', '231:'))\n", "step-3": "<mask token>\n\n\n...
[ 0, 2, 3, 4, 5 ]
import sys class Bus: def __init__(self): self.seats=0 self.dict_seats={} self.num_passenger = 0 def conctructor(self,seats): self.seats=seats for i in range(1,self.seats+1): self.dict_seats.update({i:"Free"}) return self.dict_seats def getOn(sel...
normal
{ "blob_id": "1396509f65d194eeaefa3841e152b7078abf0032", "index": 5549, "step-1": "<mask token>\n\n\nclass Bus:\n <mask token>\n <mask token>\n <mask token>\n\n def getOn_2(self, *names):\n str_names = str(names)\n str_names.strip('')\n list_names = str_names.split(' ')\n f...
[ 3, 6, 7, 8, 9 ]
''' Copyright 2014-2015 Reubenur Rahman All Rights Reserved @author: reuben.13@gmail.com ''' import XenAPI inputs = {'xenserver_master_ip': '15.22.18.17', 'xenserver_password': 'reuben', 'xenserver_user': 'root', 'vm_name': 'SLES11SP2x64', 'target_host': 'xenserver-2' ...
normal
{ "blob_id": "c173c4673fd716a8b88faf751639d52e9ea4ffab", "index": 4482, "step-1": "'''\nCopyright 2014-2015 Reubenur Rahman\nAll Rights Reserved\n@author: reuben.13@gmail.com\n'''\n\nimport XenAPI\n\ninputs = {'xenserver_master_ip': '15.22.18.17',\n 'xenserver_password': 'reuben',\n 'xenserver_u...
[ 0 ]
# -*- coding: utf-8 -*- # @Time : 2019/3/21 20:12 # @Author : for # @File : test01.py # @Software: PyCharm import socket s=socket.socket() host=socket.gethostname() port=3456 s.connect((host,port)) cmd=input(">>>") s.sendall(cmd.encode()) data=s.recv(1024) print(data.decode()) s.close()
normal
{ "blob_id": "596814032218c3db746f67e54e4f1863753aea06", "index": 6299, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.connect((host, port))\n<mask token>\ns.sendall(cmd.encode())\n<mask token>\nprint(data.decode())\ns.close()\n", "step-3": "<mask token>\ns = socket.socket()\nhost = socket.gethostname...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render, redirect from .models import Courses from django.views.generic import CreateView, ListView, UpdateView, DeleteView from .forms import CourceCreateForm from django.urls import reverse_lazy from django.urls import reverse class CourceListView(ListView): model = Courses templ...
normal
{ "blob_id": "3340277df91f1421dab8d204eddce65b4604432b", "index": 369, "step-1": "<mask token>\n\n\nclass CourceCreateView(CreateView):\n template_name = 'cources/create_cource.html'\n form_class = CourceCreateForm\n success_url = reverse_lazy('cources:cource_list')\n\n\nclass CourceUpdateView(UpdateView...
[ 4, 6, 7, 8 ]
import numpy as np import dxchange import ptychotomo if __name__ == "__main__": # read object u = dxchange.read_tiff('data/init_object.tiff') u = u+1j*u/2 nz, n, _ = u.shape # parameters center = n/2 ntheta = 384 ne = 3*n//2 ngpus = 1 pnz = nz//2 theta = np.linspace(0...
normal
{ "blob_id": "4ed6f4db4c9c3319d6289ba402f81bbd8accf915", "index": 9782, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n u = dxchange.read_tiff('data/init_object.tiff')\n u = u + 1.0j * u / 2\n nz, n, _ = u.shape\n center = n / 2\n ntheta = 384\n ne = 3 * n // ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import json import requests BASE_URL = 'http://www.omdbapi.com/' def rating_msg(rating): if rating > 80: return 'You should watch this movie right now!\n' elif rating < 50: return 'Avoid this movie at all cost!\n' else: re...
normal
{ "blob_id": "7f33effa86fc3a80fce0e5e1ecf97ab4ca80402d", "index": 1833, "step-1": "<mask token>\n\n\ndef rating_msg(rating):\n if rating > 80:\n return 'You should watch this movie right now!\\n'\n elif rating < 50:\n return 'Avoid this movie at all cost!\\n'\n else:\n return ''\n\n\...
[ 1, 2, 3, 4, 5 ]
from django.contrib import admin from .models import TutorialsReview, TutorialsReviewComment admin.site.register(TutorialsReview) admin.site.register(TutorialsReviewComment)
normal
{ "blob_id": "fea0619263b081f60ed0a4e178ef777a8d5dc988", "index": 6500, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(TutorialsReview)\nadmin.site.register(TutorialsReviewComment)\n", "step-3": "from django.contrib import admin\nfrom .models import TutorialsReview, TutorialsReviewCo...
[ 0, 1, 2 ]
import onmt import torch.nn as nn import torch.nn.functional as F import torch import torch.cuda from torch.autograd import Variable class CopyGenerator(nn.Module): """ Generator module that additionally considers copying words directly from the source. """ def __init__(self, opt, src_dict, tgt_d...
normal
{ "blob_id": "704b3c57ca080862bed7a4caa65d1c8d5a32fa0b", "index": 168, "step-1": "<mask token>\n\n\nclass CopyGenerator(nn.Module):\n <mask token>\n\n def __init__(self, opt, src_dict, tgt_dict):\n super(CopyGenerator, self).__init__()\n self.linear = nn.Linear(opt.rnn_size, tgt_dict.size())\n...
[ 4, 5, 6, 7, 8 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals import pytest from unittest import TestCase from pydsf.exceptions import DSFServiceError from pydsf.service.response import parse_response from pydsf.service.translations import translate_input_fields, translate_output_fields class MockMessage(object):...
normal
{ "blob_id": "bbff797fab4ac7dc7e6adb81c0eeda561f8ee147", "index": 9603, "step-1": "<mask token>\n\n\nclass MockResponseError(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass MockResponseParsed(object):\n HOV = list()\n\n def __init__(self):\n self.HOV.append(('FODT', '010107'...
[ 17, 24, 26, 29, 30 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 17 17:24:39 2020 @author: code """ import sys import keras import cv2 import numpy import matplotlib import skimage print('Python: {}'.format(sys.version)) print('Numpy: {}'.format(numpy.__version__)) print('Keras: {}'.format(keras.__version__)) p...
normal
{ "blob_id": "e086bebaa166abeea066fe49076f1b007858951f", "index": 7052, "step-1": "<mask token>\n\n\ndef compare_images(target, ref):\n scores = []\n scores.append(psnr(target, ref))\n scores.append(mse(target, ref))\n scores.append(ssim(target, ref, multichannel=True))\n return scores\n\n\ndef pre...
[ 3, 7, 9, 10, 12 ]
""" Day 2 """ with open('input.txt', 'r') as f: lines = f.read() lines = lines.split('\n')[:-1] lines = [l.split(' ') for l in lines] valid = 0 new_valid = 0 for cur_pw in lines: letter = cur_pw[1].strip(':') amount = cur_pw[2].count(letter) rule = cur_pw[0].split('-') rule = [int(r) for r in ru...
normal
{ "blob_id": "46a3c3777d90976c7d39772d2e94430506d3acd7", "index": 8025, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('input.txt', 'r') as f:\n lines = f.read()\n<mask token>\nfor cur_pw in lines:\n letter = cur_pw[1].strip(':')\n amount = cur_pw[2].count(letter)\n rule = cur_pw[0]....
[ 0, 1, 2, 3 ]
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torchvision import datasets, transforms, models from torchvision.utils import make_grid import numpy as np import pandas as pd import matplotlib.pyplot as plt import os from PIL import Image from...
normal
{ "blob_id": "7821b07a49db9f3f46bedc30f2271160e281806f", "index": 4814, "step-1": "<mask token>\n\n\nclass ConvolutionalNetwork(nn.Module):\n\n def __init__(self):\n super().__init__()\n self.conv1 = nn.Conv2d(3, 6, 3, 1)\n self.conv2 = nn.Conv2d(6, 16, 3, 1)\n self.fc1 = nn.Linear(...
[ 3, 4, 5, 6, 7 ]
import os import sys import re import traceback import logging import queue import threading from logging.handlers import TimedRotatingFileHandler from pathlib import Path import click import inotify.adapters from inotify.constants import (IN_ATTRIB, IN_DELETE, IN_MOVED_FROM, IN_MOVED_TO,...
normal
{ "blob_id": "3a96ede91069df0c71905415e598dbbd9d3056fd", "index": 9730, "step-1": "<mask token>\n\n\ndef configure_log(log_file, verbose=False):\n filename = log_file\n if log_file == 'STDOUT':\n handler = logging.StreamHandler(sys.stdout)\n elif log_file == 'STDERR':\n handler = logging.St...
[ 7, 11, 12, 14, 16 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # you can use print for debugging purposes, e.g. # print "this is a debug message" def solution(A): N = len (A) #min_avg = min( (A[0] + A[1]) / 2, (A[0] + A[1] + A[2]) / 3) min_avg = (A[0] + A[1]) / 2.0 min_idx = 0 now_avg = 0.0 for i in xra...
normal
{ "blob_id": "caa92eb5582135f60a6034cb83d364501361d00e", "index": 7726, "step-1": "<mask token>\n", "step-2": "def solution(A):\n N = len(A)\n min_avg = (A[0] + A[1]) / 2.0\n min_idx = 0\n now_avg = 0.0\n for i in xrange(1, N - 1):\n now_avg = (A[i] + A[i + 1]) / 2.0\n if now_avg < ...
[ 0, 1, 2 ]
# Copyright 2018 dhtech # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file import lib import urlparse import yaml MANIFEST_PATH = '/etc/manifest' HTTP_BASIC_AUTH = None def blackbox(name, backend, targets, params, target='target', path='/probe', label...
normal
{ "blob_id": "f489058c922d405754ad32a737f67bc03c08772b", "index": 701, "step-1": "<mask token>\n\n\ndef blackbox(name, backend, targets, params, target='target', path='/probe',\n labels=None):\n labels = {} if labels is None else labels\n banned_oses = ['debian']\n filtered_targets = [x for x in targe...
[ 3, 4, 5, 6, 7 ]
print('test 123123')
normal
{ "blob_id": "c6d8b9faa610e817c449eee94d73c61cb62fa272", "index": 8878, "step-1": "<mask token>\n", "step-2": "print('test 123123')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import os, random, string from django.conf import settings from django.template.loader import render_to_string from django.core.mail import send_mail def generate_temp_password(): length = 7 chars = string.ascii_letters + string.digits rnd = random.SystemRandom() return ''.join(rnd.choice(chars) for...
normal
{ "blob_id": "822fc2941099cb9d7791580678cfb2a89a987175", "index": 4685, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef send_confirmation_email(user):\n try:\n confirmation_key = user.confirmation_key\n except:\n confirmation_key = user.add_unconfirmed_email(user.email)\n msg...
[ 0, 1, 2, 3, 4 ]
ulang = 'y' while True : a = int(input ("masukkan nilai = ")) if a > 60 : status = "LULUS" elif a <= 60 : status = "TIDAK LULUS" print(status) ulang = input("apakah anda ingin mengulang? y/n = ")
normal
{ "blob_id": "759b440bf436afbfb081cf55eeb4a0f075ed3e6d", "index": 9577, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n a = int(input('masukkan nilai = '))\n if a > 60:\n status = 'LULUS'\n elif a <= 60:\n status = 'TIDAK LULUS'\n print(status)\n ulang = input('ap...
[ 0, 1, 2, 3 ]
{'ivy': {'svm': ({'kernel': 'rbf', 'C': 10.0}, 0.034482758620689662, 0.035087719298245612), 'tuned_ensemble': ({'svm__C': 100000.0, 'rf__n_estimators': 101, 'cart__min_samples_leaf': 7, 'knn__n_neighbors': 2, 'rf__random_state': 1542, 'cart__max_depth': 33, 'cart__max_features': 0.35714285714285721, 'svm__kernel': 'sig...
normal
{ "blob_id": "fa02fb701b59728671a7e87147adaeb33422dcdb", "index": 1600, "step-1": "<mask token>\n", "step-2": "{'ivy': {'svm': ({'kernel': 'rbf', 'C': 10.0}, 0.03448275862068966, \n 0.03508771929824561), 'tuned_ensemble': ({'svm__C': 100000.0,\n 'rf__n_estimators': 101, 'cart__min_samples_leaf': 7,\n '...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- import tensorflow as tf from yolov3 import * from predict import predict from load import Weight_loader class Yolo(Yolov3): sess = tf.Session() def __init__(self, input=None, weight_path=None, is_training=False): self.is_training = is_training try: self...
normal
{ "blob_id": "f3d34379cc7fbfe211eeebec424112f3da0ab724", "index": 7999, "step-1": "<mask token>\n\n\nclass Yolo(Yolov3):\n <mask token>\n <mask token>\n <mask token>\n\n def freeze(self):\n graph_def = tf.graph_util.convert_variables_to_constants(sess=self.\n sess, input_graph_def=tf...
[ 3, 4, 6, 7, 8 ]
def merge_the_tools(string, k): if(len(string)%k != 0): exit() else: L = [] for i in range(0, len(string), k): L.append(''.join(list(dict.fromkeys(string[i:i+k])))) print('\n'.join(L)) if __name__ == '__main__': string, k = input(), int(input()) merge_the_to...
normal
{ "blob_id": "0004e90622f8b13ec7ce0c1f49e8c8df7ea07269", "index": 7098, "step-1": "<mask token>\n", "step-2": "def merge_the_tools(string, k):\n if len(string) % k != 0:\n exit()\n else:\n L = []\n for i in range(0, len(string), k):\n L.append(''.join(list(dict.fromkeys(str...
[ 0, 1, 2, 3 ]
# ---------------------MODULE 1 notes-------------------- # . # . # . # . # . # . # . # . # . # . # save as (file).py first if not it will not work print("Hello") # control s to save
normal
{ "blob_id": "bb64da929ff2e1e04267518ec93a28bedb5a4de5", "index": 7306, "step-1": "<mask token>\n", "step-2": "print('Hello')\n", "step-3": "# ---------------------MODULE 1 notes--------------------\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n# .\r\n\r\n# save as (file).py first if not i...
[ 0, 1, 2 ]
import pandas as pd file = pd.read_csv("KDDTest+.csv") with open("test_9feats.csv", "w") as f: df = pd.DataFrame(file, columns=[ "dst_host_srv_serror_rate", "dst_host_serror_rate", "serror_rate", "srv_serror_rate", "count", "flag", ...
normal
{ "blob_id": "ce28330db66dcdfad63bdac698ce9d285964d288", "index": 5124, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('test_9feats.csv', 'w') as f:\n df = pd.DataFrame(file, columns=['dst_host_srv_serror_rate',\n 'dst_host_serror_rate', 'serror_rate', 'srv_serror_rate', 'count',\n ...
[ 0, 1, 2, 3, 4 ]
from django.db.models import Sum, Count from django.db.models.functions import Coalesce from django.utils.timezone import localtime from .models import Quote, Vote import pygal from pygal.style import Style style = Style( background='transparent', plot_background='transparent', foreground='#3d3d3d', foreground_s...
normal
{ "blob_id": "6f6f57ff317d7e3c6e6ae4d450c6fdf0e22eb4eb", "index": 7256, "step-1": "<mask token>\n\n\nclass QuotesByMonth:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass QuotesByRating:\n\n def __init__(self):\n self.chart = pygal.Histogram(title='Quotes by Rating', margin=20,\n ...
[ 9, 16, 20, 21, 23 ]
import collections import re from collections import Counter import operator import pickle import math import json path='C:/Users/rahul/Desktop/CSCI 544/HW 2/op_spam_train/' #path=sys.argv[1] badWordList = ['and','the','was','for'] RE=r'\b[^\W\d_]+\b' # NEGATIVE TWEETS c=collections.Counter() NT="negativeTweets.txt/...
normal
{ "blob_id": "42e16def0fcf234f3d7c2709de36a321d8ddf29e", "index": 7598, "step-1": "import collections\nimport re\nfrom collections import Counter\nimport operator\nimport pickle\nimport math\nimport json\n\npath='C:/Users/rahul/Desktop/CSCI 544/HW 2/op_spam_train/'\n#path=sys.argv[1]\n\nbadWordList = ['and','the'...
[ 0 ]
""" Users model """ # Django from django.conf import settings from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import RegexValidator class User(AbstractUser): """User model""" email = models.EmailField( 'email address', ...
normal
{ "blob_id": "360813a573f672e3ec380da4237a6e131dbcb7e6", "index": 2345, "step-1": "<mask token>\n\n\nclass User(AbstractUser):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Profile(models.Model):\n \"\"\"Profile model\"\...
[ 5, 6, 8, 9, 10 ]
import pickle import torch data = pickle.load(open('dd0eb7901523d494d4aa324f474c782063e9e231.p', 'rb')) torch.nn.functional.adaptive_avg_pool3d(**data)
normal
{ "blob_id": "20d09a616133295a6162a7ab1d7970ccbaf6de95", "index": 1331, "step-1": "<mask token>\n", "step-2": "<mask token>\ntorch.nn.functional.adaptive_avg_pool3d(**data)\n", "step-3": "<mask token>\ndata = pickle.load(open('dd0eb7901523d494d4aa324f474c782063e9e231.p', 'rb'))\ntorch.nn.functional.adaptive_a...
[ 0, 1, 2, 3 ]
""" OCR that converts images to text """ from pytesseract import image_to_string from PIL import Image print image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png')) #print image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png')) #pr...
normal
{ "blob_id": "91ac4a23573abcb0ab024830dbc1daebd91bd40d", "index": 2355, "step-1": "\"\"\" OCR that converts images to text \"\"\"\n\nfrom pytesseract import image_to_string\nfrom PIL import Image\n\nprint image_to_string(Image.open('/Users/williamliu/Desktop/Screen Shot 2014-09-27 at 11.45.34 PM.png'))\n\n#print ...
[ 0 ]
# -*- coding: utf-8 -*- class Config(object): def __init__(self): self.config_dict = { "data_path": { # "vocab_path": "../data/cnews/cnews.vocab.txt", "vocab_path": "../data/rumor/cnews.vocab.txt", # "trainingSet_path": "../data/cnews/cnews.trai...
normal
{ "blob_id": "9cb4e550a0d19b44ec8357882f353b04748b213b", "index": 2589, "step-1": "<mask token>\n", "step-2": "class Config(object):\n <mask token>\n <mask token>\n", "step-3": "class Config(object):\n <mask token>\n\n def get(self, section, name):\n return self.config_dict[section][name]\n...
[ 0, 1, 2, 3, 4 ]
from tkinter import ttk from chapter04a.validated_mixin import ValidatedMixin class RequiredEntry(ValidatedMixin, ttk.Entry): def _focusout_validate(self, event): valid = True if not self.get(): valid = False self.error.set('A value is required') return valid
normal
{ "blob_id": "59047a113d76c64be48858258441fae5da505790", "index": 5792, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass RequiredEntry(ValidatedMixin, ttk.Entry):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass RequiredEntry(ValidatedMixin, ttk.Entry):\n\n def _focusout_validate(self...
[ 0, 1, 2, 3 ]
class RetModel(object): def __init__(self, code = 0, message = "success", data = None): self.code = code self.msg = message self.data = data
normal
{ "blob_id": "ec395b93cecf8431fd0df1aa0151ebd32244c367", "index": 4941, "step-1": "<mask token>\n", "step-2": "class RetModel(object):\n <mask token>\n", "step-3": "class RetModel(object):\n\n def __init__(self, code=0, message='success', data=None):\n self.code = code\n self.msg = message...
[ 0, 1, 2, 3 ]
""" stanCode Breakout Project Adapted from Eric Roberts's Breakout by Sonja Johnson-Yu, Kylie Jue, Nick Bowman, and Jerry Liao YOUR DESCRIPTION HERE """ from campy.gui.events.timer import pause from breakoutgraphics import BreakoutGraphics FRAME_RATE = 1000 / 120 # 120 frames per second. NUM_LIVES = 3 def main(): ...
normal
{ "blob_id": "b218f5e401510f844006cb6079737b54aa86827b", "index": 2194, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n graphics = BreakoutGraphics()\n lives = NUM_LIVES\n graphics.window.add(graphics.scoreboard, 0, graphics.window_height)\n while True:\n pause(FRAME_RA...
[ 0, 2, 3, 4, 5 ]