code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
# Generated by Django 2.1.5 on 2019-08-03 23:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('crm', '0003_auto_20190802_2211'), ] operations = [ migrations.AlterModelOptions( name='customerinfo', options={'verbose_name...
normal
{ "blob_id": "b90fb1e657d4c7e186a7b889eee586527bec4413", "index": 2040, "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 = [('crm', '0003...
[ 0, 1, 2, 3, 4 ]
from chalicelib.utilities import * def Error(app): @app.route('/errors', cors=True, methods=['POST']) @printError def errors(): request = app.current_request data = request.json_body print(data) return data
normal
{ "blob_id": "f100757fcb1bef334f9f8eacae83af551d2bac5b", "index": 3239, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Error(app):\n\n @app.route('/errors', cors=True, methods=['POST'])\n @printError\n def errors():\n request = app.current_request\n data = request.json_body\...
[ 0, 1, 2 ]
# coding: utf-8 # In[1]: import matplotlib.pyplot as plt import matplotlib import pandas as pd import numpy as np from pandas import DataFrame, Series import os, re # In[2]: OUTPUT_EXCEL = '월별원내약품사용현황.xlsx' # In[3]: # 데이타셋 준비 data_source_dir = '사용량월별통계/원내' dfs = [] for fname in os.listdir(data_source_dir): ...
normal
{ "blob_id": "16b425d7b8cde1aabe038ccae6922091afb84415", "index": 411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_last(s):\n try:\n return max(s)\n except:\n return s\n\n\n<mask token>\n", "step-3": "<mask token>\nOUTPUT_EXCEL = '월별원내약품사용현황.xlsx'\ndata_source_dir = '사...
[ 0, 1, 3, 4, 5 ]
from typing import * class Solution: def uniquePaths(self, m: int, n: int) -> int: map_: List[List[int]] = [[0 if (i > 0 and j > 0) else 1 for j in range(m)] for i in range(n)] for row in range(1, n): for col in range(1, m): map_[row][col] = map_[row][col - 1] + map_[ro...
normal
{ "blob_id": "e2a38d38d2ab750cf775ed0fbdb56bc6fc7300c4", "index": 8934, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def uniquePaths(self, m: int, n: int) ->int:\n map_: List[List[int]] = [[(0 if i > 0 and j > 0 e...
[ 1, 2, 3, 4, 5 ]
from nonebot_plugin_datastore import get_plugin_data from sqlalchemy import UniqueConstraint from sqlalchemy.orm import Mapped, MappedAsDataclass, mapped_column Model = get_plugin_data().Model class MorningGreeting(MappedAsDataclass, Model): __table_args__ = ( UniqueConstraint( "platform", ...
normal
{ "blob_id": "28e5667db4a620ec627cd94154a024b4c8dbc5f7", "index": 6171, "step-1": "<mask token>\n\n\nclass MorningGreeting(MappedAsDataclass, Model):\n <mask token>\n id: Mapped[int] = mapped_column(init=False, primary_key=True)\n platform: Mapped[str]\n bot_id: Mapped[str]\n group_id: Mapped[str] ...
[ 1, 2, 3, 4, 5 ]
import os from pathlib import Path import Algorithmia API_KEY = os.environ.get('ALGO_API_KEY') DATA_DIR_BASE = os.environ.get('DATA_DIR') ORIGINAL_DATA_DIR = DATA_DIR_BASE + 'original/' TRANSFERD_DATA_DIR = DATA_DIR_BASE + 'transferd/' def upload(client, fnames): for im in fnames: im = Path(im) ...
normal
{ "blob_id": "2536b22c2d154e87bdecb72cc967d8c56ddb73fb", "index": 609, "step-1": "<mask token>\n\n\ndef upload(client, fnames):\n for im in fnames:\n im = Path(im)\n client.file(ORIGINAL_DATA_DIR + str(im.name)).put(im.read_bytes())\n\n\n<mask token>\n\n\ndef style_transfer(fnames, out_folder, fi...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python import re pdfs_file = './pdf_names_2017.txt' sessions_file = './session_names_2017.txt' with open(pdfs_file) as f: pdf_names = f.read().splitlines() with open(sessions_file) as f: session_names = f.read().splitlines() #for i in xrange(0,len(pdf_names)): # print str(i+1).zfill(3) +...
normal
{ "blob_id": "e686d8617360c5a3ce35bd4d2bdeb2376b33f53a", "index": 9726, "step-1": "#!/usr/bin/env python\n\nimport re\n\n\npdfs_file = './pdf_names_2017.txt'\nsessions_file = './session_names_2017.txt'\n\nwith open(pdfs_file) as f:\n pdf_names = f.read().splitlines()\n\nwith open(sessions_file) as f:\n sess...
[ 0 ]
from time import sleep import pytest import allure from app.debug_api import DebugAPI from app.check_api import HandlersAPI from locators.movies_details_locators import MoviesDetailsPageLocators from locators.movies_locators import MoviesPageLocators from locators.shedule_locators import ShedulePageLocators from screen...
normal
{ "blob_id": "c7c412fe4e2d53af1b4f2a55bd3453496767890d", "index": 975, "step-1": "<mask token>\n\n\n@pytest.mark.usefixtures('driver')\nclass Test_001_ShedulePage:\n <mask token>\n <mask token>\n\n def test_001_elements_exists(self, driver):\n \"\"\"тапнуть на фичерс,\n тапнуть на смотреть ...
[ 4, 5, 6, 7 ]
import logging formatter = logging.Formatter("%(asctime)s [%(levelname)s] : %(message)s") log = logging.getLogger("othello") log.setLevel(logging.DEBUG) stream_hander = logging.StreamHandler() stream_hander.setFormatter(formatter) log.addHandler(stream_hander)
normal
{ "blob_id": "675fbdfd519d00ab10bf613e8abb7338e484fe65", "index": 57, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog.setLevel(logging.DEBUG)\n<mask token>\nstream_hander.setFormatter(formatter)\nlog.addHandler(stream_hander)\n", "step-3": "<mask token>\nformatter = logging.Formatter('%(asctime)s [%...
[ 0, 1, 2, 3, 4 ]
import logging from unittest.mock import patch, Mock from intake.tests.base_testcases import ExternalNotificationsPatchTestCase from intake.tests import mock, factories from intake.tests.mock_org_answers import get_answers_for_orgs from intake.management.commands import send_followups from user_accounts.models import O...
normal
{ "blob_id": "5cb67e5fcedafca4ce124e4094cbd8e1e9d95bb4", "index": 3740, "step-1": "<mask token>\n\n\nclass TestCommand(ExternalNotificationsPatchTestCase):\n <mask token>\n\n @patch('intake.management.commands.send_followups.is_the_weekend')\n @patch('intake.management.commands.send_followups.FollowupsSe...
[ 2, 3, 4, 5, 6 ]
import csv import sqlite3 import time from datetime import datetime, timedelta import pandas as pd import pytz import json import urllib import numpy as np DATABASE = '/var/www/html/citibikeapp/citibikeapp/citibike_change.db' def execute_query(cur,query, args=()): cur = cur.execute(query, args) rows = cur.fet...
normal
{ "blob_id": "9b8b196e1ad845ab745dabe5abe3be7bea0d5695", "index": 4835, "step-1": "<mask token>\n\n\ndef convertTime(et):\n \"\"\"'2017-06-01 11:41:53 AM' to '2017-06-01 11:41:53' \"\"\"\n hour = int(et[11:13])\n if et.find('PM') != -1 and hour != 12:\n dateString = et[:10]\n hour = hour + ...
[ 4, 7, 10, 12, 13 ]
from flask import Flask from flask_sqlalchemy import SQLAlchemy from config import config import os db = SQLAlchemy() static_file_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'static') def create_app(config_name): app = Flask(__name__, static_folder=static_file_dir) app.config.from_obje...
normal
{ "blob_id": "bee6ba1db608c1d9c8114f89d4b3abab795a6b86", "index": 3843, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app(config_name):\n app = Flask(__name__, static_folder=static_file_dir)\n app.config.from_object(config[config_name])\n config[config_name].init_app(app)\n fro...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.7 on 2021-03-24 14:51 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Products_Table', fields=[ ('product_id', mo...
normal
{ "blob_id": "90b9dcd2dfc28446d1979d58ed49a12a85ce5b98", "index": 7429, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Tue Jul 18 13:39:05 2017 @author: jaredhaeme15 """ import cv2 import numpy as np from collections import deque import imutils import misc_image_tools frameFileName = r"H:\Summer Research 2017\Whirligig Beetle pictures and videos\large1.mp4" cap = cv2.VideoCapture(r"H:\Summer ...
normal
{ "blob_id": "5ccfad17ede9f685ea9ef9c514c0108a61c2dfd6", "index": 8699, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 1:\n successFlag, frame = cap.read()\n if not successFlag:\n cv2.waitKey(0)\n break\n lower_hsv_thresholdcr = np.array([0, 250, 250])\n upper_hsv_threshold...
[ 0, 1, 2, 3, 4 ]
# put your python code here a = int(input()) b = int(input()) # and i = 1 if a == b: print(a) else: while True: if i // a > 0 and i % a == 0 and i // b > 0 and i % b == 0: print(i) break else: i += 1
normal
{ "blob_id": "af5ebdcd818fdf9c607240733b7b5dbb793cf55e", "index": 7328, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a == b:\n print(a)\nelse:\n while True:\n if i // a > 0 and i % a == 0 and i // b > 0 and i % b == 0:\n print(i)\n break\n else:\n ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'KEY.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_KEY(object): def setupUi(self, KEY): KEY.setObjectName("KEY") ...
normal
{ "blob_id": "1dab0084666588f61d0f9f95f88f06ed9d884e5b", "index": 3892, "step-1": "<mask token>\n\n\nclass Ui_KEY(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_KEY(object):\n\n def setupUi(self, KEY):\n KEY.setObjectName('KEY')\n KEY.resize(419, 106)\n ...
[ 1, 2, 3, 4, 5 ]
import time as t class Record: def __init__(self, value=10, name='name'): self.id = name self.value = value def __get__(self, instance, owner): with open('record.txt', 'a') as f: msg = '读取变量%s ' % self.id tmp = t.localtime()[:6] form = ['年', '月', ...
normal
{ "blob_id": "3e1540a06c478d471f6e6a190cadc44d5c4c2467", "index": 665, "step-1": "<mask token>\n\n\nclass Record:\n\n def __init__(self, value=10, name='name'):\n self.id = name\n self.value = value\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Record:\n\n def __...
[ 2, 3, 4, 5 ]
#!/usr/bin/python #encoding=utf-8 import os, sys rules = { 'E': ['A'], 'A': ['A+M', 'M'], 'M': ['M*P', 'P'], 'P': ['(E)', 'N'], 'N': [str(i) for i in range(10)], } #st为要扫描的字符串 #target为终止状态,即最后的可接受状态 def back(st, target): reduced_sets = set() #cur为当前规约后的字符串,hist为记录的规约规则 def _back(cur, ...
normal
{ "blob_id": "93953f025fed2bcabf29433591689c0a7adf9569", "index": 8757, "step-1": "#!/usr/bin/python\n#encoding=utf-8\n\nimport os, sys\n\nrules = {\n 'E': ['A'],\n 'A': ['A+M', 'M'],\n 'M': ['M*P', 'P'],\n 'P': ['(E)', 'N'],\n 'N': [str(i) for i in range(10)],\n}\n\n#st为要扫描的字符串\n#target为终止状态,即最后的可...
[ 0 ]
from selenium import webdriver driver = webdriver.Chrome() driver.get("http://192.168.1.248:9079/#/") lanuage = driver.find_element_by_class_name("el-dropdown-trigger-text") print(type(lanuage)) print(lanuage.text) try: driver.find_element_by_class_name("el-dropdown-trigger-text").text =="中文" print("符合要求") ...
normal
{ "blob_id": "6a1f58af26bbc4d584ffd699c512ef433ffb80d8", "index": 7206, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('http://192.168.1.248:9079/#/')\n<mask token>\nprint(type(lanuage))\nprint(lanuage.text)\ntry:\n driver.find_element_by_class_name('el-dropdown-trigger-text').text == '中文'\n...
[ 0, 1, 2, 3, 4 ]
# # @lc app=leetcode id=267 lang=python3 # # [267] Palindrome Permutation II # # https://leetcode.com/problems/palindrome-permutation-ii/description/ # # algorithms # Medium (33.28%) # Total Accepted: 24.8K # Total Submissions: 74.4K # Testcase Example: '"aabb"' # # Given a string s, return all the palindromic perm...
normal
{ "blob_id": "4e538251dedfe0b9ffb68de2de7dc50681320f1f", "index": 8619, "step-1": "#\n# @lc app=leetcode id=267 lang=python3\n#\n# [267] Palindrome Permutation II\n#\n# https://leetcode.com/problems/palindrome-permutation-ii/description/\n#\n# algorithms\n# Medium (33.28%)\n# Total Accepted: 24.8K\n# Total Sub...
[ 0 ]
# Generated by Django 3.2.6 on 2021-10-10 17:17 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
normal
{ "blob_id": "8cec6778f530cb06e4f6cb2e6e9b6cb192d20f97", "index": 3280, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python """ demo_mininet_topo.py Sample topology class with Mininet. G = {V, E} V = {h1, h2, h3, h4, h51, h52, s0, s1, s4, s5} # of hosts = 6 # of switches = 4 E = { (h1, s1), (h2, s1), (h3, s1), (h4, s4), (h51, s5), (h52, s5), (s0, s1), (s0, s4), (s5, s4) } """ from mininet.topo import Top...
normal
{ "blob_id": "8c69813bc576a56c25c828fe24e2707e65ac0d0d", "index": 5628, "step-1": "<mask token>\n\n\nclass DemoTopology(Topo):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass DemoTopology(Topo):\n\n def __init__(self):\n Topo.__init__(self)\n h1 = self.h1 = self.addHo...
[ 1, 2, 3, 4, 5 ]
from __future__ import print_function from __future__ import absolute_import from builtins import str from builtins import range from builtins import object import hashlib from xml.sax.saxutils import escape from struct import unpack, pack import textwrap import json from .anconf import warning, error, CONF, enable_c...
normal
{ "blob_id": "2e6f04c3ff3e47a2c3e9f6a7d93e7ce2955a2756", "index": 8354, "step-1": "<mask token>\n\n\nclass SVs(object):\n\n def __init__(self, size, ntuple, buff):\n self.__size = size\n self.__value = ntuple._make(unpack(self.__size, buff))\n\n def _get(self):\n l = []\n for i i...
[ 35, 62, 63, 65, 71 ]
# Named Entity Recognition on Medical Data (BIO Tagging) # Bio-Word2Vec Embeddings Source and Reference: https://github.com/ncbi-nlp/BioWordVec import os import re import torch import pickle from torch import nn from torch import optim import torch.nn.functional as F import numpy as np import random from DNC.dnc imp...
normal
{ "blob_id": "eb99def75404bc3b674bcb633714009149f2d50d", "index": 5097, "step-1": "<mask token>\n\n\nclass task_NER:\n\n def __init__(self):\n self.name = 'NER_task_bio'\n self.controller_size = 128\n self.controller_layers = 1\n self.num_read_heads = 1\n self.num_write_heads...
[ 12, 20, 26, 27, 29 ]
from PIL import Image from src import urbandictionary_api from src.card.cardDrawer import CardDrawer from src.card.cardModel import CardModel from src.repository import Repository from src.urbandictionary_api import get_random_word def save_card(word, image_path, filepath='data/cards/', filename=None): '''Функци...
normal
{ "blob_id": "6bf1d410a33e3b2535e39e4f8c5c7f8278b3de67", "index": 330, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef save_card(word, image_path, filepath='data/cards/', filename=None):\n \"\"\"Функция для генерации и сохранения изображения\n Возвращает filepath+filename\n \n Параметры...
[ 0, 1, 2, 3, 4 ]
import simple_draw as sd import random # sd.resolution = (1400, 900) # Prepare data for the sun function def sun_prepare(xpoint, ypoint, radius, color, angle): delta_list = [] radius_list = [] for delta in range(0, 360, angle): delta_list.append(delta) radius_list.append(random.randint(ra...
normal
{ "blob_id": "46babde9c26a944c9d29121b6bbf89a32f242a81", "index": 251, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sun_prepare(xpoint, ypoint, radius, color, angle):\n delta_list = []\n radius_list = []\n for delta in range(0, 360, angle):\n delta_list.append(delta)\n rad...
[ 0, 1, 2, 3, 4 ]
from pathlib import Path from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session # SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" SQLALCHEMY_DATABASE_URL = f"sqlite:///{Path(__name__).parent.absolute()}/sql_...
normal
{ "blob_id": "0656c3e1d8f84cfb33c4531e41efb4a349d08aac", "index": 6747, "step-1": "<mask token>\n", "step-2": "<mask token>\nBase.metadata.create_all(bind=engine)\n", "step-3": "<mask token>\nSQLALCHEMY_DATABASE_URL = (\n f'sqlite:///{Path(__name__).parent.absolute()}/sql_app.db')\nengine = create_engine(S...
[ 0, 1, 2, 3, 4 ]
class Node: def __init__(self, value, next=None): self.value = value self.next = next def __str__(self): values = [] iter = self while iter != None: values.append(iter.value) iter = iter.next return ' -> '.join(values) @staticmethod ...
normal
{ "blob_id": "599310cfd05be28445535bc72251128ed72a9069", "index": 4372, "step-1": "class Node:\n\n def __init__(self, value, next=None):\n self.value = value\n self.next = next\n <mask token>\n\n @staticmethod\n def makelist(values):\n node = None\n for i in range(len(value...
[ 3, 4, 6, 7 ]
r, n = map(int, input().split()) if r == n: print("too late") else: l = list(range(1, r+1)) for _ in range(n): l.remove(int(input())) print(l[0])
normal
{ "blob_id": "381d3f0890a2916d2e0a21a6a47a5f87afde622d", "index": 9241, "step-1": "<mask token>\n", "step-2": "<mask token>\nif r == n:\n print('too late')\nelse:\n l = list(range(1, r + 1))\n for _ in range(n):\n l.remove(int(input()))\n print(l[0])\n", "step-3": "r, n = map(int, input().s...
[ 0, 1, 2, 3 ]
# Given two binary strings, return their sum (also a binary string). # # For example, # a = "11" # b = "1" # Return "100". # # Show Company Tags # Show Tags # Show Similar Problems class Solution(object): def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str ...
normal
{ "blob_id": "9655cba5b459ae8b6812bcebc31cc46e19e52386", "index": 2741, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def addBinary(self, a, b):\n \"\"\"\n :type a: str\n :type b: str\n :rtype: str\n ...
[ 0, 1, 2, 3 ]
import math import operator as op Symbol = str Number = (int, float) Atom = (Symbol, Number) List = list Exp = (Atom, List) Env = dict def standard_env() -> Env: "An environment with some scheme standard procedures" env = Env() env.update(vars(math)) # sin, cos, sqrt, pi ... env.update({ ...
normal
{ "blob_id": "88862d6bee5d83dd5f1c656a06a9dc46a5254b10", "index": 3608, "step-1": "<mask token>\n\n\ndef standard_env() ->Env:\n \"\"\"An environment with some scheme standard procedures\"\"\"\n env = Env()\n env.update(vars(math))\n env.update({'+': op.add, '-': op.sub, '*': op.mul, '/': op.truediv, ...
[ 5, 7, 8, 9, 10 ]
# coding: utf-8 """ __author__: onur koc """ import numpy as np import matplotlib.pyplot as plt from mpldatacursor import datacursor #optional to annotate any clicked point # ------------ # Input values # ------------ gamma = 23 # Specific weight of the rock mass [kN/m³] H = 270 # Overburden [m] nu ...
normal
{ "blob_id": "f9cc9348d36c131aa3d34e4f78f67b008a1b565a", "index": 7121, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(p_i)):\n if p_i[i] > p_cr:\n x.append(u_ie[i])\n else:\n x.append(u_ip[i])\n<mask token>\nfor i in range(len(x_)):\n if x_[i] < 0:\n x__.a...
[ 0, 1, 2, 3, 4 ]
import cv2 as cv import numpy as np import pytesseract as tes text = get_text_from_image("resizedReceipt.jpg") print(text) def get_text_from_image(imageName): img = preprocess(imageName) result = tes.image_to_string(img) return result def preprocess(image_name): image = cv.imread(image_name) g...
normal
{ "blob_id": "e480136aca96e45cc8a7ca34c1a9d09b96a5a4da", "index": 4152, "step-1": "<mask token>\n\n\ndef get_text_from_image(imageName):\n img = preprocess(imageName)\n result = tes.image_to_string(img)\n return result\n\n\n<mask token>\n\n\ndef find_receipt_box(image):\n \"\"\"\n Finds a contour a...
[ 5, 7, 8, 9, 10 ]
from tkinter import * import psycopg2 import sys import pprint import Base_de_datos import MergeSort class Cliente: def __init__(self,id=None,nombre=None): self.id=id self.nombre=nombre def ingresar(self): self.ventanaIngresar= Toplevel() self.ventanaIngresa...
normal
{ "blob_id": "63d9aa55463123f32fd608ada83e555be4b5fe2c", "index": 6946, "step-1": "<mask token>\n\n\nclass Cliente:\n <mask token>\n <mask token>\n\n def BD(self):\n conectar = Base_de_datos.BaseDeDatos()\n comando = (\"INSERT INTO public.cliente(id, nombre) VALUES('\" + self\n ....
[ 2, 5, 6, 7, 8 ]
from ctypes import CDLL svg2pdf = CDLL("./libsvg2pdf.so") svg2pdf.svg2pdf("report.svg", "teste2.pdf") svg2pdf.svg2pdf2("report.svg", "teste3.pdf")
normal
{ "blob_id": "9c85252b4048b5412978b3ac05cd6dde4479e3bf", "index": 3333, "step-1": "<mask token>\n", "step-2": "<mask token>\nsvg2pdf.svg2pdf('report.svg', 'teste2.pdf')\nsvg2pdf.svg2pdf2('report.svg', 'teste3.pdf')\n", "step-3": "<mask token>\nsvg2pdf = CDLL('./libsvg2pdf.so')\nsvg2pdf.svg2pdf('report.svg', '...
[ 0, 1, 2, 3, 4 ]
def del_ops3(str1, str2): # find all common letters in both strings common1 = [x for x in str1 if x in str2] common2 = [x for x in str2 if x in str1] if len(common2) < len(common1): common1, common2 = common2, common1 # find total of strings with 0, 1, or 2 characters, (2 chars - only if c...
normal
{ "blob_id": "f9d1013fa278b9078e603b012abbdde0be2e0962", "index": 7926, "step-1": "<mask token>\n", "step-2": "def del_ops3(str1, str2):\n common1 = [x for x in str1 if x in str2]\n common2 = [x for x in str2 if x in str1]\n if len(common2) < len(common1):\n common1, common2 = common2, common1\n...
[ 0, 1, 2 ]
marks = { "S":"subject", "O":"object", "A":"attribute", "C":"clause", } marks_reverse = { "subject":"S", "object":"O", "attribute":"A", "clause":"C", }
normal
{ "blob_id": "c66b07c45f4a675a6c7fcec82048a3197910d0d8", "index": 3435, "step-1": "<mask token>\n", "step-2": "marks = {'S': 'subject', 'O': 'object', 'A': 'attribute', 'C': 'clause'}\nmarks_reverse = {'subject': 'S', 'object': 'O', 'attribute': 'A', 'clause': 'C'\n }\n", "step-3": "marks = {\n \"S\":\"...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Tue Apr 24 18:50:16 2018 @author: User """ # -*- coding: utf-8 -*- """ Created on Mon Apr 23 19:05:42 2018 @author: User """ from bs4 import BeautifulSoup import pandas as pd import numpy as np import lxml import html5lib import csv path = 'E:/Data Scienc...
normal
{ "blob_id": "c7768e44464703552f579a1ec68b58fd9746a381", "index": 8743, "step-1": "<mask token>\n", "step-2": "<mask token>\nlen(dfhtml)\ndfhtml\ntype(dfhtml)\n<mask token>\nprint(txtnew)\n<mask token>\nf.writelines(str(txtnew))\nf.close()\n<mask token>\n", "step-3": "<mask token>\npath = (\n 'E:/Data Scie...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hilma import Mesh, loadPly, savePly mesh = Mesh() loadPly("head.ply", mesh) verts = [] faces = [] edges = [] uvs = ...
normal
{ "blob_id": "c02af2ecd980da4ceff133c13072ad7c6b724041", "index": 5329, "step-1": "<mask token>\n", "step-2": "<mask token>\nloadPly('head.ply', mesh)\n<mask token>\nfor v in mesh.getVertices():\n verts.append((v.x, v.y, v.z))\nfor t in mesh.getTrianglesIndices():\n faces.append((t.x, t.y, t.z))\nfor e in...
[ 0, 1, 2, 3, 4 ]
with expression [as var] #...BODY... #object is the result of the expression and must have __enter__ and __exit__ methods #result of the expression must be context manager - implements context management protocol #https://www.python.org/dev/peps/pep-0343/ # This PEP adds a new statement "with" to the Python language...
normal
{ "blob_id": "e1787fd4be66d19ab83ece44eacfd96cb488b504", "index": 722, "step-1": "with expression [as var]\n\t#...BODY...\n\n#object is the result of the expression and must have __enter__ and __exit__ methods\n#result of the expression must be context manager - implements context management protocol\n\n#https://...
[ 0 ]
""" The Snail v 2 "Buy the dips! ... then wait" STRATEGY 1. Selects coins that are X% (percent_below) below their X day (LIMIT) maximum 2. ** NEW ** Finds movement (MOVEMENT) range over X Days - if MOVEMENT* > TAKE_PROFIT coins pass to 3 3. Check coins are not already owned 4. Uses MACD to check if coins are current...
normal
{ "blob_id": "77f94ecd205ae9f240f25d959a6d5cd9cf844d86", "index": 844, "step-1": "<mask token>\n\n\nclass TextColors:\n BUY = '\\x1b[92m'\n WARNING = '\\x1b[93m'\n SELL_LOSS = '\\x1b[91m'\n SELL_PROFIT = '\\x1b[32m'\n DIM = '\\x1b[2m\\x1b[35m'\n DEFAULT = '\\x1b[39m'\n YELLOW = '\\x1b[33m'\n ...
[ 5, 7, 8, 9, 10 ]
import torch import torch.nn as nn from tqdm import tqdm import torch.nn.functional as F import torch.multiprocessing as mp from policy_network import Policy_Network from util import safe_log from util import index2word, rearrange_vector_list, get_num_gpus, set_seed class TestWorker(mp.Process): def __init__(self,...
normal
{ "blob_id": "c7333d838b87d4c275d9dbb6d7e3047c313b4bc0", "index": 9212, "step-1": "<mask token>\n\n\nclass TestWorker(mp.Process):\n <mask token>\n <mask token>\n\n def rollout(self):\n batch_question, batch_question_len, batch_head, batch_answers = (self\n .env.return_batch_data())\n ...
[ 6, 9, 10, 12, 14 ]
def html_print(text, title=''): from IPython.core.display import display, HTML # create title for the content display(HTML("<h4>" + str(title) + "</h4>")) # create content html = display(HTML("<font size=2 face=Verdana>" + text + "</font>")) return html
normal
{ "blob_id": "84a63f60a45f1f8fc1efec8f30345a43c3c30c63", "index": 7332, "step-1": "<mask token>\n", "step-2": "def html_print(text, title=''):\n from IPython.core.display import display, HTML\n display(HTML('<h4>' + str(title) + '</h4>'))\n html = display(HTML('<font size=2 face=Verdana>' + text + '</f...
[ 0, 1, 2 ]
import numpy as np import torch import torch.nn as nn from utils import * from collections import OrderedDict from torchsummary import summary class Model(nn.Module): """Example usage: model = Model() outputs = model(pov_tensor, feat_tensor) """ def __init__(self): super(Model, self).__in...
normal
{ "blob_id": "981cfecdb50b5f3ae326bf3103163f6e814ccc95", "index": 6857, "step-1": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Model(nn.Module):\n <mask token>\n <mask token>\n <mask token>\n\n ...
[ 1, 2, 4, 5, 6 ]
from django.db.models import Count from django.utils.text import slugify from rest_framework.serializers import ModelSerializer, SerializerMethodField, Serializer from rest_framework import serializers from category.models import Category from product.models import Product, GalleryProduct, Stone, Color, Size ...
normal
{ "blob_id": "8be6031caad26ec6b6b99b8d8b8f80d16ad243d4", "index": 7706, "step-1": "<mask token>\n\n\nclass ProductsOrderCartSerializer(ModelSerializer):\n\n\n class Meta:\n model = Product\n fields = ['id', 'title', 'slug', 'image']\n\n\nclass ProductDetailSerializer(TaggitSerializer, ModelSerial...
[ 9, 15, 16, 17, 21 ]
import os if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "day66.settings") import django django.setup() from applistions.models import MyClass,Student,Teacher,Employee from django.db.models import Avg, Sum, Max, Min, Count # 1.求所有人里面工资最高的 ret = Employee.object...
normal
{ "blob_id": "ee72262fb29b46784fb357269dd5160192968c1b", "index": 1713, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'day66.settings')\n import django\n django.setup()\n from applistions.models import MyClass, Stude...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python from django.http import HttpResponse try: import simplejson as json except ImportError: import json from api import * def index(request): data = parse_signed_request(request) if not data.has_key('user_id'): request_url = oauth_request_url() ...
normal
{ "blob_id": "17f76c2b53b36c81cea7f7616859f5257790cd73", "index": 9298, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n data = parse_signed_request(request)\n if not data.has_key('user_id'):\n request_url = oauth_request_url()\n return HttpResponse(\"<script>to...
[ 0, 1, 2, 3, 4 ]
import numpy as np import matplotlib.pyplot as plt x_list = [] y_list = [] file1 = open("pos_data_x.txt", "r") for line in file1: #x_list.append(float(file1.readline(line))) x_list.append(float(line)) file2 = open("pos_data_y.txt", "r") for line in file2: #y_list.append(float(file1.readline(line))) y_list.ap...
normal
{ "blob_id": "d869aa32cb9793ce11a5b6a782cc66c2dd0be309", "index": 6176, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in file1:\n x_list.append(float(line))\n<mask token>\nfor line in file2:\n y_list.append(float(line))\nfile2.close\nfile1.close\n<mask token>\nplt.plot(x_list, y_list, labe...
[ 0, 1, 2, 3, 4 ]
from django_evolution.mutations import ChangeField MUTATIONS = [ ChangeField('ReviewRequest', 'depends_on', initial=None, null=False), ChangeField('ReviewRequestDraft', 'depends_on', initial=None, null=False), ]
normal
{ "blob_id": "286953e381d03c0817d57f9ee4e15f2a0ce808a9", "index": 9776, "step-1": "<mask token>\n", "step-2": "<mask token>\nMUTATIONS = [ChangeField('ReviewRequest', 'depends_on', initial=None, null=\n False), ChangeField('ReviewRequestDraft', 'depends_on', initial=None,\n null=False)]\n", "step-3": "f...
[ 0, 1, 2, 3 ]
from functools import reduce from collections import defaultdict def memory(count: int, start_numbers: list): numbers = defaultdict(lambda: tuple(2 * [None]), { el: (idx,None ) for idx,el in enumerate(start_numbers) }) last = start_numbers[-1] for idx in range(len(numbers), count): last = 0 if None...
normal
{ "blob_id": "0f0adde7241898d2efe7e2b5cc218e42ed7b73d8", "index": 5475, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef memory(count: int, start_numbers: list):\n numbers = defaultdict(lambda : tuple(2 * [None]), {el: (idx, None) for \n idx, el in enumerate(start_numbers)})\n last = st...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # 导入包 import matplotlib.pyplot as plt import numpy as np # 显示中文和显示负号 plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False # X轴和Y轴数据,票房单位亿 a = ["战狼2","速度与激情8","功夫瑜伽","西游伏妖篇","变形金刚5:最后的骑士","摔跤吧!爸爸","加勒比海盗5:死无对证","金刚:骷髅岛","极限特工:终极回归","生化危机6:终章","乘风破浪","神偷奶爸3","...
normal
{ "blob_id": "16d86c48c45ab0441046e968ea364d27f6dcfd12", "index": 3066, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure(figsize=(20, 8), dpi=128)\nplt.barh(a, b, height=0.5, color='red')\nplt.title('2018年电影票房纪录', fontsize=24)\nplt.xlabel('票房(亿元)', fontsize=14)\n<mask token>\nplt.xticks(my_x_tick...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 """Advent of Code 2018, Day 7""" import networkx import re G = networkx.DiGraph() with open("puzzle_input") as f: for line in f.read().split("\n"): match = re.search("Step (?P<pre>[A-Z]).*step (?P<post>[A-Z])", line) G.add_edge(match.group("pre"), match.group("post")) def part_one...
normal
{ "blob_id": "1c5884c10ac0b6a3335f8e677007fc52311245e2", "index": 7603, "step-1": "<mask token>\n\n\ndef part_one():\n \"\"\"Solution to Part 1\"\"\"\n return ''.join(networkx.lexicographical_topological_sort(G))\n\n\ndef part_two():\n \"\"\"Solution to Part 2\"\"\"\n tasks = {}\n current_time = 0\...
[ 2, 3, 4, 5, 6 ]
''' Created on 5 Mar 2010 @author: oppianmatt ''' # hook to find setup tools if not installed try: from ez_setup import use_setuptools use_setuptools() except ImportError: pass from setuptools import setup, find_packages setup( name = "django-defaultsite", version = "1.1", packages = find_pac...
normal
{ "blob_id": "5580e5942370c925b759b09675306cdfbc7dd4f1", "index": 3633, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n from ez_setup import use_setuptools\n use_setuptools()\nexcept ImportError:\n pass\n<mask token>\nsetup(name='django-defaultsite', version='1.1', packages=find_packages(\n...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python """ Load API client for a Tool Registry Service (TRS) endpoint based either on the GA4GH specification or an existing client library. """ import logging from bravado.requests_client import RequestsClient from ga4ghtest.core.config import trs_config from .client import TRSClient logger = logging...
normal
{ "blob_id": "d122267e1da2d9cf68d245148bb496dfba3e7d19", "index": 4467, "step-1": "<mask token>\n\n\nclass TRSInterface:\n\n def toolsGet(self):\n raise NotImplementedError\n\n def metadataGet(self):\n raise NotImplementedError\n <mask token>\n <mask token>\n <mask token>\n <mask t...
[ 18, 21, 24, 27, 30 ]
from setuptools import setup, find_packages setup( name='spt_compute', version='2.0.1', description='Computational framework for the Streamflow Prediciton Tool', long_description='Computational framework to ingest ECMWF ensemble runoff forcasts ' ' or otherLand Surface Model foreca...
normal
{ "blob_id": "53b6d30bf52c43daaebe8158002db1072e34f127", "index": 7956, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='spt_compute', version='2.0.1', description=\n 'Computational framework for the Streamflow Prediciton Tool',\n long_description=\n \"Computational framework to ingest ...
[ 0, 1, 2, 3 ]
import sys from elftools.elf.elffile import ELFFile from capstone import * def process_file(filename): with open(filename, 'rb') as f: elffile = ELFFile(f) code = elffile.get_section_by_name('.text') rodata = elffile.get_section_by_name('.rodata') plt = elffile.get_section_by_name('...
normal
{ "blob_id": "5bfaadcd54aaf239d0d89158bfb723c0174c56b1", "index": 9176, "step-1": "import sys\nfrom elftools.elf.elffile import ELFFile\nfrom capstone import *\n\ndef process_file(filename):\n with open(filename, 'rb') as f:\n elffile = ELFFile(f)\n code = elffile.get_section_by_name('.text')\n ...
[ 0 ]
# Procedures for automatic COBD calculation. # The useful ones are: # - get_heuristic4_OBD() as a heuristic one [the only heuristic one here that does not miss-out solutions] # - getOBD2plus4() as the fastest exhaustive one [uses two filtering techniques for early detection of graphs without an OBD] import itertool...
normal
{ "blob_id": "51711c9293f8b5d9dc4d299569da04e2d1bc0064", "index": 1982, "step-1": "\n\n# Procedures for automatic COBD calculation.\n# The useful ones are:\n# - get_heuristic4_OBD() as a heuristic one [the only heuristic one here that does not miss-out solutions]\n# - getOBD2plus4() as the fastest exhaustive one...
[ 0 ]
# -*- coding:utf-8 -*- # author:Kyseng # file: cRandomString.py # time: 2018/11/8 11:41 PM # functhion: import random import sys reload(sys) sys.setdefaultencoding('utf-8') class cRandomString(): @staticmethod def RandomTitle(name): # name = name.decode('utf8') # print name platform =...
normal
{ "blob_id": "ed02cbf3ebef307d6209004e1e388312bfda0b50", "index": 2027, "step-1": "<mask token>\n\n\nclass cRandomString:\n\n @staticmethod\n def RandomTitle(name):\n platform = ['PS4', 'XBOX', 'PC', 'NS', 'IOS']\n random.shuffle(platform)\n platform = '/'.join(platform)\n firstW...
[ 3, 4, 5, 6, 7 ]
import unittest from common.ReqLogin import req import os import yaml from common import util from TestCase.runnerBase import TestInterfaceCase import paramunittest PATH = lambda p: os.path.abspath( os.path.join(os.path.dirname(__file__), p) ) def getYam(homeyaml): try: with open(homeyaml, encoding='ut...
normal
{ "blob_id": "aea196566bbbe9d37bf03b9b17a4062659a27bb6", "index": 1446, "step-1": "<mask token>\n\n\nclass UserinfoTest(TestInterfaceCase):\n\n def setUp(self):\n login = req.reqData(req)\n self.infoma = {}\n self.response = ''\n self.infoma['id'] = x['testinfo'][0]['id']\n s...
[ 10, 11, 13, 15, 17 ]
import matplotlib.pyplot as plt import matplotlib import numpy as np from PIL import Image from scipy.misc import imsave, imread def plots(epochs, train_acc, test_acc, train_loss, test_loss, train_error, test_error,filename): plt.style.use('bmh') fig=plt.figure(figsize=(8,6)) plt.plot(epochs,train_acc, ...
normal
{ "blob_id": "93150eb1c6746e2b1967eb5305fa526ae36968fd", "index": 2003, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef write_csv(filename, train_acc, test_acc, train_loss, test_loss,\n train_error, test_error, epoch):\n if epoch == 0:\n with open(filename, 'w') as f:\n f.wr...
[ 0, 1, 2, 3, 4 ]
import random def less(i1, i2): return i1[0] * i2[1] < i2[0] * i1[1] def equal(i1, i2): return i1[0] * i2[1] == i2[0] * i1[1] def more(i1, i2): return i1[0] * i2[1] > i2[0] * i1[1] def partition(x, l, r, pivot): il = l ir = l for i in range(l, r): if x[i] < pivot and ir < r: ...
normal
{ "blob_id": "a5e693a79211570f2d27575657496992f8fee164", "index": 9075, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef less(i1, i2):\n return i1[0] * i2[1] < i2[0] * i1[1]\n\n\ndef equal(i1, i2):\n return i1[0] * i2[1] == i2[0] * i1[1]\n\n\ndef more(i1, i2):\n return i1[0] * i2[1] > i2[0]...
[ 0, 5, 7, 8, 9 ]
import tkinter as tk import random import numpy as np import copy import time ################################################################################# # # Données de partie NbSimulation = 20000 Data = [ [1,1,1,1,1,1,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,0...
normal
{ "blob_id": "86177dfa9b8bed5916703edcc16ea4d01cbabf84", "index": 3278, "step-1": "<mask token>\n\n\nclass Game:\n\n def __init__(self, Grille, PlayerX, PlayerY, Score=0):\n self.PlayerX = PlayerX\n self.PlayerY = PlayerY\n self.Score = Score\n self.Grille = Grille\n\n def copy(s...
[ 8, 11, 14, 15, 17 ]
import hashlib import sys def getHashcode(string): for i in range(10000000000): hash_md5 = hashlib.md5(str(i).encode('utf-8')) res = hash_md5.hexdigest() if res[0:len(string)] == string: print(i) exit() if __name__ == '__main__': getHashcode(sys.argv[1])
normal
{ "blob_id": "4c8e3c21dd478606cf09f2e97dc9deed6597dae5", "index": 4375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getHashcode(string):\n for i in range(10000000000):\n hash_md5 = hashlib.md5(str(i).encode('utf-8'))\n res = hash_md5.hexdigest()\n if res[0:len(string)] =...
[ 0, 1, 2, 3 ]
l = int(input("Enter lower range: ")) u = int(input("Enter upper range: ")) if(l<=0): print "invalid" if (u<=0): print "invalid" for num in range(l,u+1): n = len(str(num)) sum = 0 temp = num while temp > 0: digit = temp % 10 sum += digit ** n ...
normal
{ "blob_id": "42fa0aa98e2d3336bdb56cba97596d8532d46cb4", "index": 2896, "step-1": "l = int(input(\"Enter lower range: \"))\nu = int(input(\"Enter upper range: \"))\nif(l<=0):\n print \"invalid\"\nif (u<=0):\n print \"invalid\"\n for num in range(l,u+1):\n n = len(str(num))\n sum = 0\n ...
[ 0 ]
#!/usr/local/bin/python ''' side_on.py Open a 3d trajectory file (x y z) and produce a side-on plot of the y-z plane, with straight line between start and end and a virtual wall superimposed at 10 yards. arg1 = infile arg2 = optional outfile ''' import sys import matplotlib.pyplot as plt infile...
normal
{ "blob_id": "146aca6c7da17ddccb815638292cbcdda66f28e6", "index": 7035, "step-1": "#!/usr/local/bin/python\n\n''' side_on.py\n\n Open a 3d trajectory file (x y z) and produce a side-on plot of the\n y-z plane, with straight line between start and end and a virtual\n wall superimposed at 10 yards.\n\n ...
[ 0 ]
import time import ephem import serial import nmea import orientation import sys import threading from geomag import geomag #Constants initial_az = 180 initial_alt = 90 min_elevation = 10.0 sleep_time = 1.0 unwind_threshold = 180 sleep_on_unwind = 45.0 last_lon = '-88.787' last_lat = '41.355' last_heading = 0.0 moun...
normal
{ "blob_id": "468b5bd8d7b045ca8dd46c76a1829fc499e16950", "index": 5756, "step-1": "<mask token>\n\n\nclass SerialTester:\n\n def write(self, line):\n print(line)\n\n def read(self, num):\n return\n\n\nclass Antenna:\n azimuth = initial_az\n altitude = initial_alt\n parked = True\n\n ...
[ 15, 18, 21, 25, 26 ]
import numpy as np import matplotlib.pyplot as plt import sympy as sp import matplotlib.pyplot as plt from sympy import sympify, Symbol curr_pos = 0 import numpy as np def bisection(st,maxnum,maxer,xlf,xuf): file2 = open("test.txt","w") file2.write("Hello World") file2.close() fi = open("test.txt", "w") x...
normal
{ "blob_id": "a1c1f18e7b95f36a214a1a16f2434be2825829c3", "index": 3110, "step-1": "<mask token>\n\n\ndef bisection(st, maxnum, maxer, xlf, xuf):\n file2 = open('test.txt', 'w')\n file2.write('Hello World')\n file2.close()\n fi = open('test.txt', 'w')\n x = sp.Symbol('x')\n y = sp.Symbol('y')\n ...
[ 1, 2, 3, 4, 5 ]
# Set up path references and dependencies. import os, sys, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) sys.path.append(os.path.join(parentdir, "utils")) # Import important helper libraries. from fla...
normal
{ "blob_id": "7d099012584b84e9767bf0ce9d9df1596ca3bbab", "index": 542, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n result_plot = compute_model_output()\n return render_template('index.html', graphJSON=result_plot)\n\n\ndef compute_model_output():\n num_steps = 500\n init_inf = 5\n ...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 2.2.2 on 2019-07-09 20:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0015_auto_20190709_1543'), ] operations = [ migrations.CreateModel( name='ExampleModel', fields=[ ...
normal
{ "blob_id": "d6e06a78c9a5d8184e5adf9b99cc6030c3434558", "index": 8464, "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 = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
from emulator import Emulator from device import Device from devices.compactflash import CompactFlash from devices.mc68681 import MC68681 from musashi import m68k def add_arguments(parser): parser.add_argument('--rom', type=str, help='ROM image') parser.add_argu...
normal
{ "blob_id": "9eef202a42bfc10b2f52d1b9153d664c5046c13f", "index": 1965, "step-1": "<mask token>\n\n\nclass CB030Ticker(Device):\n\n def __init__(self, args, **options):\n super().__init__(args=args, name='CB030Ticker', required_options=[\n 'address'], **options)\n self.size = 4096\n ...
[ 7, 11, 13, 14, 15 ]
from robot.libraries.BuiltIn import BuiltIn from RoboGalaxyLibrary.utilitylib import logging as logger import re def block_no_keyword_warn(): pass class Compare_hpMCTP(object): def __init__(self): self.fusionlib = BuiltIn().get_library_instance('FusionLibrary') def do(self, expect, actual, ver...
normal
{ "blob_id": "17ba6aaa9009c258136b184ca6a8660cec1cfe40", "index": 3752, "step-1": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Compare_hpMCTP(object):\n <mask token>\n\n def do(self, expect, actual, verbose=False):\n\n d...
[ 1, 2, 4, 5, 6 ]
import json import time from typing import Dict import threading """ Note: każdy request uruchamia osobny wątek. Przegląd: `top -H -p <process_id>` """ from flask import Flask, jsonify, request app = Flask(__name__) # https://www.tutorialspoint.com/flask/flask_http_methods.htm # ładowanie konfiguracji aplika...
normal
{ "blob_id": "8fcc2a13fd5a803e2d755a567c78c8274bd88aad", "index": 7283, "step-1": "<mask token>\n\n\nclass Auth:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/welcome/<username>/suffix/<message>')\ndef welcome(username, message):\n return jsonify({'comment': f'Hello {usern...
[ 1, 3, 6, 9, 10 ]
import cv2 as cv '''色彩空间介绍''' ''' RGB:对于RGB的色彩空间是立方体的色彩空间 三通道 红 黄 蓝 每个灰度级为255 HSV:对于HSV的色彩空间是255度的圆柱体 三通道 高度 圆心角 半径分别是255 HIS YCrCb YUV ''' '''常用的色彩空间转换函数***cvtColor''' def colorSpaceConvert(image): '''转换到灰度空间''' res = cv.cvtColor(image, cv.COLOR_BGR2GRAY) cv.imshow("gray", res) '''转换到HSV色彩空间''' r...
normal
{ "blob_id": "6d359d987c50fd0d5e963d467a379eb245e3eb40", "index": 3756, "step-1": "<mask token>\n\n\ndef colorSpaceConvert(image):\n \"\"\"转换到灰度空间\"\"\"\n res = cv.cvtColor(image, cv.COLOR_BGR2GRAY)\n cv.imshow('gray', res)\n \"\"\"转换到HSV色彩空间\"\"\"\n res = cv.cvtColor(image, cv.COLOR_BGR2HSV)\n ...
[ 1, 2, 3, 4, 5 ]
import re import numpy as np # only read pgm file def readfile(filename:str)->tuple: '''read given pgm file''' col = 0 row = 0 lst = list() with open(filename, 'rb') as file: header = list() ls = list() # remove first line header.append((file.readline()).decode("utf-...
normal
{ "blob_id": "63be96c0d1231f836bbec9ce93f06bda32775511", "index": 2259, "step-1": "<mask token>\n\n\ndef convert(lst: list) ->list():\n \"\"\"String Unicode to int\"\"\"\n l = list()\n for item in lst:\n l.append(ord(item))\n return l\n\n\n<mask token>\n\n\ndef write(filename: str, data: list, ...
[ 2, 3, 4, 5, 6 ]
# python examples/mnist_rnn.py --bsz 128 --bsz-eval 256 import sys from argparse import ArgumentParser import pytorch_lightning as pl import torch.nn as nn import torch.optim as optim from loguru import logger from slp.config.config_parser import make_cli_parser, parse_config from slp.data.collators import SequenceCl...
normal
{ "blob_id": "d8a09f9952856da69120fae6221636dd5bd8c93e", "index": 3567, "step-1": "<mask token>\n\n\nclass Net(nn.Module):\n\n def __init__(self, input_size, hidden_size=40, num_classes=10,\n bidirectional=False):\n super().__init__()\n self.encoder = RNN(input_size, hidden_size, bidirecti...
[ 4, 5, 6, 7, 9 ]
from django.urls import path from .views import PollsList, SinglePollsView, PollsCreate, PollsAnswer app_name = "authors" # app_name will help us do a reverse look-up latter. urlpatterns = [ path('polls/', PollsList.as_view()), path('polls/create', PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsV...
normal
{ "blob_id": "64ac007faeebe0e71ba0060e74fa07154e6291e2", "index": 6053, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'authors'\nurlpatterns = [path('polls/', PollsList.as_view()), path('polls/create',\n PollsCreate.as_view()), path('polls/<int:pk>', SinglePollsView.as_view(\n )), path('...
[ 0, 1, 2, 3 ]
""" This example shows how to communicate with a SH05 (shutter) connected to a KSC101 (KCube Solenoid). """ # this "if" statement is used so that Sphinx does not execute this script when the docs are being built if __name__ == '__main__': import os import time from msl.equipment import EquipmentRecord, Co...
normal
{ "blob_id": "04b5df5cfd052390f057c6f13b2e21d27bac6449", "index": 943, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n import os\n import time\n from msl.equipment import EquipmentRecord, ConnectionRecord, Backend\n from msl.equipment.resources.thorlabs import Motio...
[ 0, 1, 2 ]
""" Copyright (c) 2007 by the Pallets team. Some 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 above copyright notice, this list of conditions and the f...
normal
{ "blob_id": "53cd9d5a79e97bb1af69446a82c747248c3cc298", "index": 1367, "step-1": "<mask token>\n\n\ndef _get_headers(environ):\n \"\"\"\n Returns only proper HTTP headers.\n \"\"\"\n for key, value in iteritems(environ):\n key = str(key)\n if key.startswith('HTTP_') and key not in ('HTT...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python """ Otsu method for automatic estimation of $T$ threshold value - assumes two maxima of grayscale histogram & searches for optimal separation Parameters Usage Example $ python <scriptname>.py --image ../img/<filename>.png ## Explain """ import numpy as np import argparse import mahota...
normal
{ "blob_id": "0547751af7bbac42351476dde591d13d40fb37eb", "index": 7811, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n ap = argparse.ArgumentParser()\n ap.add_argument('-i', '--image', required=True, help='Path to the image')\n args = vars(ap.parse_args())\n image = cv2.imrea...
[ 0, 1, 2, 3, 4 ]
from abc import abstractmethod class Environment: @abstractmethod def __init__(self, agent): pass @abstractmethod def execute_step(self, n=1): pass @abstractmethod def execute_all(self): pass @abstractmethod def set_delay(self, delay): pass
normal
{ "blob_id": "8698aedc5c8671f46c73898a7188440254b79bbf", "index": 307, "step-1": "<mask token>\n\n\nclass Environment:\n\n @abstractmethod\n def __init__(self, agent):\n pass\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Environment:\n\n @abstractme...
[ 2, 4, 5, 6 ]
# Generated by Django 2.1.7 on 2020-01-09 08:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('goods', '0004_auto_20200109_0713'), ] operations = [ migrations.AlterField( model_name='banner', name='show_type', ...
normal
{ "blob_id": "b7687240413441e1d3ed0085e5953f8089cbf4c9", "index": 9303, "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 = [('goods', '00...
[ 0, 1, 2, 3, 4 ]
from __future__ import print_function import os import re import xml.etree.ElementTree as ET def read_vivado_report(hls_dir, full_report=False): if not os.path.exists(hls_dir): print('Path {} does not exist. Exiting.'.format(hls_dir)) return prj_dir = None top_func_name = None if os.p...
normal
{ "blob_id": "7d173b0571c20dc8fcae884451e8f69ba3a05763", "index": 8087, "step-1": "<mask token>\n\n\ndef read_vivado_report(hls_dir, full_report=False):\n if not os.path.exists(hls_dir):\n print('Path {} does not exist. Exiting.'.format(hls_dir))\n return\n prj_dir = None\n top_func_name = ...
[ 4, 5, 6, 7, 8 ]
import re APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+\s[+\-]\d{4})\] "(\S+) (\S+)\s*(\S*)" (\d{3}) (\S+)' pattern = re.compile(APACHE_ACCESS_LOG_PATTERN) print re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)
normal
{ "blob_id": "0abba9fdd98d6bb5c706b82a01a267dbcefbba28", "index": 4562, "step-1": "import re\nAPACHE_ACCESS_LOG_PATTERN = '^(\\S+) (\\S+) (\\S+) \\[([\\w:/]+\\s[+\\-]\\d{4})\\] \"(\\S+) (\\S+)\\s*(\\S*)\" (\\d{3}) (\\S+)'\npattern = re.compile(APACHE_ACCESS_LOG_PATTERN)\nprint re.match('ix-sac6-20.ix.netcom.com -...
[ 0 ]
#!/usr/bin/python3 """display your id from github. """ from sys import argv import requests if __name__ == "__main__": get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2])).json().get('id') print(get)
normal
{ "blob_id": "8280f321b102cace462761f9ece2aebf9e28a432", "index": 3941, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2])\n ).json().get('id')\n print(get)\n", "step-3": "<mask token>\nfrom s...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ @File : densenet_block.py @Time : 12/11/20 9:59 PM @Author : Mingqiang Ning @Email : ningmq_cv@foxmail.com @Modify Time @Version @Description ------------ -------- ----------- 12/11/20 9:59 PM 1.0 None # @Software: PyCharm """ import torch from torch...
normal
{ "blob_id": "c2ba18062b8555c77b329718ec1f2ae7f326c78e", "index": 1988, "step-1": "<mask token>\n\n\nclass DenseBlock(nn.Module):\n <mask token>\n\n def forward(self, x):\n out = self.denseblock(x)\n return out\n", "step-2": "<mask token>\n\n\nclass BottleNeck(nn.Module):\n <mask token>\n...
[ 2, 5, 6, 7, 8 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2017--2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not # use this file except in compliance with the License. A copy of the License # is located at # # http://aws....
normal
{ "blob_id": "8adcd75e925fe0c5a50b2fc7dc8c472a9610b4f2", "index": 9575, "step-1": "<mask token>\n\n\ndef smart_open(file, mode='rt', encoding='utf-8'):\n \"\"\"Convenience function for reading compressed or plain text files.\n :param file: The file to read.\n :param mode: The file mode (read, write).\n ...
[ 27, 29, 31, 37, 42 ]
class BinarySearchTreeNode: def __init__(self, node_data): self.data = node_data self.left = None self.right = None def bst_contains(root: BinarySearchTreeNode, number): if root is None: return 0 if(root.data == number): return 1 elif(root.data < number): ...
normal
{ "blob_id": "3bdf3a48451b83347a6c9a9851b5b85b608f0b63", "index": 2826, "step-1": "<mask token>\n", "step-2": "class BinarySearchTreeNode:\n <mask token>\n\n\n<mask token>\n", "step-3": "class BinarySearchTreeNode:\n\n def __init__(self, node_data):\n self.data = node_data\n self.left = No...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- from odoo import api, models, fields, _ class hrsalaryRule(models.Model): _inherit = "hr.salary.rule" is_tax_fdfp = fields.Boolean("Est un impôt FDFP")
normal
{ "blob_id": "097a87f7f1346e5db1599e59680232912348aef7", "index": 311, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass hrsalaryRule(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass hrsalaryRule(models.Model):\n _inherit = 'hr.salary.rule'\n is_tax_...
[ 0, 1, 2, 3, 4 ]
from concurrent import futures import time import math import logging import grpc import tensorflow as tf from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis import prediction_service_pb2_grpc import sys sys.path.append('/home/yitao/Documents/fun-project/tensorflow-related/miniature-winner/')...
normal
{ "blob_id": "0ec5d6ce11851a577046cf73cf98c91b6dfb9f67", "index": 1550, "step-1": "<mask token>\n\n\ndef worker():\n display_subtitle = ''\n while True:\n item = q.get()\n image = np.zeros((480, 640))\n if item is not None:\n vertices = item\n show_img = plot_verti...
[ 3, 5, 6, 7, 8 ]
import csv as csv import hashlib from sets import Set def func_hash(parameter): hash_object = hashlib.sha384(parameter) table_hash = hash_object.hexdigest() return table_hash def myFunk(): with open('users.csv', 'w') as fp: a = csv.writer(fp, delimiter=',') roles = ['inspector', 'admin'] d...
normal
{ "blob_id": "96d13a883590ca969e997bbb27bcdbee1b24252f", "index": 2730, "step-1": "<mask token>\n\n\ndef myFunk():\n with open('users.csv', 'w') as fp:\n a = csv.writer(fp, delimiter=',')\n roles = ['inspector', 'admin']\n data = [['Userneme', 'hash_password', 'role'], ['Olya', func_hash(\...
[ 1, 2, 3, 4, 5 ]
import pymongo import pandas as pd import re from pymongo import MongoClient from nltk.corpus import stopwords from nltk import word_tokenize from gensim import corpora import pickle client = MongoClient() db = client.redditCrawler collection = db.data_test1 def remove_posts(data, index_list): data = data.drop(i...
normal
{ "blob_id": "341fb4442ba1d1bb13dbbe123e1051e1ceeb91e7", "index": 4431, "step-1": "<mask token>\n\n\ndef remove_posts(data, index_list):\n data = data.drop(index_list)\n return data.reset_index(drop=True)\n\n\n<mask token>\n\n\ndef preprocess(text):\n text = text.lower()\n text = text.replace('$', ' '...
[ 3, 4, 5, 6, 7 ]
# Comic Downloader #! python3 import urllib, bs4, requests url = 'http://explosm.net/comics/39/' base_url = 'http://explosm.net' for i in range(1,4000): req = requests.get(url) req.raise_for_status() soup = bs4.BeautifulSoup(req.text, "lxml") comic = soup.select('#main-comic') comicUrl = 'http:'...
normal
{ "blob_id": "66e77b8237850a29127402310bfab3061f7ebca4", "index": 2346, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, 4000):\n req = requests.get(url)\n req.raise_for_status()\n soup = bs4.BeautifulSoup(req.text, 'lxml')\n comic = soup.select('#main-comic')\n comicUrl = '...
[ 0, 1, 2, 3, 4 ]
""" @File : jump.py @copyright : GG @Coder: Leslie_s @Date: 2020/1/26 """ import requests from lxml import html import pandas as pd import time import pandas as pd import datetime import re import json headers = { 'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,appl...
normal
{ "blob_id": "5aecd021297fee4407d6b529c24afb3c6398f7ba", "index": 7205, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in r:\n print(i.group(1))\n provinceName = i.group(1)\n provinceShortName = i.group(2)\n confirmedCount = i.group(3)\n iter_dict.setdefault(provinceShortName, confirm...
[ 0, 1, 2, 3, 4 ]
import re, glob, os lst = [] def rename(dir, pattern, titlePattern): for pathAndFilename in glob.iglob(os.path.join(dir, pattern)): title, ext = os.path.splitext(os.path.basename(pathAndFilename)) #title = title[22:] #hexa = [] #hexb = [] hexa = title[:2] hexb = title...
normal
{ "blob_id": "22aa6042b77c3cfd1f102a0ea22a43223e366d2f", "index": 1476, "step-1": "<mask token>\n\n\ndef rename(dir, pattern, titlePattern):\n for pathAndFilename in glob.iglob(os.path.join(dir, pattern)):\n title, ext = os.path.splitext(os.path.basename(pathAndFilename))\n hexa = title[:2]\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Mar 11 13:25:03 2020 @author: Dr. Michael Sigmond, Canadian Centre for Climate Modelling and Analysis """ import matplotlib.colors as col import matplotlib.cm as cm import numpy as np def register_cccmacms(cmap='all'): """create my ...
normal
{ "blob_id": "31a5bf0b275238e651dcb93ce80446a49a4edcf4", "index": 6561, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_cccmacms(cmap='all'):\n \"\"\"create my personal colormaps with discrete colors and register them.\n \n \n default is to register all of them. can also specif...
[ 0, 1, 2, 3, 4 ]
import urllib from django.shortcuts import render, redirect, get_object_or_404 from django.contrib import messages from django.utils.translation import gettext as _ from .forms import CountryForm from .models import Countries from django.utils.timezone import datetime from django.contrib.auth.decorators import login_re...
normal
{ "blob_id": "8640de519ebf7f95588ac40b55662da85ffc926e", "index": 5224, "step-1": "<mask token>\n\n\n@login_required(login_url='user_login')\ndef countries_add(request):\n if request.method == 'POST':\n form = CountryForm(request.POST or None)\n if form.is_valid():\n form.save()\n ...
[ 2, 4, 5, 6, 7 ]
import nevergrad as ng import numpy as np import torch from pix2latent.utils.image import binarize class _BaseNevergradOptimizer(): """ Base template for NeverGrad optimization. Should be used jointly with BaseOptimizer. For full list of available optimizers > https://github.com...
normal
{ "blob_id": "4a136a6284add3bcbd7f9546e18e79151cea685f", "index": 623, "step-1": "<mask token>\n\n\nclass _BaseNevergradOptimizer:\n <mask token>\n\n def __init__(self, method):\n self.method = method\n self.valid_methods = [x[0] for x in ng.optimizers.registry.items()]\n self.sequentia...
[ 3, 4, 5, 6, 8 ]
# Patrick Vanegas - Final project from tkinter import * import frequency import turtle import math import random # intitalize a blank window root = Tk() # initialize turtle window window = turtle.Screen() # Create widgets to be viewed on the Tkinter window label_1 = Label(root, text = "Enter a number less than 5...
normal
{ "blob_id": "0ac99816248e3306ca6340f7bee8a518877bc3e9", "index": 1186, "step-1": "<mask token>\n\n\ndef drawPieChart(central_angles, angle_of_rest, probability_of_rest):\n turtle.reset()\n window.colormode(255)\n turtle.fillcolor('gray')\n turtle.speed(10)\n turtle.begin_fill()\n turtle.circle(...
[ 2, 3, 4, 5, 6 ]
import os, glob import numpy as np from ..algorithms.utils import get_file_manager from ..algorithms.clustered_writes import * from ..exp_utils import create_empty_dir def test_get_entity_sizes(): # in C order bytes_per_voxel = 1 R = (10,9,10) cs = (5,3,2) partition = (2,3,5) bs, brs, bss = g...
normal
{ "blob_id": "6dd11f71e514a46462bf0b97ddac9ea474e86ad0", "index": 366, "step-1": "<mask token>\n\n\ndef test_get_strategy():\n bytes_per_voxel = 1\n R = 20, 9, 10\n cs = 5, 3, 2\n partition = 4, 3, 5\n bs, brs, bss = get_entity_sizes(cs, bytes_per_voxel, partition)\n test_case = {(5 * 2 * 3): 0,...
[ 1, 3, 4, 5, 6 ]
import os from app_web import sg from sendgrid.helpers.mail import * import pdfkit from models.user import User from models.expense import Expense from models.statement import Statement from models.category import Category import tempfile import subprocess from .aws_uploader import upload_image_to_s3 import datetime fr...
normal
{ "blob_id": "55df8d13ddf28f7b0477329bee743471a0780f24", "index": 3253, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_statement(month=None):\n\n def _get_pdfkit_config():\n if os.getenv('FLASK_ENV') == 'production':\n WKHTMLTOPDF_CMD = subprocess.Popen(['which', os.env...
[ 0, 1, 2, 3 ]