code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
from datetime import datetime import httplib2 from apiclient.discovery import build from flask_login import UserMixin from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from oauth2client.client import OAuth2Credentials from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.types import...
normal
{ "blob_id": "866ec11f6fe13fb2283709128376080afc7493bf", "index": 5040, "step-1": "<mask token>\n\n\nclass User(db.Model, UserMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '<User {}>'.format(self.email...
[ 8, 10, 11, 13, 14 ]
import requests def login(username, password): data = {'login':username,'pwd':password,'lang':''} r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php', data=data, allow_redirects=False) if r.headers['Location'] == '../out/out.Login.php?msg=Error+signing+in.+User+ID+or+password+incorrec...
normal
{ "blob_id": "ae84b449c8919f14954633b14993e6291501bc24", "index": 1019, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef login(username, password):\n data = {'login': username, 'pwd': password, 'lang': ''}\n r = requests.post('http://dms-pit.htb/seeddms51x/seeddms/op/op.Login.php',\n da...
[ 0, 1, 2, 3, 4 ]
"""Encoder module of Monodepth2 Code partially borrowed from https://github.com/nianticlabs/monodepth2/blob/master/networks/resnet_encoder.py """ from __future__ import absolute_import, division, print_function import os import numpy as np import mxnet as mx from mxnet.gluon import nn from mxnet.context import cpu fr...
normal
{ "blob_id": "62601eca767800f00b461ef46d72bddc5cf75de0", "index": 1400, "step-1": "<mask token>\n\n\nclass ResnetEncoder(nn.HybridBlock):\n <mask token>\n\n def __init__(self, backbone, pretrained, num_input_images=1, root=os.\n path.join(os.path.expanduser('~'), '.mxnet/models'), ctx=cpu(), **\n ...
[ 3, 4, 5, 6, 7 ]
import re ​ print("Кулик Валерія Максимівна\n " "Лабораторна робота №2 \n " "Варіант 10 \n " "Завдання №1. Обчислити формулу") ​ ​ def int_input(text): while True: user_input = input(text) if re.match('^[0-9]{1,}$', user_input): break else: print("По...
normal
{ "blob_id": "e8e52cd0a0685e827ecbc6272657de5158fa0d94", "index": 7037, "step-1": "import re\n​\nprint(\"Кулик Валерія Максимівна\\n \"\n \"Лабораторна робота №2 \\n \"\n \"Варіант 10 \\n \"\n \"Завдання №1. Обчислити формулу\")\n​\n​\ndef int_input(text):\n while True:\n user_input = inp...
[ 0 ]
# 데이터베이스 연동(SQLite) # 테이블 생성 및 삽입 # pkg 폴더안에 db 파일이 있어서 해당 파일 import 하기 위해 ... 다른 방법 없을까 ... import os, sys sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) # db 정보 import 후 DbConn 메소드를 dbConn으로 사용명 변경 from pkg._DB_INFO import DbConn as dbConn from pkg._DB_INFO import sysDate as nowDate #...
normal
{ "blob_id": "b066ab81eccee538eb3f85b49a3e46c00a947428", "index": 6154, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))\n<mask token>\nprint('Cursor Type : ', type(c))\nc.execute(\n 'CREATE TABLE IF NOT EXISTS users(id INTEGER ...
[ 0, 1, 2, 3, 4 ]
# 导包 from time import sleep from selenium import webdriver # 实例化浏览器 driver = webdriver.Firefox() # 打开页面 driver.get(r"F:\BaiduYunDownload\webdriverspace\sources\注册实例.html") driver.maximize_window() sleep(2) # 定位注册A按钮并点击 driver.find_element_by_link_text("注册A网页").click() # 获取当前敞口句柄 current_handle = driver.current_windo...
normal
{ "blob_id": "f73a316b6020908472e35a7b78959a9bda6e8e56", "index": 7810, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('F:\\\\BaiduYunDownload\\\\webdriverspace\\\\sources\\\\注册实例.html')\ndriver.maximize_window()\nsleep(2)\ndriver.find_element_by_link_text('注册A网页').click()\n<mask token>\nprint(...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # coding=utf-8 # date 2020-10-22 10:54:38 # author calllivecn <c-all@qq.com> import sys import random import asyncio import argparse def httpResponse(msg): response = [ "HTTP/1.1 200 ok", "Server: py", "Content-Type: text/plain", "Content-Le...
normal
{ "blob_id": "9320926c9eb8a03d36446f3692f11b242c4fc745", "index": 8364, "step-1": "<mask token>\n\n\ndef httpResponse(msg):\n response = ['HTTP/1.1 200 ok', 'Server: py', 'Content-Type: text/plain',\n 'Content-Length: ' + str(len(msg)), '\\r\\n']\n return '\\r\\n'.join(response).encode('utf8') + msg\...
[ 2, 3, 4, 5, 6 ]
import datetime from datetime import datetime, timedelta import time import json import base64 import requests from bson.objectid import ObjectId import urllib isinpackage = not __name__ in ['google_api', '__main__'] if isinpackage: from .settings import settings from . import util from .util import Just ...
normal
{ "blob_id": "c75c69b006734e476352de1913fd4a58021bffd6", "index": 2704, "step-1": "<mask token>\n\n\ndef get_certs_keys(kid):\n url = 'https://www.googleapis.com/oauth2/v3/certs'\n data = requests.get(url).json()['keys']\n return next(filter(lambda e: kid == e['kid']), None)\n\n\ndef get_redirect_link(re...
[ 11, 12, 14, 15, 16 ]
#!/usr/bin/env python import speech_recognition as sr from termcolor import colored as color import apiai import json from os import system import wikipedia as wiki from time import sleep import webbrowser as wb BOLD = "\033[1m" #use to bold the text END = "\033[0m" #use to close the bold text CLIENT_ACCESS_TOK...
normal
{ "blob_id": "d3e728bda85d2e72b8e477ab439d4dcffa23d63a", "index": 5448, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n r = sr.Recognizer()\n with sr.Microphone() as source:\n system('clear')\n print(color(BOLD + 'Hola!\\nAsk me anything.' + END, 'green'))\n while True:\n ...
[ 0, 1, 2, 3, 4 ]
from app import app from flask import render_template, request from app.models import model, formopener @app.route('/', methods=['GET', 'POST']) @app.route('/index') def index(): return render_template("index.html") @app.route('/personality', methods=['GET', 'POST']) def personfont(): user_input=dict(request....
normal
{ "blob_id": "bb3c4039ff224c0ca0305778b938ef969c196033", "index": 8759, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/', methods=['GET', 'POST'])\n@app.route('/index')\ndef index():\n return render_template('index.html')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@app.route(...
[ 0, 1, 2, 3, 4 ]
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' #app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True; #db = SQLAlchemy(app) # MONGODB CREATION #Creating a pymongo client client = MongoClient('localhost', 27017) #Getting the database instance db = client['mydb'] print("Database created........") #Verif...
normal
{ "blob_id": "5b7567129d447ae2b75f4a8f9c26127f8b7553ec", "index": 7818, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Database created........')\nprint('List of databases after creating new one')\nprint(client.list_database_names())\n<mask token>\nmeta.create_all(engine)\n", "step-3": "client = ...
[ 0, 1, 2, 3 ]
from django.conf.urls import url from cart import views urlpatterns=[ url(r'^add/$',views.cart_add,name='add'),#t添加购物车数据 url(r'^count/$',views.cart_count,name='count'),#huo获取购物车商品数量 url(r'^del/$',views.cart_del,name='delete'),#删除购物车商品记录 url(r'update/$',views.cart_update,name='update'),#更新购物车商品数目 u...
normal
{ "blob_id": "5b3a6b44bd9ea80da1983d8254c73bba3e2338e1", "index": 5166, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^add/$', views.cart_add, name='add'), url('^count/$',\n views.cart_count, name='count'), url('^del/$', views.cart_del, name=\n 'delete'), url('update/$', views.c...
[ 0, 1, 2, 3 ]
# Standard Library Imports # Third Party Imports from kivy.clock import Clock from kivy.properties import StringProperty from kivy.uix.screenmanager import Screen, ScreenManager from kivy.uix.widget import Widget # Local Imports from client.source.ui.kv_widgets import ModalPopupButton, SubmissionPopup, FailedSubmissi...
normal
{ "blob_id": "327e9dcba49419b8a8c320940e333765c1d9b980", "index": 5997, "step-1": "<mask token>\n\n\nclass ChatRoomScreen(Screen):\n <mask token>\n <mask token>\n <mask token>\n\n def schedule_update_display_info(self, *args):\n Clock.schedule_interval(self.update_display_info, 1)\n <mask to...
[ 7, 12, 17, 20, 22 ]
#coding=utf-8 import shutil import zipfile # shutil.copyfile("file03.txt","file05.txt") #拷贝 # shutil.copytree("movie/大陆","电影") #拷贝文件夹 #忽略不需要拷贝的文件 # shutil.copytree("movie/大陆","电影",ignore=shutil.ignore_patterns("*.txt","*.html")) #压缩和解压缩 # shutil.make_archive("电影/压缩","zip","movie/大陆") z1 = zipfile.ZipFile("a.z...
normal
{ "blob_id": "81f5753e8d0004244b4ee8e26895cb2b38fbb8b6", "index": 751, "step-1": "<mask token>\n", "step-2": "<mask token>\nz1.write('file05.txt')\nz1.write('file03.txt')\nz1.close()\n<mask token>\nz2.extractall('电影')\nz2.close()\n", "step-3": "<mask token>\nz1 = zipfile.ZipFile('a.zip', 'w')\nz1.write('file0...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 """ program of the command interpreter """ import cmd import models import re from models.base_model import BaseModel from models import storage from models.user import User from models.state import State from models.city import City from models.amenity import Amenity from models.place import Place ...
normal
{ "blob_id": "7cbf2082d530c315fdcfdb94f5c6ac4755ea2081", "index": 1267, "step-1": "<mask token>\n\n\nclass HBNBCommand(cmd.Cmd):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def emptyline(self):\n \"\"\"Do nothing\"\"\"\n pass\n\n def do_create(...
[ 9, 11, 12, 16, 17 ]
"""Tests for our `neo login` subcommand.""" import pytest import os from neo.libs import login from neo.libs import utils class TestAuth: @pytest.mark.run(order=0) def test_do_login(self, monkeypatch): login.load_env_file() username = os.environ.get('OS_USERNAME') passwd = os.environ.g...
normal
{ "blob_id": "dfe7f0e25f340601886334c61a50806491a4ae2b", "index": 8621, "step-1": "<mask token>\n\n\nclass TestAuth:\n <mask token>\n <mask token>\n\n def test_env_file(self):\n assert login.check_env() == True\n\n def test_create_env_file(self):\n home = os.path.expanduser('~')\n ...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python import os, glob, sys, math, time, argparse import ROOT from ROOT import TFile, TTree, TH2D def main(): parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern of LEAF rootfiles (* wildcards work) enclosed by quotation marks ("<pattern>") and creates a root...
normal
{ "blob_id": "44c04cf79d02823318b06f02af13973960413bea", "index": 6915, "step-1": "#!/usr/bin/env python\n\nimport os, glob, sys, math, time, argparse\nimport ROOT\nfrom ROOT import TFile, TTree, TH2D\n\n\n\ndef main():\n parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern...
[ 0 ]
import BST tree = BST.BST(10) tree.insert(5, tree.root) tree.insert(15, tree.root) tree.insert(25, tree.root) tree.insert(12, tree.root) tree.insert(35, tree.root) print(tree.height(tree.root))
normal
{ "blob_id": "59ddb85d55c342342be4edc1fc3b92af701fa6cc", "index": 4342, "step-1": "<mask token>\n", "step-2": "<mask token>\ntree.insert(5, tree.root)\ntree.insert(15, tree.root)\ntree.insert(25, tree.root)\ntree.insert(12, tree.root)\ntree.insert(35, tree.root)\nprint(tree.height(tree.root))\n", "step-3": "<...
[ 0, 1, 2, 3 ]
import sys import numpy as np sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, input().split()) def cumprod(arr, MOD): L = len(arr) Lsq = int(L ** 0.5 + 1) arr = np.resize(arr, Lsq ** 2).reshape(Lsq, ...
normal
{ "blob_id": "43d5bf79f16e8530797cdd13cdfcc91f0d3aef5e", "index": 8208, "step-1": "<mask token>\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L ** 0.5 + 1)\n arr = np.resize(arr, Lsq ** 2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MO...
[ 3, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- import abc import datetime import importlib import inspect import os import re import six from .library import HalLibrary @six.add_metaclass(abc.ABCMeta) class Hal(): def __init__(self, configpath): self.configpath = configpath # Find libraries inside the lib directory ...
normal
{ "blob_id": "81dec10686b521dc9400a209caabc1601efd2a88", "index": 540, "step-1": "<mask token>\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass Hal:\n\n def __init__(self, configpath):\n self.configpath = configpath\n dir_path = os.path.join(os.path.dirname(__file__), 'libraries')\n lib_files =...
[ 3, 5, 6, 8, 9 ]
def a = 10 b = 2 c = 3 cal(a,b,c)
normal
{ "blob_id": "1be5de71615eae6c9074e67b0dcaabbac4d82e2b", "index": 9909, "step-1": "def\n\na = 10\nb = 2\nc = 3\n\ncal(a,b,c)", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
from itertools import groupby def solve(tribes): attacks = [] for t in tribes: D, N, W, E, S, DD, DP, DS = t for i in range(N): d = D + DD * i w = W + DP * i e = E + DP * i s = S + DS * i attacks.append((d, w, e, s)) attacks = sort...
normal
{ "blob_id": "362bfc5a35b09817ce071e71a72e574a28ea287d", "index": 3365, "step-1": "<mask token>\n\n\ndef line(f):\n return map(int, f.readline().split())\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef solve(tribes):\n attacks = []\n for t in tribes:\n D, N, W, E, S, DD, DP, DS = t\n ...
[ 1, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- # Copyright (c) 2018-2020 Christiaan Frans Rademan <chris@fwiw.co.za>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the ...
normal
{ "blob_id": "13e27c29839286988b37d2d3685f54d42fd57973", "index": 9773, "step-1": "<mask token>\n\n\n@register.resources()\nclass Roles(object):\n <mask token>\n\n def role(self, req, resp, id):\n return obj(req, infinitystone_role, sql_id=id)\n\n def roles(self, req, resp):\n return sql_li...
[ 3, 5, 6, 8, 9 ]
# Copyright (c) 2019 NVIDIA Corporation from nemo.backends.pytorch.nm import DataLayerNM from nemo.core.neural_types import * from nemo.core import DeviceType import torch from .datasets import BertPretrainingDataset class BertPretrainingDataLayer(DataLayerNM): @staticmethod def create_ports(): input...
normal
{ "blob_id": "a47ffd5df49ec627442a491f81a117b3e68ff50b", "index": 2326, "step-1": "<mask token>\n\n\nclass BertPretrainingDataLayer(DataLayerNM):\n <mask token>\n\n def __init__(self, *, tokenizer, dataset, name, max_seq_length,\n sentence_indices_filename=None, mask_probability=0.15, **kwargs):\n ...
[ 4, 5, 6, 7, 8 ]
#the initial DNA sequence dnaSequence = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' #seperating the DNA sequence at the specified location firstFragment = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' [0:22] secondFragment = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' [23:100] ...
normal
{ "blob_id": "7dc99d33023dbb13938ac413af7d3e9471fdbc3d", "index": 126, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('the original DNA sequence is', dnaSequence)\nprint('the first fragment is', firstFragment, 'and is', firstFragmentLen,\n 'letters long')\nprint('the second fragment is', secondFr...
[ 0, 1, 2, 3 ]
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' sess = tf.Session() # 1.one-shot iterator dataset = tf.data.Dataset.range(100) iterator = dataset.make_one_shot_iterator() next_element = iterator.get_next() for i in range(100): value = sess.run(next_element) # print(value) assert i == v...
normal
{ "blob_id": "4d4dd451d83d8d602c6264e77f52e5e143aef307", "index": 6239, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(100):\n value = sess.run(next_element)\n assert i == value\n<mask token>\nsess.run(iterator.initializer, feed_dict={max_value: 10})\nfor i in range(10):\n value = ...
[ 0, 1, 2, 3, 4 ]
from flask import Flask import rq from redis import Redis from app.lib.job import Job from app.config import Config app = Flask(__name__) app.config.from_object(Config) app.redis = Redis.from_url('redis://') app.task_queue = rq.Queue('ocr-tasks', connection=app.redis, default_timeout=43200) app.task_queue.empty() a...
normal
{ "blob_id": "14e336005da1f1f3f54ea5f2892c27b58f2babf0", "index": 4794, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_object(Config)\n<mask token>\napp.task_queue.empty()\n<mask token>\napp.eval_queue.empty()\n<mask token>\napp.register_blueprint(api_bp, url_prefix='/api')\n", "step-3":...
[ 0, 1, 2, 3 ]
# Generated by Django 2.2.7 on 2019-11-22 21:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('Product', '0003_productimage'), ] operations = [ migrations.RemoveField( model_name='productimage', name='comm...
normal
{ "blob_id": "a3382c3e6e04ccb87b1d55f072ce959b137f9fdd", "index": 5722, "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 = [('Product', '...
[ 0, 1, 2, 3, 4 ]
#program_skeleton.py #import load_json_files as bm import write import merge as m import load_df as ldf import load_vars as lv import log as log import clean_df as clean import download as dl import gc import confirm_drcts as cfs import fix_files as ff import readwrite as rw import df_filter as df_f import realtor_scr...
normal
{ "blob_id": "6a8007e44d2c4b56426cd49772cbc23df2eca49c", "index": 6917, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef program_skeleton(dictionary: dict):\n if dictionary['tasks']['environmental_vars']['run'] == True:\n dictionary['tasks']['environmental_vars']['log'][\n 'envi...
[ 0, 1, 2, 3 ]
ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), ( 'CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1) ]
normal
{ "blob_id": "379c666f19537b513169c6b30e0c669dda6e372c", "index": 9165, "step-1": "<mask token>\n", "step-2": "ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), (\n 'CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)\n ]\n", "step-3": null, "step-4": null, "st...
[ 0, 1 ]
import pytest from apistar import App, Route, TestClient, exceptions from apistar_request_id import RequestId, RequestIdHooks def index() -> dict: return {} def fail() -> dict: raise exceptions.BadRequest("fail") def fail_2() -> dict: raise RuntimeError("fail") routes = [ Route("/", method="GET...
normal
{ "blob_id": "f41ab6813fb7067089abe223b9006adde40630cd", "index": 1941, "step-1": "<mask token>\n\n\ndef index() ->dict:\n return {}\n\n\n<mask token>\n\n\n@pytest.fixture\ndef client(app):\n return TestClient(app)\n\n\ndef test_request_id_can_be_autogenerated(client):\n response = client.get('/')\n a...
[ 6, 9, 10, 11, 12 ]
""" Rectangles: Compute overlapping region of two rectangles. Point(x: number, y: number): Cartesian coordinate pair Rect(ll: Point, ur: Point): A rectangle defined by lower left and upper right coordinates Rect.overlaps(other: Rect) -> boolean: True if non-empty overlap Rect.intersect(other: Rect...
normal
{ "blob_id": "7b9660bba6fcb8c725251971f3733a1cc915c0e7", "index": 760, "step-1": "<mask token>\n\n\nclass Point(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Rect(object):\n \"\"\"A rectangle identified by its lower left\n and upper right corne...
[ 9, 12, 16, 17, 18 ]
import subprocess from dissamblerAbstract import disassemblerAbstract #lib/ZydisDisasm -64 /home/nislab2/Desktop/DissamblerEffect/metamorphic/00fe0c08024f7db771d6711787d890a3.exe class ZydisDisassembler(disassemblerAbstract): def diassemble(self,filename, bits='32bit'): """ Disassembly executa...
normal
{ "blob_id": "fedec397ac0346bad1790315b4f85fbb1a662a4e", "index": 9466, "step-1": "<mask token>\n\n\nclass ZydisDisassembler(disassemblerAbstract):\n\n def diassemble(self, filename, bits='32bit'):\n \"\"\"\n Disassembly executable file return iterable instruction set.\n\n :param f...
[ 3, 4, 5, 6, 7 ]
import collections def solution(genres, plays): answer = [] cache = collections.defaultdict(list) # 장르 : [고유번호, 재생횟수] genre_order = collections.defaultdict(int) # 장르 : 전체재생횟수 order = collections.defaultdict() # 전체재생횟수 : 장르 # 첫번째 딕셔너리와 두번째 딕셔너리 생성 for i in range(len(genres)): cache[ge...
normal
{ "blob_id": "d56c80b4822b1bd0f2d4d816ed29a4da9d19a625", "index": 3040, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(genres, plays):\n answer = []\n cache = collections.defaultdict(list)\n genre_order = collections.defaultdict(int)\n order = collections.defaultdict()\n fo...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import paramiko import commands def ip_check(): """ Parses attributes for given hosts, then checks if hosts are up and then calls path_check function with working hosts. """ hosts = [] valid_hosts = [] for item in sys.argv...
normal
{ "blob_id": "6e3aa677985d7bd91bfbbd2078665206839bac63", "index": 3578, "step-1": "<mask token>\n\n\ndef path_check(hosts):\n \"\"\"\n Parses username, port, host and local and remote path,\n finds all local and remote files, using find_local_files and find_remote_files functions,\n and then opens ssh...
[ 4, 6, 7, 8, 9 ]
""" binary_adder.py: Takes two arrays representing binary numbers, adds them together. """ __author__ = "David Vaillant" __credits__ = "CLRS, Chapter 2.1" def binary_add(x, y): """ Adds two binary arrays together. """ # Makes sure that the arrays have the same length. # Could be chang...
normal
{ "blob_id": "40aa9e7cf0aaca24054297ca80aaf468ba485966", "index": 5621, "step-1": "<mask token>\n\n\ndef binary_add(x, y):\n \"\"\" Adds two binary arrays together. \"\"\"\n assert len(x) == len(y)\n z = [0] * (len(x) + 1)\n for a, (i, j) in enumerate(zip(x[::-1], y[::-1])):\n if i not in [0, 1...
[ 1, 2, 3, 4, 5 ]
from django.shortcuts import render import requests from bs4 import BeautifulSoup import json from rest_framework.response import Response from rest_framework.decorators import api_view,authentication_classes,permission_classes from rest_framework import status from django.contrib.staticfiles.storage import staticfiles...
normal
{ "blob_id": "ed80f5f898548ca012779543051ccff5b34e4fcc", "index": 730, "step-1": "<mask token>\n\n\ndef getdata(url):\n data = requests.get(url)\n return data.text\n\n\ndef get_json():\n file_path = staticfiles_storage.path('coordinates.json')\n with open(file_path, 'r') as f:\n data = json.loa...
[ 2, 3, 4, 5, 6 ]
import copy import time import random from twisted.python import log, failure from twisted.internet import defer, error, protocol, reactor from twisted.protocols import basic, policies from pn.util import url from pn.core import stream as stream_mod try: from collections import deque except ImportError: class dequ...
normal
{ "blob_id": "57ab0421d5234caf7a97ce93908cd07e23f53a0b", "index": 9037, "step-1": "import copy\nimport time\nimport random\n\nfrom twisted.python import log, failure\nfrom twisted.internet import defer, error, protocol, reactor\nfrom twisted.protocols import basic, policies\n\nfrom pn.util import url\nfrom pn.cor...
[ 0 ]
#Small enough? - Beginner # You will be given an array and a limit value. # You must check that all values in the array are # below or equal to the limit value. If they are, # return true. Else, return false. def small_enough(array, limit): counter = "" for arr in array: if arr <= limit: ...
normal
{ "blob_id": "117b340b13b9b1c53d3df1646cd5924f0118ab5d", "index": 5512, "step-1": "<mask token>\n", "step-2": "def small_enough(array, limit):\n counter = ''\n for arr in array:\n if arr <= limit:\n counter += 'True,'\n else:\n counter += 'False,'\n if 'False' in cou...
[ 0, 1, 2 ]
def modCount(n, m): if(m <= n): inBetween = n - m dividible = [] for x in range(m+1, n): if(x%m == 0): dividible.append(x) return 'There are {} numbers between {} and {} \nand the ones that are dividible by {} are {}'.format(inBetween, m, n, m, dividib...
normal
{ "blob_id": "0699c9f70f1c16b4cb9837edf7a4ef27f021faec", "index": 8318, "step-1": "<mask token>\n", "step-2": "def modCount(n, m):\n if m <= n:\n inBetween = n - m\n dividible = []\n for x in range(m + 1, n):\n if x % m == 0:\n dividible.append(x)\n retur...
[ 0, 1, 2, 3 ]
# https://leetcode-cn.com/problems/zigzag-conversion/ # 6. Z 字形变换 class Solution: def convert(self, s: str, numRows: int) -> str: res = '' for i in range(numRows): pass return res
normal
{ "blob_id": "aa952e8f9a1855b5578cb26d6e5aca42605ee585", "index": 5454, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def convert(self, s: str, numRows: int) ->str:\n res = ''\n for i in range(numRows):\n pass\n r...
[ 0, 1, 2, 3 ]
from django.db import models # Create your models here. class Pastebin(models.Model): name= models.CharField(max_length=30) textpaste = models.CharField(max_length=80) pasteurl = models.AutoField(primary_key=True) def __str__(self): return self.name
normal
{ "blob_id": "3badf65a5301cc9cf26811e3989631aec5d31910", "index": 2709, "step-1": "<mask token>\n\n\nclass Pastebin(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Pastebin(models.Model):\n <mask token>\n <mask token>\n <mask...
[ 1, 2, 3, 4, 5 ]
import csv import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit #funktion def func(w,rc): return 1/(np.sqrt(1+w**2*rc**2)) #daten einlesen with open('data/phase.csv' ) as csvfile: reader=csv.reader(csvfile, delimiter=',') header_row=next(reader) f, U, a,...
normal
{ "blob_id": "170d0560c40f3f642f319f6113b68ab8a6bea9ef", "index": 468, "step-1": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\nwith open('data/phase.csv') as...
[ 1, 2, 3, 4, 5 ]
import pytest @pytest.mark.usefixtures("driver") class BaseClass: """BaseClass takes in driver fixture."""
normal
{ "blob_id": "1b49cb59ebdb548cfc7567cd5cb4affe30f33aac", "index": 5576, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n <mask token>\n", "step-3": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass BaseClass:\n \"\"\"BaseClass tak...
[ 0, 1, 2, 3, 4 ]
import pprint class ErrorResponseCollection(object): def __init__(self, status, message, param = "message"): self.status = status self.message = message self.param = param def as_md(self): return '\n\n> **%s**\n\n```\n{\n\n\t"%s": "%s"\n\n}\n\n```' % \ ...
normal
{ "blob_id": "ade4d797a83eaa06e8bde90972a56376d7e0f55a", "index": 6086, "step-1": "<mask token>\n\n\nclass ErrorResponseCollection(object):\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass ResponseCollection(object):\n\n def __init__(self, message=None, data=None):\n self.message = messa...
[ 4, 5, 6, 7, 9 ]
print "How old are you?", age = raw_input() print "How tall are you?", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So, you're %r old, %r tall, and %r heavy." % (age, height, weight) #raw_input does not exist in Python 3.x while input() does. raw_input() returns a string, and inp...
normal
{ "blob_id": "4df747b3ff254e0ccc4483acd7be12f3441bbcd8", "index": 5531, "step-1": "\nprint \"How old are you?\",\nage = raw_input()\nprint \"How tall are you?\",\nheight = raw_input()\nprint \"How much do you weigh?\",\nweight = raw_input()\n\nprint \"So, you're %r old, %r tall, and %r heavy.\" % (age, height, we...
[ 0 ]
""" This module contains the class definitions for all types of BankAccount alongside BankAccountCreator as a supporting class to create an appropriate bank account for a given user type. """ from abc import ABC from abc import abstractmethod from transaction import Transaction from budget import Budget from budget im...
normal
{ "blob_id": "830ae4b6a6b2c4e1bbe6928b3a4b0be86d2ec7a3", "index": 3743, "step-1": "<mask token>\n\n\nclass AngelBankAccount(BankAccount):\n <mask token>\n <mask token>\n\n\nclass TroublemakerBankAccount(BankAccount):\n \"\"\"\n This bank account is designed for Troublemaker children. These\n childr...
[ 12, 17, 20, 25, 28 ]
from trapezoidal import trapezoidal from midpoint import midpoint from math import pi, sin def integrate_sine(f, a, b, n = 2): I_t = trapezoidal(f, a, b, n) I_m = midpoint() return None a = 0.0; b = pi f = lambda x: sin(x)
normal
{ "blob_id": "d99278c8f539322fd83ae5459c3121effc044b88", "index": 5193, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef integrate_sine(f, a, b, n=2):\n I_t = trapezoidal(f, a, b, n)\n I_m = midpoint()\n return None\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef integrate_sine(f, ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # # File: PatrimonyCertificate.py # # Copyright (c) 2015 by CommunesPlone # Generator: ArchGenXML Version 2.7 # http://plone.org/products/archgenxml # # GNU General Public License (GPL) # __author__ = """Gauthier BASTIEN <gbastien@commune.sambreville.be>, Stephan GEULETTE <stephan.ge...
normal
{ "blob_id": "6c0b2fa8166bb21a514dc188858e1de285ad9b0a", "index": 166, "step-1": "<mask token>\n\n\nclass PatrimonyCertificate(BaseFolder, GenericLicence, Inquiry,\n BrowserDefaultMixin):\n <mask token>\n security = ClassSecurityInfo()\n implements(interfaces.IPatrimonyCertificate)\n meta_type = 'P...
[ 6, 8, 9, 10, 12 ]
import tensorflow as tf from tensorflow.contrib import layers from tensorflow.contrib.framework.python.ops import arg_scope from tensorflow.contrib.layers.python.layers import initializers from tensorflow.contrib.layers.python.layers import layers as layers_lib from tensorflow.contrib.layers.python.layers import regula...
normal
{ "blob_id": "ca93f49fbdc1d64e0616bca035a6043b3cc80ddc", "index": 1485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef inception_2d_fields(img, fields, num_classes=30, is_training=True,\n dropout_keep_prob=0.6, prediction_fn=layers_lib.softmax,\n spatial_squeeze=True, reuse=None, scope='Ince...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models class ClassMKB(models.Model): name = models.CharField(max_length=512,verbose_name = 'Наименование') code = models.CharField(max_length=20, null=True, blank=True,verbose_name = 'Код') parent_id = models.IntegerFie...
normal
{ "blob_id": "8753996c90ecea685e6312020dfd31fabb366138", "index": 5270, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClassMKB(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n db_table = 'cla...
[ 0, 2, 3, 4, 5 ]
def merge(self, intervals): intervals.sort() arr = [] for i in intervals: if len(arr) == 0 or arr[-1][1] < i[0]: arr.append(i) else: arr[-1][1] = max(arr[-1][1], i[1]) return arr
normal
{ "blob_id": "a65dfca1773c1e4101ebfb953e0f617a2c345695", "index": 334, "step-1": "<mask token>\n", "step-2": "def merge(self, intervals):\n intervals.sort()\n arr = []\n for i in intervals:\n if len(arr) == 0 or arr[-1][1] < i[0]:\n arr.append(i)\n else:\n arr[-1][1]...
[ 0, 1 ]
def func_sum_even(n): e_digit1=n%10 n//=10 e_digit2=n%10 e_digit3=n//10 sum_even=e_digit1*(1-e_digit1%2)+e_digit2*(1-e_digit2%2)+e_digit3*(1-e_digit3%2) return sum_even # n=int(input()) # print(func_sum_even(n))
normal
{ "blob_id": "d567dfe29380a34534308446a9c8940cede84083", "index": 7571, "step-1": "<mask token>\n", "step-2": "def func_sum_even(n):\n e_digit1 = n % 10\n n //= 10\n e_digit2 = n % 10\n e_digit3 = n // 10\n sum_even = e_digit1 * (1 - e_digit1 % 2) + e_digit2 * (1 - e_digit2 % 2\n ) + e_dig...
[ 0, 1, 2 ]
import sys def is_huge(A, B): return (A[0] > B[0]) and (A[1] > B[1]) if __name__ == '__main__': bulks = [] num = int(sys.stdin.readline()) for i in range(num): bulks.append(list(map(int, sys.stdin.readline().split()))) for i in range(len(bulks)): count = 0 for j in range...
normal
{ "blob_id": "5dc8f420e16ee14ecfdc61413f10a783e819ec32", "index": 506, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef is_huge(A, B):\n return A[0] > B[0] and A[1] > B[1]\n\n\nif __nam...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Thu Jan 2 22:49:00 2020 @author: Drew ____________________________________________________________________ basic_github_auto_uploader.py - A Basic Automated GitHub Uploader ____________________________________________________________________ 1. Requirements: Version: ...
normal
{ "blob_id": "bcc3d4e9be0de575c97bb3bf11eeb379ab5be458", "index": 5380, "step-1": "<mask token>\n\n\ndef main():\n subs = subdir_maker(os.path.dirname(os.path.realpath(__file__)))\n for i in range(len(subs)):\n daily_github_upload(subs[i])\n print('_' * 40 + '\\n\\n' + 'Uploaded {0} to Github....
[ 1, 2, 3, 4, 5 ]
def __handle_import(): import sys import os cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_path = os.path.join(cur_path, '../../build/lib/') sys.path.append(lib_path) proto_path = os.path.join(cur_path, '../../build/protobuf_python/') sys.path.append(proto_path...
normal
{ "blob_id": "24595979199199ecc6bc6f3a26e0db418def8b78", "index": 9675, "step-1": "<mask token>\n", "step-2": "def __handle_import():\n import sys\n import os\n cur_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))\n lib_path = os.path.join(cur_path, '../../build/lib/')\n sys....
[ 0, 1, 2 ]
from bs4 import BeautifulSoup, CData import requests,sys,csv,json,os, urllib.request, re import json url2 = "http://ufm.edu/Estudios" def estudios(Minisoup): print("2.Estudios") #now navigate to /Estudios (better if you obtain href from the DOM) try: html_content = requests.get(url2).text except: print(...
normal
{ "blob_id": "846682072a125c76fc9ffa011109abce7c3bb5d7", "index": 3269, "step-1": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\ntry:\n html_content = requests.get(url2).text\nexcept:...
[ 1, 2, 3, 4, 5 ]
highscores = [] scores = [] while True: user = input('> ').split(' ') score = int(user[0]) name = user[1] scores.append([score, name]) scores.sort(reverse=True) if len(scores) < 3: highscores = scores else: highscores = scores[:3] print(highscores)
normal
{ "blob_id": "54e5feee3c8bb35c351361fd3ed4b5e237e5973d", "index": 6701, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n user = input('> ').split(' ')\n score = int(user[0])\n name = user[1]\n scores.append([score, name])\n scores.sort(reverse=True)\n if len(scores) < 3:\n ...
[ 0, 1, 2 ]
import queue import sys import logging from superai.common import InitLog logger = logging.getLogger(__name__) # 2维到1维 def hwToidx(x: int, y: int, weight: int): return y * weight + x # 1维到2维 def idxTohw(idx, weight: int): return [idx % weight, idx // weight] # 10x10 cell idx 到 [x,y] def idxToXY(idx, cel...
normal
{ "blob_id": "b6d8a918659f733919fe3bb4be9037e36ad32386", "index": 272, "step-1": "<mask token>\n\n\nclass Graph:\n\n def __init__(self, V: int, W: int):\n self.V = V\n self.E = 0\n self.adj = []\n self.W = W\n for i in range(V):\n nears = []\n self.adj.a...
[ 14, 17, 18, 19, 24 ]
# Copyright 2016 Osvaldo Santana Neto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
normal
{ "blob_id": "09284a96467b09c2ad7b65530c015fdb64b198a4", "index": 2638, "step-1": "<mask token>\n\n\nclass ModelBuilder:\n <mask token>\n <mask token>\n <mask token>\n\n def build_user(self, user_data):\n user = User(name=user_data.nome, federal_tax_number=\n FederalTaxNumber(user_da...
[ 29, 30, 33, 37, 42 ]
import json import os import ssl from ldap3 import Server, Connection, Tls, SUBTREE, ALL # Include root CA certificate path if you use a self signed AD certificate SSL_CERT_PATH = "path/to/cert.pem" # Include the FQDN of your Domain Controller here FQDN = "ad.example.com" # Search base is the CN of the container w...
normal
{ "blob_id": "9ca5c052db43c1d8b0cafa18038b3ebcd80067f7", "index": 4710, "step-1": "<mask token>\n\n\ndef __main__():\n email = input(\"Please input the departing user's email address: \")\n ad_result = deprovision_AD(email)\n print(ad_result)\n", "step-2": "<mask token>\n\n\ndef deprovision_AD(email):\...
[ 1, 2, 3, 4, 5 ]
from datetime import timedelta, datetime import glob import json import os import re import pickle import os,time import pandas as pd import numpy as np from collections import Counter from sentencepiece import SentencePieceTrainer from sentencepiece import SentencePieceProcessor from sklearn.feature_extraction.text i...
normal
{ "blob_id": "05573b4ff68ca8638f8e13946b410df2a012840a", "index": 1829, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef song_inference():\n sp_total_model_path = 'sp_total'\n train = pd.read_json('./dataset/train.json', typ='frame', encoding='utf-8')\n song = pd.read_json('./dataset/song_m...
[ 0, 1, 2, 3, 4 ]
import db data = {'python book': ['10.09.2019', 200, 50, False]} def test_insert_and_get_db(data): db.insert(data) result = db.get_db() return result == data if __name__ == '__main__': print( f' Test insert dict in to db, and get dict from db is {test_insert_and_get_db(data)}' ) ...
normal
{ "blob_id": "d5cb875dc31ca3dd7b165206415c346a076dd6e4", "index": 2901, "step-1": "<mask token>\n\n\ndef test_insert_and_get_db(data):\n db.insert(data)\n result = db.get_db()\n return result == data\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_insert_and_get_db(data):\n db.insert(dat...
[ 1, 2, 3, 4 ]
from random import shuffle """all sorting algorithm implementation""" class Sorts: def quick_sort(self, elements): """quick sort implementation""" if len(elements) < 2: return elements else: shuffle(elements) pivot = elements[0] print("pivot ...
normal
{ "blob_id": "2044140fb2678f9507946007fdfb7edbaf11798e", "index": 5683, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Sorts:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Sorts:\n\n def quick_sort(self, elements):\n \"\"\"quick sort implementation\"\"\"\n if len(el...
[ 0, 1, 2, 3, 4 ]
import logging from common.loghdl import getLogHandler from datastore.dbutil import DBSQLLite, getDSConnStr #from utils.generator import random_password #from datastore.dbadmin import DBAdmin #from datastore.initevaldb import * ############################ TESTING TO BE REMOVED # md = cfg #def test_spetest(c...
normal
{ "blob_id": "c3970ad8bddb1ca136724f589ff9088024157662", "index": 7942, "step-1": "\nimport logging\n\nfrom common.loghdl import getLogHandler\nfrom datastore.dbutil import DBSQLLite, getDSConnStr\n\n\n#from utils.generator import random_password\n#from datastore.dbadmin import DBAdmin\n#from datastore.initeva...
[ 0 ]
import glob import xarray as xr from model_diagnostics import * data_root = '../data/synthetic/standard/' var_list = ['hs', 'dp', 'spr', 'fp', 'dir', 't0m1'] eke = 0.01 ########################## output = [] diagnostic_functions = [basic_stats] for var in var_list: grid_files = glob.glob(data_root+'gridded/*%s*%s...
normal
{ "blob_id": "6b727cdfc684db4ba919cd5390fe45de43a806fe", "index": 309, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor var in var_list:\n grid_files = glob.glob(data_root + 'gridded/*%s*%s.nc' % (eke, var))\n for f in grid_files:\n output.append(analize_member(f, var, diagnostic_functions)...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding:utf-8 -*- import numpy as np from functools import reduce def element_wise_op(x, operation): for i in np.nditer(x, op_flags=['readwrite']): i[...] = operation[i] class RecurrentLayer(object): def __init__(self, input_dim, state_dim, activator, learning_rate): se...
normal
{ "blob_id": "b34ce3ac87a01b8e80abc3fde1c91638f2896610", "index": 2392, "step-1": "<mask token>\n\n\nclass RecurrentLayer(object):\n <mask token>\n\n def forward(self, input_vec):\n self.time += 1\n state = np.dot(self.U, input_vec) + np.dot(self.W, self.state_list[-1])\n element_wise_o...
[ 3, 8, 9, 10, 12 ]
import widget import column class Columns(widget.Widget): def __init__(self, parent): super(Columns, self).__init__(parent) # self.root.mouse.on_drag_release.append(self.on_drag_release) """ def on_drag_release(self, x0, y0, x, y): if not self.contains_point(x0, y0): re...
normal
{ "blob_id": "e0874554c326bb11b53552e362bc8073bb57bc93", "index": 9720, "step-1": "<mask token>\n\n\nclass Columns(widget.Widget):\n\n def __init__(self, parent):\n super(Columns, self).__init__(parent)\n <mask token>\n\n def add_column(self):\n col = column.Column(self)\n self.child...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python #coding=utf-8 #author:maohan #date:20160706 #decription:通过百度api获取相关信息,并保存为xls格式 #ver:1.0 import urllib2 import json import sys from pyExcelerator import * def bd_finder(qw,region,page_num): page_size='20' bd_ak='wkEmrv7B1l0KPpi30F1G2VMx10xEdeol' bd_url='http://api.map.baidu.com/place/v2/search?...
normal
{ "blob_id": "941a93c66a5131712f337ad055bbf2a93e6ec10d", "index": 1634, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bd_finder(qw, region, page_num):\n page_size = '20'\n bd_ak = 'wkEmrv7B1l0KPpi30F1G2VMx10xEdeol'\n bd_url = 'http://api.map.baidu.com/place/v2/search?'\n furl = (bd_ur...
[ 0, 1, 2, 3, 4 ]
import json import struct import pymel.core as pmc import os.path def exportVSSD(path, camName, wantTris=False, renderdata=None): mainFileDict = {} mainFilePath = path mainFileStem = os.path.basename(path)[:-5] mainFileDir = os.path.dirname(path) resolution = pmc.ls('defaultResolution')[0] ren...
normal
{ "blob_id": "004a9cd0e459116bf3f88f3546ff4eded3dfb2a8", "index": 2512, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef exportVSSD(path, camName, wantTris=False, renderdata=None):\n mainFileDict = {}\n mainFilePath = path\n mainFileStem = os.path.basename(path)[:-5]\n mainFileDir = os.p...
[ 0, 1, 2 ]
# Midterm Review Class! ''' This is a Multi line comment: ''' # Break and Continue # for i in range(10): # if i == 5: # continue # print(i) # Prints 0-4, 6-9 # # Structure # Some MCQ # Some T/F # Some short answer # # Lists # Append # remove # del # ...
normal
{ "blob_id": "3d3b77630d275f830daf9f6e0d50a77ef624521e", "index": 7139, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, 100, 10):\n print(i + 10)\n", "step-3": "# Midterm Review Class!\n\n'''\nThis is a Multi line comment:\n'''\n\n# Break and Continue\n # for i in range(10):\n ...
[ 0, 1, 2 ]
from svjesus.ffz import genContent from svjesus.elements.Base import Element class Descriptive(Element): def __init__(self): self.allowedChildren = () # TODO: Check what's allowed # Descriptive elements class Desc(Descriptive): name = "desc" attrs = () class Metadata(Descriptive): name = "metadata" attrs = ()...
normal
{ "blob_id": "178570047458eb3eeda00f9153ef2159eb4cbef3", "index": 9188, "step-1": "<mask token>\n\n\nclass Desc(Descriptive):\n name = 'desc'\n attrs = ()\n\n\nclass Metadata(Descriptive):\n name = 'metadata'\n attrs = ()\n\n\nclass Title(Descriptive):\n name = 'title'\n attrs = ()\n", "step-2...
[ 6, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- from datetime import datetime from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx from odoo.tools import DEFAULT_SERVER_DATE_FORMAT import xlwt from odoo import _ from odoo.exceptions import AccessError, UserError class mutasibankjurnal(ReportXlsx): def generate_xlsx_r...
normal
{ "blob_id": "950929edc82bf78ee33df117fba370b937255adc", "index": 1703, "step-1": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass mutasibankjurnal(ReportXlsx):\n\n def generate_xlsx_report(self, workbook, data, wizard):\n ...
[ 1, 2, 3, 4, 5 ]
import numpy as np import cv2 import sys import math cap = cv2.VideoCapture(0) while(True): _, img = cap.read() #gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) img = cv2.imread("zielfeld_mit_Zeugs_2.png") #img = cv2.imread("zielfeld_mit_Zeugs_2.jpg") #imS = cv2.resize(img, (480, 480...
normal
{ "blob_id": "3f5ae2b25fc506b980de3ee87c952ff699e10003", "index": 4977, "step-1": "import numpy as np\r\nimport cv2\r\nimport sys\r\nimport math\r\n\r\n\r\n\r\ncap = cv2.VideoCapture(0)\r\n\r\nwhile(True):\r\n _, img = cap.read()\r\n #gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)\r\n\r\n img = cv2.imread(\...
[ 0 ]
#!/usr/bin/env python3 from flask import Flask, request from flask_restplus import Resource, Api, fields from pymongo import MongoClient from bson.objectid import ObjectId import requests, datetime, re #------------- CONFIG CONSTANTS -------------# DEBUG = True MAX_PAGE_LIMIT = 2 COLLECTION = 'indicators' DB_CONFIG =...
normal
{ "blob_id": "75958b48a3372b56e072a0caa468171ab6b99eb6", "index": 8917, "step-1": "<mask token>\n\n\n@api.route(f'/{COLLECTION}/<collection_id>', endpoint=f'{COLLECTION}_by_id')\n@api.param('collection_id', f'Unique id, used to distinguish {COLLECTION}.')\nclass CollectionsById(Resource):\n\n @api.doc(descript...
[ 7, 11, 15, 16, 19 ]
import io import os import sys import whwn from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand here = os.path.abspath(os.path.dirname(__file__)) with open('README.md') as readme: long_description = readme.read() with open('requirements.txt') as reqs: install_re...
normal
{ "blob_id": "bd2a5c2dd3eef5979c87a488fb584dce740ccb05", "index": 3870, "step-1": "<mask token>\n\n\nclass PyTest(TestCommand):\n\n def finalize_options(self):\n TestCommand.finalize_options(self)\n self.test_args = []\n self.test_suite = True\n\n def run_tests(self):\n import py...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python from ROOT import TFileMerger import subprocess def MergeFiles(output, fileList, skipList=[], acceptList=[], n=20): merger = TFileMerger(False) merger.OutputFile(output); merger.SetMaxOpenedFiles(n); print "Total number of files is {0}".format(len(fileList)) for fileName...
normal
{ "blob_id": "95f7710fb0137617025819b6240312ce02915328", "index": 173, "step-1": "#!/usr/bin/env python\n\nfrom ROOT import TFileMerger\nimport subprocess\n\ndef MergeFiles(output, fileList, skipList=[], acceptList=[], n=20):\n merger = TFileMerger(False)\n merger.OutputFile(output);\n merger.SetMaxOpene...
[ 0 ]
from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS import urllib from flask import Flask ########################################################################################DataBase@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2 #connection string params = urllib.parse.quote_plus('Driv...
normal
{ "blob_id": "6928ff58ddb97883a43dfd867ff9a89db72ae348", "index": 6567, "step-1": "<mask token>\n\n\nclass Entity_list_user(db.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 token>\n <mask token>...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python from cos_correct_v2 import * from angle_to_position import * import pandas as pd import datetime as dt def get_position_from_angle(razon, data, start, end): # Obtain cos factors and corrected data dni_df, altitude_angles, azimuth_angles = data cos_correct_df = razon.get_cos_factors(...
normal
{ "blob_id": "13a4fb5ce9ab0a3ef9ce503698615eae4157a637", "index": 7962, "step-1": "<mask token>\n\n\ndef get_position_from_angle(razon, data, start, end):\n dni_df, altitude_angles, azimuth_angles = data\n cos_correct_df = razon.get_cos_factors(altitude_angles, azimuth_angles)\n dni_df = razon.cos_correc...
[ 1, 2, 3, 4, 5 ]
from django.db import models from django.contrib.auth.models import User class CustomUser(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='custom_user') def get_current_score(self): acc = 0 for score in self.user_scores.all(): acc += score.p...
normal
{ "blob_id": "dc27781d0c3129d11aa98a5889aea0383b5a49d6", "index": 3571, "step-1": "<mask token>\n\n\nclass Team(models.Model):\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name + ' ' + str(self.id)\n\n\nclass Leaderboard(models.Model):\n end_date = models.DateField(auto_no...
[ 8, 9, 10, 13, 15 ]
#!/usr/bin/env python # encoding: utf-8 from rest_client import PY2 from tornado.testing import gen_test from tornado.web import Application, RequestHandler from .server import AsyncRESTTestCase class Handler(RequestHandler): if PY2: S = '\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82 \xd0\xbc\xd0\xb8\x...
normal
{ "blob_id": "4bbd97942023370e053ccf4b5c1496c7247c7bf2", "index": 9026, "step-1": "<mask token>\n\n\nclass TestCopy(AsyncRESTTestCase):\n <mask token>\n\n @gen_test\n def test_get(self):\n response = yield self.http_client.get(self.api_url.format('/'))\n assert response.body == Handler.S\n"...
[ 2, 3, 4, 6, 7 ]
a = [66.25, 333, 333, 1, 1234.5] a.index(333) print(a)
normal
{ "blob_id": "7aba77137b96071101078c38c1c9397bf837d92a", "index": 1378, "step-1": "<mask token>\n", "step-2": "<mask token>\na.index(333)\nprint(a)\n", "step-3": "a = [66.25, 333, 333, 1, 1234.5]\na.index(333)\nprint(a)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from nose.tools import * from json import json def test_json_basestring(): assert_equals(json("Hello World"), '"Hello World"') def test_json_integer(): assert_equals(json(9), "9") def test_json_float(): assert_equals(json(1.234), "1.234") def test_json...
normal
{ "blob_id": "09ce2aeccfd1f3f4f130fd79001db47485cc95c2", "index": 9891, "step-1": "<mask token>\n\n\ndef test_json_float():\n assert_equals(json(1.234), '1.234')\n\n\ndef test_json_array():\n data = [1, 2, 3]\n assert_equals(json(data), '[1,2,3]')\n\n\ndef test_json_array02():\n data = ['bla', 1, 1.2]...
[ 12, 13, 19, 22, 24 ]
import torch import numpy as np import cv2 import torchvision from PIL import Image def people_on_image(path_to_image): color_map = [ (255, 255, 255), # background (255, 255, 255), # aeroplane (255, 255, 255), # bicycle (255, 255, 255), ...
normal
{ "blob_id": "2193c97b7f1fcf204007c2528ecc47cbf3c67e81", "index": 9992, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef people_on_image(path_to_image):\n color_map = [(255, 255, 255), (255, 255, 255), (255, 255, 255), (255, \n 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), ...
[ 0, 1, 2, 3 ]
from functools import partial import utils.functions as fn import random as rd import numpy as np import time class NeuralNetwork: def __init__(self, input_size, hidden_size, output_size): self.input_size = input_size self.hidden_size = hidden_size self.output_size = output_size ...
normal
{ "blob_id": "f24516d8977b10b1ccece2f8eaec6e08ce0c2e16", "index": 9689, "step-1": "<mask token>\n\n\nclass NeuralNetwork:\n\n def __init__(self, input_size, hidden_size, output_size):\n self.input_size = input_size\n self.hidden_size = hidden_size\n self.output_size = output_size\n ...
[ 5, 6, 7, 8, 9 ]
import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.grid_search import GridSearchCV import matplotlib.pyplot as plt def loadTrainSet(filepath): raw = np.loadtxt(filepath, delimiter=',', dtype=np.str, skiprows=1) X, y = raw[:,1:], raw[:,0] trainSet = np.hstack((X, y.reshape(-...
normal
{ "blob_id": "08f0b261b5a9b0f5133c468b3f92dc00285eda6a", "index": 4477, "step-1": "<mask token>\n\n\ndef gridsearchcv(X, y):\n accuracy = []\n stdlist = []\n classifier = RandomForestClassifier(verbose=2, n_jobs=1, oob_score=1)\n param_grid = {'n_estimators': np.arange(1, 100, 10)}\n grid = GridSea...
[ 1, 2, 3, 4, 5 ]
#!/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 ]
# -*- coding: utf-8 -*- import sys from os import listdir, makedirs, unlink from os.path import isdir, join, isfile, exists from shutil import copy import random def clearDirectory( path ):#将dataset里面的文件都删除 for the_file in listdir(path): file_path = join(path, the_file) try: if isfile(file_path): ...
normal
{ "blob_id": "a714ac227d5185d7b4a932695ba6698e18d96341", "index": 629, "step-1": "# -*- coding: utf-8 -*-\nimport sys\nfrom os import listdir, makedirs, unlink\nfrom os.path import isdir, join, isfile, exists\nfrom shutil import copy\nimport random\n\ndef clearDirectory( path ):#将dataset里面的文件都删除\n\tfor the_file i...
[ 0 ]
import sys sys.setrecursionlimit(1000000) n, q = map(int, input().split()) graph = [set([]) for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) graph[a - 1].add(b - 1) graph[b - 1].add(a - 1) def dfs(i): if temp[i]: return temp[i] = True if i in odd: for...
normal
{ "blob_id": "bab6b9a0178da119f753deb6c626dd5c41db2bdd", "index": 2004, "step-1": "<mask token>\n\n\ndef dfs(i):\n if temp[i]:\n return\n temp[i] = True\n if i in odd:\n for j in graph[i]:\n even.add(j)\n dfs(j)\n else:\n for j in graph[i]:\n odd.a...
[ 1, 2, 3, 4, 5 ]
''' Import necessary libraries ''' import re import csv import os from urllib.request import urlopen, Request from bs4 import BeautifulSoup as soup ''' Function to request page html from given URL ''' def page_html(requested_url): try: # define headers to be provided for request authenticatio...
normal
{ "blob_id": "5bfb7fc60ddf4f6ad6d89771eb0a8903b04da3d9", "index": 6187, "step-1": "<mask token>\n\n\ndef page_html(requested_url):\n try:\n headers = {'User-Agent':\n 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'\n , 'Acc...
[ 3, 4, 5, 6, 7 ]
from werkzeug.security import check_password_hash, generate_password_hash from datetime import datetime from app import db from app import login from flask_login import UserMixin @login.user_loader def load_user(id): return User.query.get(int(id)) class User(UserMixin, db.Model): user_id = db.Column(db.Integer, p...
normal
{ "blob_id": "5cfdb1f6b99f59a83a9bd42b7daf3e016eee94a8", "index": 2898, "step-1": "<mask token>\n\n\nclass Post(db.Model):\n post_id = db.Column(db.Integer, primary_key=True, nullable=False)\n title = db.Column(db.String(50))\n body = db.Column(db.String(200))\n timestamp = db.Column(db.DateTime, inde...
[ 5, 8, 10, 11, 13 ]
import numpy as np from math import inf """ Strategy made by duckboycool for carykh's Prisoner's Dilemma Tournament. (https://youtu.be/r2Fw_rms-mA) It is a nice Tit for Tat based strategy that attempts to detect when the opponent is not changing their actions based off of ours so we can maximize with defects, and att...
normal
{ "blob_id": "8ae6630ccd2f2b5a10401cadb4574772f6ecbc4a", "index": 4478, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef strategy(history, memory):\n if not history.size:\n counts.clear()\n for x in patterns:\n counts.append(0)\n if memory:\n return memory.pop(0...
[ 0, 1, 2, 3, 4 ]
from ttkwidgets import CheckboxTreeview from tkinter import * from tkinter.ttk import * from tkinter import messagebox import json import os from DbDataloader import * class DataLoader(): def __init__(self,master): self.anne={} self.master=Toplevel(master) master.wait_visibility(self.master)...
normal
{ "blob_id": "a70dae504a4dfa3997a11e4c605accfab0024318", "index": 8796, "step-1": "<mask token>\n\n\nclass DataLoader:\n <mask token>\n\n def main(self):\n choice = messagebox.askyesno('askquestion',\n 'Cliquer sur Oui pour charger les données en mode Trasactionnel')\n if choice:\n ...
[ 5, 6, 7, 8, 9 ]
v1=int(input("Introdu virsta primei persoane")) v2=int(input("Introdu virsta persoanei a doua")) v3=int(input("Introdu virsta persoanei a treia")) if ((v1>18)and(v1<60)): print(v1) elif((v2>18)and(v2<60)): print(v2) elif((v3>18)and(v3<60)): print(v3)
normal
{ "blob_id": "b8c749052af0061373808addea3ad419c35e1a29", "index": 3324, "step-1": "<mask token>\n", "step-2": "<mask token>\nif v1 > 18 and v1 < 60:\n print(v1)\nelif v2 > 18 and v2 < 60:\n print(v2)\nelif v3 > 18 and v3 < 60:\n print(v3)\n", "step-3": "v1 = int(input('Introdu virsta primei persoane'...
[ 0, 1, 2, 3 ]
# Copyright 2014 The crabapple Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import abc class Notifier(object): __metaclass__ = abc.ABCMeta def __init__(self): pass @abc.abstractmethod def config(self, kwa...
normal
{ "blob_id": "f25351a3cb7bf583152baa8e7ec47b0f2161cb9c", "index": 761, "step-1": "<mask token>\n\n\nclass Notifier(object):\n <mask token>\n\n def __init__(self):\n pass\n <mask token>\n\n @abc.abstractmethod\n def send(self, msg):\n pass\n", "step-2": "<mask token>\n\n\nclass Notif...
[ 3, 4, 5, 6, 7 ]
# encoding = utf-8 import hmac import time from hashlib import sha1 def get_signature(now_): # 签名由clientId,grantType,source,timestamp四个参数生成 h = hmac.new( key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'), digestmod=sha1) grant_type = 'password' client_id = 'c3cef7c66a1843f8b3a9e6a...
normal
{ "blob_id": "757a69f9ceaa3434c6d9f8b1fcdbadd991190f29", "index": 9315, "step-1": "<mask token>\n\n\ndef get_signature(now_):\n h = hmac.new(key='d1b964811afb40118a12068ff74a12f4'.encode('utf-8'),\n digestmod=sha1)\n grant_type = 'password'\n client_id = 'c3cef7c66a1843f8b3a9e6a1e3160e20'\n sou...
[ 1, 2, 3, 4, 5 ]
import django_filters from .models import Drinks, Brand class DrinkFilter(django_filters.FilterSet): BRAND_CHOICES = tuple( (brand.name, brand.name) for brand in Brand.objects.all()) name = django_filters.CharFilter(lookup_expr='icontains') price_lt = django_filters.NumberFilter(field_name='price'...
normal
{ "blob_id": "a096e811e50e25e47a9b76b1f813c51f4307bbfe", "index": 331, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DrinkFilter(django_filters.FilterSet):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n clas...
[ 0, 1, 2, 3, 4 ]
__author__ = 'Administrator' #coding:utf-8 def calculate_score(calculation_params): """ 计算选手在一跳中的得分,共7名裁判,去掉两个最高分和两个最低分,余下3名裁判员的分数之和乘以运动员所跳动作的难度系数,便得出该动作的实得分 传入参数为字典 calculation_params["score_list"] = [] calculation_params["difficulty"] = float """ score_list = calculation_params["score_list...
normal
{ "blob_id": "52872804a069cd954bea247b64041eceafd8d139", "index": 7673, "step-1": "__author__ = 'Administrator'\n#coding:utf-8\ndef calculate_score(calculation_params):\n \"\"\"\n 计算选手在一跳中的得分,共7名裁判,去掉两个最高分和两个最低分,余下3名裁判员的分数之和乘以运动员所跳动作的难度系数,便得出该动作的实得分\n 传入参数为字典\n calculation_params[\"score_list\"] = []\...
[ 0 ]
#!/usr/bin/python import calendar a=int(raw_input("enter the year to check that year is leap year or not\n")) cal=calendar.isleap(a) if cal : print "leap year" else : print "not a leap year" print "\nthanks " ''' '''
normal
{ "blob_id": "a077221d91f75645172ba5d86afad8e49cb7ed2f", "index": 2796, "step-1": "#!/usr/bin/python\nimport calendar\n\na=int(raw_input(\"enter the year to check that year is leap year or not\\n\")) \ncal=calendar.isleap(a)\n \nif cal :\n\t\t\tprint \"leap year\"\nelse :\n\t\t\tprint \"not a leap year\"\n\nprint...
[ 0 ]
"""Initial migration Revision ID: 1f2296edbc75 Revises: 7417382a3f1 Create Date: 2014-01-19 23:04:58.877817 """ # revision identifiers, used by Alembic. revision = '1f2296edbc75' down_revision = '7417382a3f1' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy i...
normal
{ "blob_id": "7df55853d0f4f1bf56512c4427d7f91e9c1f2279", "index": 6524, "step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_index('ix_ballot_measure_tags_ballot_measure_id',\n 'ballot_measure_tags')\n op.drop_index('ix_ballot_measure_tags_tag_id', 'ballot_measure_tags')\n op.drop_table(u'ballo...
[ 1, 2, 3, 4, 5 ]