code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
# -*- coding=utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
normal
{ "blob_id": "f3da38f2c4fda0a1d54e79c2c21070f98002b88d", "index": 3351, "step-1": "<mask token>\n\n\nclass CityscapesTestConfig(CityscapesCommonConfig):\n <mask token>\n batch_size = 1\n list_path = 'val.txt'\n\n @classmethod\n def rules(cls):\n \"\"\"Return rules for checking.\"\"\"\n ...
[ 8, 18, 19, 21, 23 ]
from skimage.measure import structural_similarity as ssim import matplotlib.pyplot as plt import numpy as np import cv2 import os import pathlib import warnings from PIL import Image from numpy import array source_path = "/home/justin/Desktop/FeatureClustering/" feature_length = len(os.listdir(source_path)) vector_da...
normal
{ "blob_id": "ff1346060141ee3504aa5ee9de3a6ec196bcc216", "index": 3918, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor folder in os.listdir(source_path):\n for filename in os.listdir(source_path + folder + '/'):\n if filename != '---.png':\n linename = filename.split('-')\n ...
[ 0, 1, 2, 3, 4 ]
# Uses python3 from decimal import Decimal def gcd_naive(a, b): x = 5 while x > 1: if a % b != 0: c = a % b a = b b = c else: x = 1 return b there = input() store = there.split() a = int(max(store)) b = int(min(store)) factor = gcd_naive(a,b) ...
normal
{ "blob_id": "c70681f5ff8d49a243b7d26164aa5430739354f4", "index": 6936, "step-1": "<mask token>\n\n\ndef gcd_naive(a, b):\n x = 5\n while x > 1:\n if a % b != 0:\n c = a % b\n a = b\n b = c\n else:\n x = 1\n return b\n\n\n<mask token>\n", "step-...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python3 ################################################### ### Euler project ### zdrassvouitie @ 10/2016 ################################################### file_name = '013_largeSum_data' tot = 0 with open(file_name, "r") as f: stop = 1 while stop != 0: line = f.readline() if len(...
normal
{ "blob_id": "bcdf1c03d996520f3d4d8d12ec4ef34ea63ef3cf", "index": 3936, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(file_name, 'r') as f:\n stop = 1\n while stop != 0:\n line = f.readline()\n if len(line) < 1:\n break\n tot += float(line)\nprint(tot)\n", ...
[ 0, 1, 2, 3 ]
from auth_passwordreset_reset import auth_passwordreset_reset from auth_register import auth_register from data import * import pytest #invalid reset code def test_auth_passwordreset_reset1(): #create a test account register = auth_register("Someemial@hotmail.com.au", "Hello123", "First", "Last") ...
normal
{ "blob_id": "a315d01f0fb16f0c74c447c07b76f33e6ff6427d", "index": 9742, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_auth_passwordreset_reset1():\n register = auth_register('Someemial@hotmail.com.au', 'Hello123',\n 'First', 'Last')\n auth_passwordreset_request('Someemial@hotmai...
[ 0, 2, 3, 4, 5 ]
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as tick from statistics import mean from tqdm import tqdm import multiprocessing as mp from . import model as dymod class Filter: """誤ベクトル数の確認,誤ベクトル数によるフィルタリング処理""" @classmethod def get_incorrect_vector_examp...
normal
{ "blob_id": "5d4585dc96d4ebdbc15b7382038cfea959c9a6f3", "index": 2495, "step-1": "<mask token>\n\n\nclass Filter:\n <mask token>\n\n @classmethod\n def get_incorrect_vector_example(cls, file_list, example_number):\n \"\"\"含まれる瞬時データの内指定した個数のデータがそれぞれ持つ誤ベクトル数\"\"\"\n incorrect_vector_list = [...
[ 5, 9, 10, 11, 12 ]
import cv2 as cv #! THESE ARE IMAGES THAT AREN'T DOWNSIZED #original_image_1 = cv.imread("hamburger_face.JPG") #original_image_2 = cv.imread("hammock_reading.JPG") #original_image_3 = cv.imread("sofa_face.JPG") #original_image_4 = cv.imread("frisbee_team.JPG") original_image_5 = cv.imread("mans_face.JPG") # ...
normal
{ "blob_id": "d0bd08bea65878f5fccfc4affecdf53cc36179df", "index": 6633, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor face in detected_faces:\n x, y, w, h = face\n cv.rectangle(original_image_5, (x, y), (x + w, y + h), (0, 255, 0), 2)\ncv.imshow('orig_img', original_image_5)\ncv.waitKey(0)\ncv....
[ 0, 1, 2, 3, 4 ]
print("rap.sweeps.data_management level init")
normal
{ "blob_id": "7d138a0ad7e4d8f7047dd73ae503bdc7ae5aa065", "index": 9801, "step-1": "<mask token>\n", "step-2": "print('rap.sweeps.data_management level init')\n", "step-3": "print(\"rap.sweeps.data_management level init\")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import unittest import userinput class Testing(unittest.TestCase): def test_creation(self): x = userinput.UserInput() self.assertNotEqual(x, None) def test_charset_initialization(self): x = userinput.UserInput() self.assertEqual(x.character_set, userinput.CHARACTERS) def ...
normal
{ "blob_id": "4745d81558130440d35d277b586572f5d3f85c06", "index": 7366, "step-1": "<mask token>\n\n\nclass Testing(unittest.TestCase):\n\n def test_creation(self):\n x = userinput.UserInput()\n self.assertNotEqual(x, None)\n\n def test_charset_initialization(self):\n x = userinput.UserI...
[ 4, 5, 7, 8, 9 ]
"""A simple script to create a motion plan.""" import os import json import logging from logging.config import dictConfig import argparse import numpy as np from opentrons_hardware.hardware_control.motion_planning import move_manager from opentrons_hardware.hardware_control.motion_planning.types import ( AxisConst...
normal
{ "blob_id": "b7d75c2523dba0baaf06ba270045a4a344b8156c", "index": 3023, "step-1": "<mask token>\n\n\ndef main() ->None:\n \"\"\"Entry point.\"\"\"\n parser = argparse.ArgumentParser(description='Motion planning script.')\n parser.add_argument('--params-file-path', '-p', type=str, required=\n False...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-10-27 21:59 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import phonenumber_field.modelfields class Migration(migrations.Migration): dependencies = [ ('regions', '0002_auto_2...
normal
{ "blob_id": "1330addd53c6187a41dfea6957bf47aaecca1135", "index": 7180, "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 = [('regions', '...
[ 0, 1, 2, 3, 4 ]
from django import forms from .models import File, Sample, Plate, Well, Machine, Project class MachineForm(forms.ModelForm): class Meta: model = Machine fields = ['name', 'author', 'status', 'comments'] class ProjectForm(forms.ModelForm): class Meta: model = Project field...
normal
{ "blob_id": "5bb894feaf9293bf70b3f831e33be555f74efde8", "index": 6901, "step-1": "<mask token>\n\n\nclass SampleForm(forms.ModelForm):\n\n\n class Meta:\n model = Sample\n fields = ['name', 'alias', 'sample_type', 'description', 'project',\n 'author', 'sequence', 'length', 'genbank', ...
[ 3, 5, 6, 7 ]
#Sample Python Code print("Different Code!!!") #print("Hello World!")
normal
{ "blob_id": "1e24952006afebb7bf10a83077fc4effd5cc9c58", "index": 1301, "step-1": "<mask token>\n", "step-2": "print('Different Code!!!')\n", "step-3": "#Sample Python Code\nprint(\"Different Code!!!\")\n#print(\"Hello World!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import uvicore from uvicore.support import module from uvicore.typing import Dict, List from uvicore.support.dumper import dump, dd from uvicore.contracts import Email @uvicore.service() class Mail: def __init__(self, *, mailer: str = None, mailer_options: Dict = None, to: List = [], ...
normal
{ "blob_id": "c87ede0e3c6d4cc305450f68b4cf61fb63986760", "index": 8676, "step-1": "<mask token>\n\n\n@uvicore.service()\nclass Mail:\n\n def __init__(self, *, mailer: str=None, mailer_options: Dict=None, to:\n List=[], cc: List=[], bcc: List=[], from_name: str=None,\n from_address: str=None, subj...
[ 6, 8, 9, 10, 15 ]
#!/usr/bin/env python from anytree import Node, RenderTree webtest = Node("WebappTest") registration = Node("Registration", parent=webtest) smsconfirm = Node("SMSconfirm", parent=registration) login = Node("Login", parent=smsconfirm) useruploadCV = Node("UserUploadCV", parent=l...
normal
{ "blob_id": "33ac328b2bf16380b50c58013bd0d4d888dc3952", "index": 4693, "step-1": "<mask token>\n", "step-2": "<mask token>\nDotExporter(webtest).to_picture('webtest.png')\n", "step-3": "<mask token>\nwebtest = Node('WebappTest')\nregistration = Node('Registration', parent=webtest)\nsmsconfirm = Node('SMSconf...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from .models import Invite class InviteAdmin(admin.ModelAdmin): list_display = ('invitee', 'inviter', 'created_on', 'approved', 'rejected', 'used') admin.site.register(Invite, InviteAdmin)
normal
{ "blob_id": "fcb13b087b9c967ab16b64885411cc4aae98583c", "index": 2130, "step-1": "<mask token>\n\n\nclass InviteAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass InviteAdmin(admin.ModelAdmin):\n list_display = ('invitee', 'inviter', 'created_on', 'approved',...
[ 1, 2, 3, 4 ]
from operator import itemgetter import math def get_tf_idf_map(document, max_freq, n_docs, index): tf_idf_map = {} for term in document: tf = 0 idf = math.log(n_docs) if term in index and term not in tf_idf_map: posting_list = index[term] freq_term = sum([p...
normal
{ "blob_id": "39197b3f9f85d94457584d7e488ca376e52207f1", "index": 5832, "step-1": "<mask token>\n\n\ndef get_cosinus_simularity(tf_idf_map, key_words):\n sum_common_terms = 0\n sum_tf_idf_terms = 0\n for term in tf_idf_map:\n if term in key_words:\n sum_common_terms += tf_idf_map[term]\...
[ 1, 2, 3, 4, 5 ]
print("Hello world! im in github")
normal
{ "blob_id": "2db6f88b733c23063803c374d7a5b651e8443bd5", "index": 6135, "step-1": "<mask token>\n", "step-2": "print('Hello world! im in github')\n", "step-3": "print(\"Hello world! im in github\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from django.db import models from django.utils import timezone # Create your models here. class URL(models.Model): label = models.CharField(null=True, blank=True, max_length=30) address = models.URLField() slug = models.SlugField(unique=True, max_length=8) created = models.DateTimeField(auto_now_add=T...
normal
{ "blob_id": "2dcb02ea2f36dd31eda13c1d666201f861c117e7", "index": 4027, "step-1": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n ...
[ 1, 2, 3, 4, 5 ]
def non_dupulicates_lette(word): text = list(word); print(text) i=0 for i in range(len(text)): for k in text: print(c) def has_dupulicates(word): d= dict() for c in word: if c not in d: d[c]=1 else: d[c]+=1 ...
normal
{ "blob_id": "8cd234c2ec1b36abd992cc1a46147376cc241ede", "index": 3276, "step-1": "<mask token>\n\n\ndef has_dupulicates(word):\n d = dict()\n for c in word:\n if c not in d:\n d[c] = 1\n else:\n d[c] += 1\n for k in d:\n if d[k] == 1:\n print(k)\n ...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- import sys, io,re import regex from collections import defaultdict import datetime import json def update_key(data_base, url,kkey): keys_saved = regex.get_data('<key>\s(.+?)\s<',data_base[url]['key']) if kkey not in keys_saved: data_base[url]['key'] = data_base[url...
normal
{ "blob_id": "50a5d3431693b402c15b557357eaf9a85fc02b0b", "index": 2921, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef update_key(data_base, url, kkey):\n keys_saved = regex.get_data('<key>\\\\s(.+?)\\\\s<', data_base[url]['key'])\n if kkey not in keys_saved:\n data_base[url]['key'] =...
[ 0, 7, 8, 9, 11 ]
import csv import us from flask import abort, Flask, request, render_template app = Flask(__name__) # pylint: disable=invalid-name @app.route('/') def root(): return render_template('index.html') @app.route('/api') def index(): return render_template('index.html') @app.route('/api/total/counties') def ...
normal
{ "blob_id": "af00c6f443426b1f61e1816d7d14ebc7e6871a82", "index": 5562, "step-1": "<mask token>\n\n\n@app.route('/')\ndef root():\n return render_template('index.html')\n\n\n@app.route('/api')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/api/total/counties')\ndef total_counties():\...
[ 34, 39, 40, 41, 42 ]
from calc1 import LispTranslator, RPNTranslator, Parser, Lexer import unittest class TestTranslators(unittest.TestCase): def init_rpn(self, program): return RPNTranslator(Parser(Lexer(program))) def init_lisp(self, program): return LispTranslator(Parser(Lexer(program))) def test_simple_...
normal
{ "blob_id": "d0e957abfe5646fb84aed69902f2382d554dc825", "index": 4401, "step-1": "<mask token>\n\n\nclass TestTranslators(unittest.TestCase):\n <mask token>\n\n def init_lisp(self, program):\n return LispTranslator(Parser(Lexer(program)))\n <mask token>\n <mask token>\n\n def test_examples_...
[ 3, 5, 6, 8 ]
import cartopy.crs as ccrs import cartopy.feature as cfeature import numpy as np import matplotlib.pyplot as plt import netCDF4 import xarray as xr import metpy from datetime import datetime import datetime as dt from metpy.units import units import scipy.ndimage as ndimage from metpy.plots import USCOUNTIES...
normal
{ "blob_id": "8771f71a69f3afdc5de4d38db6efe61b553ae880", "index": 9396, "step-1": "<mask token>\n\n\ndef mkdir_p(mypath):\n \"\"\"Creates a directory. equivalent to using mkdir -p on the command line\"\"\"\n from errno import EEXIST\n from os import makedirs, path\n try:\n makedirs(mypath)\n ...
[ 2, 3, 4, 5, 6 ]
#from tkinter import Tk, Text, INSERT import mnemonicos as mne class Ensambler(object): def __init__(self, fileName): #Nombre del archivo self.fileName = fileName #Lineas del Archivo self.fileLines = [] #Contador de Localidades self.cl = 0 #Tamaño self.size = 0 #Opcode self.code = "" #Intr...
normal
{ "blob_id": "3bc009271c7dd34ad09bcef81214387b63dfac59", "index": 2549, "step-1": "<mask token>\n\n\nclass Ensambler(object):\n\n def __init__(self, fileName):\n self.fileName = fileName\n self.fileLines = []\n self.cl = 0\n self.size = 0\n self.code = ''\n self.instru...
[ 7, 8, 9, 10, 12 ]
print('\n') # Первый вариант def fn1(): print("One") def fn2(): print("Two") def fn3(): print("Three") fndict = {"A": fn1, "B": fn2, "C": fn3} keynames = ["A", "B", "C"] fndict[keynames[1]]() fndict['C']() # Второй вариант def add(one,two): c = one+two print(c) print(type(c)) def sub(one,two...
normal
{ "blob_id": "dc226a646af32d052c6d51832b95a340d6986e08", "index": 489, "step-1": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')\n\n\ndef fn3():\n print('Three')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef fn1():\n print('One')\n\n\ndef fn2():\n print('Two')...
[ 3, 4, 5, 6, 8 ]
import pkgutil import mimetypes import time from datetime import datetime from pywb.utils.wbexception import NotFoundException from pywb.utils.loaders import BlockLoader from pywb.utils.statusandheaders import StatusAndHeaders from pywb.framework.basehandlers import BaseHandler, WbUrlHandler from pywb.framework.wbre...
normal
{ "blob_id": "df1486afcc99e03510512ed6ed3e8b3471459d50", "index": 5343, "step-1": "<mask token>\n\n\nclass WBHandler(SearchPageWbUrlHandler):\n <mask token>\n <mask token>\n <mask token>\n\n def handle_query(self, wbrequest, cdx_lines, output):\n return self.index_reader.make_cdx_response(wbreq...
[ 10, 19, 21, 22, 25 ]
def mysum(*c): print(sum([x for x in c])) mysum(1,2,3,4,0xB)
normal
{ "blob_id": "2c4fa92b28fa46a26f21ada8826474baac204e00", "index": 1234, "step-1": "<mask token>\n", "step-2": "def mysum(*c):\n print(sum([x for x in c]))\n\n\n<mask token>\n", "step-3": "def mysum(*c):\n print(sum([x for x in c]))\n\n\nmysum(1, 2, 3, 4, 11)\n", "step-4": "def mysum(*c):\n print(su...
[ 0, 1, 2, 3 ]
<<<<<<< HEAD {'_data': [['Common', [['Skin', u'Ospecifika hud-reakti oner'], ['General', u'Tr\xf6tthet']]], ['Uncommon', [['GI', u'Buksm\xe4rta, diarr\xe9, f\xf6r-stoppnin g, illam\xe5ende (dessa symptom g\xe5r vanligt-vis \xf6ver vid fortsatt behandling).']]], ['Rare', ...
normal
{ "blob_id": "efe13de4ed5a3f42a9f2ece68fd329d8e3147ca2", "index": 4869, "step-1": "<<<<<<< HEAD\n{'_data': [['Common', [['Skin', u'Ospecifika hud-reakti oner'], ['General', u'Tr\\xf6tthet']]],\n ['Uncommon',\n [['GI',\n u'Buksm\\xe4rta, diarr\\xe9, f\\xf6r-stoppnin g, illam\\xe5e...
[ 0 ]
from __future__ import absolute_import import itertools from django.contrib import messages from django.core.context_processors import csrf from django.db import transaction from django.http import HttpResponseRedirect from django.views.decorators.cache import never_cache from django.utils.decorators import method_de...
normal
{ "blob_id": "46f218829e1bf324d4c50ea0ff7003bc48b64e2a", "index": 4258, "step-1": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n\n @method_decorator(never_cache)\n ...
[ 1, 2, 3, 4, 5 ]
# # PySNMP MIB module CISCO-LWAPP-CLIENT-ROAMING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-CLIENT-ROAMING-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:04:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ...
normal
{ "blob_id": "76fbe055b53af9321cc0d57a210cfffe9188f800", "index": 6531, "step-1": "<mask token>\n", "step-2": "<mask token>\nciscoLwappClRoamMIB.setRevisions(('2010-01-29 00:00', '2006-04-11 00:00'))\nif getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):\n if mibBuilder.loadTexts:\n ciscoLwappClRo...
[ 0, 1, 2, 3 ]
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QComboBox class ChoiceTargetNumbers(QWidget): """Виджет с выбором номеров целей""" def __init__(self, parent=None) -> None: QWidget.__init__(self, parent) # Нужные компоненты label = QLabel(text="Выберите номера целей:") ...
normal
{ "blob_id": "291cd789ac3ab7b794be8feafe0f608ad0c081d7", "index": 9674, "step-1": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChoiceTargetNumbers(QWidget):\n <mask token>\n\n def __init__(self, parent=None) ->None:\n ...
[ 1, 2, 3, 4, 5 ]
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
normal
{ "blob_id": "cb904408486ad9ea8cc0c8ff2ec393e480309a57", "index": 2403, "step-1": "<mask token>\n", "step-2": "<mask token>\nresult_dir = 'results'\ndata_dir = 'datasets'\ncache_dir = f'{ROOT_PATH}/data/cache'\nrun_dir_ignore = ['results', 'datasets', 'cache']\nuse_treeconnect = False\ntreeconnect_threshold = 1...
[ 0, 1, 2, 3 ]
#Create Pandas dataframe from the DarkSage output G[''] import pandas as pd import numpy as np # This is a way to converte multi dimensional data into pd.Series and then load these into the pandas dataframe Pos = [] for p in G['Pos']: Pos.append(p) Pos_df = pd.Series(Pos, dtype=np.dtype("object")) Vel = [] for ...
normal
{ "blob_id": "0d565c9f92a60d25f28c903c0a27e7b93d547a4f", "index": 2971, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor p in G['Pos']:\n Pos.append(p)\n<mask token>\nfor v in G['Vel']:\n Vel.append(v)\n<mask token>\nfor s in G['Spin']:\n Spin.append(s)\n<mask token>\nfor d in G['DiscRadii']:\n...
[ 0, 1, 2, 3, 4 ]
from django import forms from .models import Note class NoteForm(forms.ModelForm): class Meta: model = Note fields = ['title', 'text'] class NoteFullForm(NoteForm): note_id = forms.IntegerField(required=False) images = forms.FileField(widget=forms.ClearableFileInput(attrs={ 'mu...
normal
{ "blob_id": "e0fd9663a5635873f4ffc0f73aff5106c0933781", "index": 9180, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NoteFullForm(NoteForm):\n note_id = forms.IntegerField(required=False)\n images = forms.FileField(widget=forms.ClearableFileInput(attrs={\n 'multiple': True}), requ...
[ 0, 2, 3, 4 ]
import pytest from django_swagger_utils.drf_server.exceptions import NotFound from unittest.mock import create_autospec from content_management_portal.constants.enums import TextType from content_management_portal.interactors.storages.storage_interface \ import StorageInterface from content_management_portal.inter...
normal
{ "blob_id": "1c66ccb80383feeee96b3fb492ff63be1a67a796", "index": 5496, "step-1": "<mask token>\n\n\nclass TestQuestionInteractor:\n\n def test_question_create(self, questiondto):\n user_id = 1\n short_title = 'hello'\n content_type = 'HTML'\n content = 'hi'\n storage = creat...
[ 2, 3, 4, 5, 6 ]
with open("file.txt", 'r') as fh: data = fh.readline() lis= data.split(' ') my_dict={} for key in lis: if key in my_dict.keys(): my_dict[key] += 1 else: my_dict[key] = 1 print(my_dict)
normal
{ "blob_id": "8cd582915c5abd96a4ef8a3a5309311f2a73a156", "index": 460, "step-1": "<mask token>\n", "step-2": "with open('file.txt', 'r') as fh:\n data = fh.readline()\n<mask token>\nfor key in lis:\n if key in my_dict.keys():\n my_dict[key] += 1\n else:\n my_dict[key] = 1\nprint(my_dict)\...
[ 0, 1, 2, 3 ]
from django.apps import AppConfig class NombreaplicacionConfig(AppConfig): name = 'nombreAplicacion'
normal
{ "blob_id": "0c7efa99dc22154f9835b277cba5057b213a28e7", "index": 2414, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NombreaplicacionConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass NombreaplicacionConfig(AppConfig):\n name = 'nombreAplicacion'\n", "step-4": "...
[ 0, 1, 2, 3 ]
from rest_framework.pagination import PageNumberPagination class QuoteListPagination(PageNumberPagination): page_size = 30
normal
{ "blob_id": "4245da12eb7f9dd08c863e368efbd0bcf0b8fa04", "index": 6816, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass QuoteListPagination(PageNumberPagination):\n page_size = 30\n", "step-...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Sun Sep 19 17:15:58 2021 @author: Professional """ #son = int(input("Biror son kiriting: ") ) #print(son, "ning kvadrati", son*son, "ga teng") #print (son, "ning kubi", son*son*son, "ga teng") #yosh = int(input("Yoshingiz nechida: ")) #print("Siz", 2021 - yosh, "yil...
normal
{ "blob_id": "0d32fe36f71ffb3df56738664c5dbd0b8ae585e3", "index": 3303, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"yig'indisi \", a + b)\nprint('ayirmasi ', a - b)\nprint(\"bo'linmasi \", a / b)\nprint(\"ko'paytmasi \", a * b)\n", "step-3": "<mask token>\na = int(input('Birinchi sonni kiriti...
[ 0, 1, 2, 3 ]
o = input() v = [] s = 0 for i in range(12): col = [] for j in range(12): col.append(float(input())) v.append(col) a = 1 for i in range(1, 12): for j in range(a): s += v[i][j] a+=1 if o == 'S': print("%.1f"%s) if o == 'M': print("%.1f"%(s/66))
normal
{ "blob_id": "0df20722fba6223c9d4fc9f72bfb399b479db6ac", "index": 7917, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(12):\n col = []\n for j in range(12):\n col.append(float(input()))\n v.append(col)\n<mask token>\nfor i in range(1, 12):\n for j in range(a):\n s ...
[ 0, 1, 2, 3 ]
my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam'] while 'spam' in my_order: print("I don't like spam!") my_order.remove('spam') print(my_order)
normal
{ "blob_id": "8e8629dd2d4bb601347694b18d7cb6a94880201d", "index": 8192, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 'spam' in my_order:\n print(\"I don't like spam!\")\n my_order.remove('spam')\nprint(my_order)\n", "step-3": "my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam']...
[ 0, 1, 2 ]
import requests save_result = requests.post('http://localhost:5000/save', json={'value': 'witam'}) print(save_result.text) read_result = requests.get('http://localhost:5000/read') print(read_result.text)
normal
{ "blob_id": "43362c564be0dfbc8f246a0589bcebde245ab7b5", "index": 7015, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(save_result.text)\n<mask token>\nprint(read_result.text)\n", "step-3": "<mask token>\nsave_result = requests.post('http://localhost:5000/save', json={'value':\n 'witam'})\nprin...
[ 0, 1, 2, 3 ]
providers = { 'provider-1': { 'name': 'provider-1', 'roles': ['licensor', 'producer'], 'description': 'This is a full description of the provider', 'url': 'https://www.provider.com' }, 'provider-2': { 'name': 'provider-2', 'roles': ['licensor'], 'descr...
normal
{ "blob_id": "7801676df91a7ded6f123113acc62f3955dfe6cb", "index": 7113, "step-1": "<mask token>\n", "step-2": "providers = {'provider-1': {'name': 'provider-1', 'roles': ['licensor',\n 'producer'], 'description':\n 'This is a full description of the provider', 'url':\n 'https://www.provider.com'}, 'pro...
[ 0, 1, 2 ]
import pygame from pygame.locals import * pygame.init() ttt = pygame.display.set_mode((300,325)) #loome mänguakna pygame.display.set_caption = ("Trips-Traps-Trull") võitja = None def init_tabel(ttt): taust = pygame.Surface(ttt.get_size()) taust = taust.convert() taust.fill((250,250,250)) #tõm...
normal
{ "blob_id": "a667c4cb0a30ee67fe982bb96ece6bb75f25f110", "index": 7084, "step-1": "<mask token>\n\n\ndef näita_tabelit(ttt, tabel):\n hetkeseis(tabel)\n ttt.blit(tabel, (0, 0))\n pygame.display.flip()\n\n\ndef hiire_positsioon_tabelis(Xkoordinaat, Ykoordinaat):\n if Ykoordinaat < 100:\n rida = ...
[ 6, 7, 9, 10, 11 ]
#!/usr/bin/python2 import unittest import luna_utils as luna import time API_URL = "com.webos.service.videooutput/" VERBOSE_LOG = True SUPPORT_REGISTER = False SINK_MAIN = "MAIN" SINK_SUB = "SUB0" #TODO(ekwang): If you connect SUB, HAL error occurs. Just test MAIN in the current state #SINK_LIST = [SINK_MAIN, SINK_...
normal
{ "blob_id": "27e66b2a03bc626d5babd804e736a4652ba030d5", "index": 8624, "step-1": "<mask token>\n\n\nclass TestVideoMethods(luna.TestBase):\n\n def vlog(self, message):\n if VERBOSE_LOG:\n print(message)\n\n def setUp(self):\n self.vlog('setUp')\n if SUPPORT_REGISTER:\n ...
[ 11, 14, 15, 17, 18 ]
class UnknownResponseFormat(Exception): pass
normal
{ "blob_id": "e5e460eb704e2ab5f747d1beee05e012ea95fbd2", "index": 3871, "step-1": "<mask token>\n", "step-2": "class UnknownResponseFormat(Exception):\n pass\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
str="mama" stringlength=len(str) slicedString=str[stringlength::-1] print (slicedString)
normal
{ "blob_id": "5c80561a3344c0240e59500e5dadc1f1ef7f380e", "index": 7687, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(slicedString)\n", "step-3": "str = 'mama'\nstringlength = len(str)\nslicedString = str[stringlength::-1]\nprint(slicedString)\n", "step-4": "str=\"mama\"\r\nstringlength=len(str...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import seaborn as sb import matplotlib as mp data = pd.read_csv("/Users/stevenbaez/Desktop/train.csv") # In[2]: data.head() # In[3]: subset = data[['Survived','Age', 'Sex']] # In[5]: import numpy as np import matplotli...
normal
{ "blob_id": "41006ff35299aa72b69c6dc1c71a45b44dca7d6c", "index": 1184, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata.head()\n<mask token>\nsb.catplot(x='Age', y='Sex', hue='Survived', col='Embarked', notch=False,\n palette='Set2', data=data, kind='box', height=4, aspect=0.7)\nsb.catplot(x='Age',...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import config import web import hashlib import sys db = web.database(dbn="mysql", db=config.db, user=config.user, pw=config.passwd) def signIn(user, pw): pwhash = hashlib.md5(pw).hexdigest() uid = db.insert("users", uname=user, passwd=pwhash) r...
normal
{ "blob_id": "6d032df195854703f36dce7d27524c8f5089c04d", "index": 2334, "step-1": "#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport config\r\nimport web\r\nimport hashlib\r\nimport sys\r\n\r\n\r\ndb = web.database(dbn=\"mysql\", db=config.db, user=config.user, pw=config.passwd)\r\n\r\ndef signIn(use...
[ 0 ]
#!/bin/python """ len() lower() upper() str() """ parrot = "Norwegian Blue" print len(parrot)
normal
{ "blob_id": "cd8d95e2bf433020db2db06a21263f75e3f81331", "index": 9740, "step-1": "#!/bin/python\n\n\"\"\"\nlen()\nlower()\nupper()\nstr()\n\"\"\"\n\nparrot = \"Norwegian Blue\"\nprint len(parrot)\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import requests import tkinter as tk from tkinter.font import Font from time import strptime class Window(tk.Tk): def __init__(self): super().__init__() #取得網路上的資料 res = requests.get('https://flask-robert.herokuapp.com/youbike') jsonObj = res.json() areas = jsonObj['areas'] ...
normal
{ "blob_id": "f9becdb48583423e7bd3730d1cd74a6a016663dc", "index": 1768, "step-1": "<mask token>\n\n\nclass Window(tk.Tk):\n\n def __init__(self):\n super().__init__()\n res = requests.get('https://flask-robert.herokuapp.com/youbike')\n jsonObj = res.json()\n areas = jsonObj['areas']...
[ 4, 5, 6, 7, 8 ]
from collections import Counter # Complete the isValid function below. def isValid(s): if not s: return True x = Counter(s) print(x) first_c = x.pop(s[0]) cnt = 0 for k, c in x.items(): if c != first_c: if first_c == 1: cnt += 1 firs...
normal
{ "blob_id": "760daa908ca92e7fb1393bdf28fee086dc1648ef", "index": 6418, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef isValid(s):\n if not s:\n return True\n x = Counter(s)\n print(x)\n first_c = x.pop(s[0])\n cnt = 0\n for k, c in x.items():\n if c != first_c:\n ...
[ 0, 1, 2, 3, 4 ]
""" opsi-utils Test utilities """ import os import tempfile from contextlib import contextmanager from pathlib import Path from typing import Generator @contextmanager def temp_context() -> Generator[Path, None, None]: origin = Path().absolute() try: with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) ...
normal
{ "blob_id": "3c2a611fd001f145703853f5ecfe70d0e93844e4", "index": 4665, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@contextmanager\ndef temp_context() ->Generator[Path, None, None]:\n origin = Path().absolute()\n try:\n with tempfile.TemporaryDirectory(ignore_cleanup_errors=True\n ...
[ 0, 1, 2, 3 ]
from Logic.ProperLogic.helper_classes.reducer import MaxReducer from Logic.ProperLogic.misc_helpers import log_error import torch from itertools import count import logging logging.basicConfig(level=logging.INFO) class Cluster: metric = 2 def __init__(self, cluster_id, embeddings=None, embeddings_ids=None,...
normal
{ "blob_id": "265c594b12ea45a2dda12e1157e5ea040f4d6ce4", "index": 9021, "step-1": "<mask token>\n\n\nclass Cluster:\n <mask token>\n <mask token>\n\n def __len__(self):\n return len(self.embeddings_dict)\n\n def set_label(self, label):\n self.label = label\n <mask token>\n <mask to...
[ 7, 17, 20, 21, 22 ]
#!/usr/bin/env python from __future__ import absolute_import, print_function, unicode_literals import os import sys import unittest # Allow interactive execution from CLI, cd tests; ./test_cli.py if __package__ is None: sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from ksconf.con...
normal
{ "blob_id": "1bb953b665f48638691986e2fcae73b10a1c2ce0", "index": 7729, "step-1": "<mask token>\n\n\nclass CliKsconfCombineTestCase(unittest.TestCase):\n\n def build_test01(self, twd):\n twd.write_file(\n 'etc/apps/Splunk_TA_aws/default.d/10-upstream/props.conf',\n \"\"\"\n ...
[ 7, 8, 10, 11, 12 ]
# SPDX-FileCopyrightText: 2023 spdx contributors # # SPDX-License-Identifier: Apache-2.0 from dataclasses import field from beartype.typing import List, Optional from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties from spdx_tools.common.typing.type_checks import check_types_and_se...
normal
{ "blob_id": "1c085ea8f9b21ea7bef94ad4ecbb1771a57f697a", "index": 2208, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@dataclass_with_properties\nclass ExternalMap:\n external_id: str\n verified_using: List[IntegrityMethod] = field(default_factory=list)\n location_hint: Optional[str] = None\...
[ 0, 1, 2, 3, 4 ]
# Created by MechAviv # [Maestra Fiametta] | [9390220] # Commerci Republic : San Commerci if sm.hasItem(4310100, 1): sm.setSpeakerID(9390220) sm.sendSayOkay("You can't start your voyage until you finish the tutorial quest!") else: sm.setSpeakerID(9390220) sm.sendNext("What? You threw away the coins wi...
normal
{ "blob_id": "c4b9fdba9e9eeccc52999dab9232302f159c882a", "index": 588, "step-1": "<mask token>\n", "step-2": "if sm.hasItem(4310100, 1):\n sm.setSpeakerID(9390220)\n sm.sendSayOkay(\n \"You can't start your voyage until you finish the tutorial quest!\")\nelse:\n sm.setSpeakerID(9390220)\n sm....
[ 0, 1, 2 ]
import testTemplate def getTests(): tests = [] suite=testTemplate.testSuite("Sample Test Cases") testcase = testTemplate.testInstance("3\n1 1 1\n1 1 1\n1 1 1" , "6" , "Sample #1") suite.add(testcase) testcase = testTemplate.testInstance("11\n1 0 0 1 0 0 0 0 0 1 1 \n1 1 1 1 1 0 1 0 1 0 0 \n1 0 0 1 0 0 1 1 0 1 0 ...
normal
{ "blob_id": "de4c31ad474b7ce75631214aceafbe4d7334f14b", "index": 6956, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getTests():\n tests = []\n suite = testTemplate.testSuite('Sample Test Cases')\n testcase = testTemplate.testInstance('3\\n1 1 1\\n1 1 1\\n1 1 1', '6',\n 'Sample #...
[ 0, 1, 2, 3 ]
#Script start print"This is the two number subtraction python program." a = 9 b = 2 c = a - b print c # Scrip close
normal
{ "blob_id": "a045423edd94d985dfc9660bcfe4a88c61bf4574", "index": 20, "step-1": "#Script start\nprint\"This is the two number subtraction python program.\"\na = 9\nb = 2\nc = a - b\nprint c\n\n# Scrip close\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
"""------------------------------------------------------------------------ MODULE FContactRegulatoryInfoBase - DESCRIPTION: This file provides the custom instance of RegulatoryInfo on the Contact which has all the RegulatoryInfo related methods VERSION: 1.0.25(0.25.7) RESTRICTIONS/ LIMITATIONS: 1. Any modi...
normal
{ "blob_id": "d4e62950f10efeb27d19c3d9c672969342ef8c7c", "index": 3095, "step-1": "<mask token>\n\n\nclass FContactRegulatoryInfoBase(object):\n\n def __init__(self, contact=None):\n \"\"\"class that maintains all data related to the regulatory on the FContact\"\"\"\n try:\n self.__con...
[ 13, 15, 18, 20, 23 ]
from mayan.apps.testing.tests.base import BaseTestCase from .mixins import AssetTestMixin class AssetModelTestCase(AssetTestMixin, BaseTestCase): def test_asset_get_absolute_url_method(self): self._create_test_asset() self.test_asset.get_absolute_url()
normal
{ "blob_id": "42c9e5039e2d5f784bf6405ea8bcaf7d6973ddcb", "index": 6456, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AssetModelTestCase(AssetTestMixin, BaseTestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass AssetModelTestCase(AssetTestMixin, BaseTestCase):\n\n def test_as...
[ 0, 1, 2, 3 ]
# ethermine.py, Copyright (c) 2019, Nicholas Saparoff <nick.saparoff@gmail.com>: Original implementation from minermedic.pools.base_pool import BasePool from phenome_core.util.rest_api import RestAPI from minermedic.pools.helper import get_algo_index, get_coin_index, get_coin_cost """ EtherminePool This is the ...
normal
{ "blob_id": "921c7255fad46c767f2ec1030ef9498da05b9bb1", "index": 9958, "step-1": "<mask token>\n\n\nclass EtherminePool(BasePool):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build_creation_parameters(self, pool, pool_attrs, pool_classname):\n params = super(Ethermin...
[ 6, 8, 9, 10, 11 ]
#%% [markdown] # # Look at intron-less gene enrichment in Cyte biased expressed genes. # This is a quick look at if parimary spermatocyte biased genes are enriched in intronless genes. # Yes this is what we see. #%% import os import pickle import numpy as np import pandas as pd from scipy.stats import fisher_exact, c...
normal
{ "blob_id": "5f4d83aa2b530417ecb1598510fb4778b111700b", "index": 6489, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n os.chdir(os.path.join(os.getcwd(), 'docs'))\n print(os.getcwd())\nexcept:\n pass\n<mask token>\ng.map(sns.boxplot, 'intronless', 'pct_cyte', order=[False, True])\ng.set_yl...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 # Aluno: Héricles Emanuel # Matrícula: 117110647 # Atividade: É quadrado Mágico? def eh_quadrado_magico(m): somas_all = [] eh_magico = True soma = 0 for e in range(len(m[0])): soma += m[0][e] # Linhas for i in range(len(m)): somados = 0 for e in range(len(m[i])): somados += (m[i][e]) s...
normal
{ "blob_id": "f039ab104093eb42c3f5d3c794710a0997e85387", "index": 8371, "step-1": "# coding: utf-8\n# Aluno: Héricles Emanuel\n# Matrícula: 117110647\n# Atividade: É quadrado Mágico?\n\ndef eh_quadrado_magico(m):\n\tsomas_all = []\n\teh_magico = True\n\tsoma = 0\n\tfor e in range(len(m[0])):\n\t\tsoma += m[0][e]\...
[ 0 ]
class Solution: ''' 先遍历整个string,并记录最小的character的出现次数。 如果最小character出现次数都不小于k,那么说明整个string就是满足条件的longest substring,返回原string的长度即可; 如果character的出现次数小于k,假设这个character是c,因为满足条件的substring永远不会包含c,所以满足条件的substring一定是在以c为分割参考下的某个substring中。所以我们需要做的就是把c当做是split的参考,在得到的String[]中再次调用我们的method,找到最大的返回值即可。 ''' ...
normal
{ "blob_id": "6ba830aafbe8e4b42a0b927328ebcad1424cda5e", "index": 8381, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n <mask token>\n", "step-3": "class Solution:\n <mask token>\n\n def longestSubstring(self, s: str, k: int) ->int:\n\n def helper(s, k):\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'meet.ui' # # Created by: PyQt5 UI code generator 5.8.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName...
normal
{ "blob_id": "c076aed1bfff51f8edf5ab4ef029b7fa7ca2422c", "index": 9479, "step-1": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectName('Dialog')\n Dialog.resize(607, 723)\n self.start = QtWidgets.QLabel(Dialog)\n self.start.setGeometry(Qt...
[ 2, 3, 4, 5, 6 ]
import sys import networkx as nx import bcube.generator_bcube as bcube import dcell.generate_dcell as dcell import fat_tree.generate_fat_tree as fatTree import cayley_graphs.generate_bubble_sort as bubbleSort import cayley_graphs.generate_hypercube as hypercube import cayley_graphs.generate_pancake as pancake import ca...
normal
{ "blob_id": "12d59697d5c2ec69d019c64dac762385c8c0cb66", "index": 7224, "step-1": "import sys\nimport networkx as nx\nimport bcube.generator_bcube as bcube\nimport dcell.generate_dcell as dcell\nimport fat_tree.generate_fat_tree as fatTree\nimport cayley_graphs.generate_bubble_sort as bubbleSort\nimport cayley_gr...
[ 0 ]
# -*- coding:utf-8 -*- # from django.core.paginator import Paginator def pagination(request, queryset, display_amount=15, after_range_num=5, bevor_range_num=4): # 按参数分页 paginator = Paginator(queryset, display_amount) try: # 得到request中的page参数 page = int(request.GET['page']) except: ...
normal
{ "blob_id": "7a2b33d1763e66335c6a72a35082e20725cab03d", "index": 3318, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef pagination(request, queryset, display_amount=15, after_range_num=5,\n bevor_range_num=4):\n paginator = Paginator(queryset, display_amount)\n try:\n page = int(req...
[ 0, 1, 2, 3 ]
import oneflow as flow import torch def convert_torch_to_flow(model, torch_weight_path, save_path): parameters = torch.load(torch_weight_path) new_parameters = dict() for key, value in parameters.items(): if "num_batches_tracked" not in key: val = value.detach().cpu().numpy() ne...
normal
{ "blob_id": "8a3cf65550893367b9001369111fa19a3e998d82", "index": 9589, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef convert_torch_to_flow(model, torch_weight_path, save_path):\n parameters = torch.load(torch_weight_path)\n new_parameters = dict()\n for key, value in parameters.items():...
[ 0, 1, 2, 3 ]
"""byte - property model module.""" from __future__ import absolute_import, division, print_function class BaseProperty(object): """Base class for properties.""" def get(self, obj): """Get property value from object. :param obj: Item :type obj: byte.model.Model """ ra...
normal
{ "blob_id": "382f7119beba81087c497baf170eb6814c26c03e", "index": 5458, "step-1": "<mask token>\n\n\nclass BaseProperty(object):\n <mask token>\n <mask token>\n\n def set(self, obj, value):\n \"\"\"Set property value on object.\n\n :param obj: Item\n :type obj: byte.model.Model\n\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # File: software/jetson/fastmot/utils/sot.py # By: Samuel Duclos # For: Myself # Description: This file returns detection results from an image. from cvlib.object_detection import draw_bbox class ObjectCenter(object): def __init__(self, args)...
normal
{ "blob_id": "8f14bbab8b2a4bc0758c6b48feb20f8b0e3e348b", "index": 5460, "step-1": "<mask token>\n\n\nclass ObjectCenter(object):\n\n def __init__(self, args):\n \"\"\"Initialize variables.\"\"\"\n self.args = args\n\n def load_classes(self, path):\n with open(path, 'r') as names_file:\n...
[ 4, 5, 6, 8, 9 ]
#!/usr/bin/env conda-execute # conda execute # env: # - python >=3 # - requests # run_with: python from configparser import NoOptionError from configparser import SafeConfigParser import argparse import base64 import inspect import ipaddress import json import logging import logging.config import o...
normal
{ "blob_id": "dd91ba13177aefacc24ef4a004acae0bffafadf0", "index": 8889, "step-1": "#!/usr/bin/env conda-execute\r\n\r\n# conda execute\r\n# env:\r\n# - python >=3\r\n# - requests\r\n# run_with: python\r\n\r\nfrom configparser import NoOptionError\r\nfrom configparser import SafeConfigParser\r\nimport argparse\r...
[ 0 ]
import math n, m, a = map(int, input().split()) top = math.ceil(n / a) bottom = math.ceil(m / a) print(top * bottom)
normal
{ "blob_id": "6c426d2b165e01a7cec9f7ddbd96113ae05668f6", "index": 4898, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(top * bottom)\n", "step-3": "<mask token>\nn, m, a = map(int, input().split())\ntop = math.ceil(n / a)\nbottom = math.ceil(m / a)\nprint(top * bottom)\n", "step-4": "import math...
[ 0, 1, 2, 3 ]
a = list(range(1, 501)) b = list(range(1, 501)) c = list(range(1, 501)) for i in a: for j in b: for k in c: if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2: print(i) print(j) print(k) break
normal
{ "blob_id": "34947b7ed300f2cbcbf9042fee3902458921d603", "index": 2912, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n for j in b:\n for k in c:\n if i + k + j == 1000 and i < j < k and j ** 2 + i ** 2 == k ** 2:\n print(i)\n print(j)\n ...
[ 0, 1, 2 ]
def selectionSort(arr, low, high): for i in range(len(arr)): mini = i for j in range(i + 1, len(arr)): if arr[mini] > arr[j]: mini = j arr[i], arr[mini] = arr[mini], arr[i] return arr
normal
{ "blob_id": "c91be6cc332139c5b1e7ee5a3512482d0f8620b1", "index": 7322, "step-1": "<mask token>\n", "step-2": "def selectionSort(arr, low, high):\n for i in range(len(arr)):\n mini = i\n for j in range(i + 1, len(arr)):\n if arr[mini] > arr[j]:\n mini = j\n arr[...
[ 0, 1 ]
workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep' seed = 300 n_fold = 2 epoch = 50 resume_from = None batch_size = 32 num_workers = 32 imgsize = (768, 768) #(height, width) loss = dict( name='BCEWithLogitsLoss', params=dict(), ) optim = dict( name='AdamW', params=dict( ...
normal
{ "blob_id": "8030bdb6c9f0b7114916d7abc245ff680d1fc917", "index": 6790, "step-1": "<mask token>\n", "step-2": "workdir = './model/adamW-BCE/model_seresnext50_32x4d_i768_runmila_2fold_50ep'\nseed = 300\nn_fold = 2\nepoch = 50\nresume_from = None\nbatch_size = 32\nnum_workers = 32\nimgsize = 768, 768\nloss = dict...
[ 0, 1, 2 ]
import os def mini100(videopath, minipath,mod='train'): with open(videopath, 'r') as video_f: all_videos = video_f.readlines() #if mod=='train': # count = [400 for _ in range(0,100)] #else: # count = [25 for _ in range(0,100)] count = [0 for _ in range(0,100)] ...
normal
{ "blob_id": "f6d4208afee7aacd96ea5ae6c9e38d2876466703", "index": 7417, "step-1": "<mask token>\n\n\ndef mini200(videopath, minipath, mod='train'):\n with open(videopath, 'r') as video_f:\n all_videos = video_f.readlines()\n count = [(0) for _ in range(0, 200)]\n with open(minipath, 'w') a...
[ 2, 3, 4, 5, 6 ]
from .fieldmatrix import *
normal
{ "blob_id": "fc4fafe4e29a7f116c38be265fce8e4fb6638330", "index": 6848, "step-1": "<mask token>\n", "step-2": "from .fieldmatrix import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
import json import re from bs4 import BeautifulSoup from bs4.element import NavigableString, Tag from common import dir_path def is_element(el, tag): return isinstance(el, Tag) and el.name == tag class ElemIterator(): def __init__(self, els): self.els = els self.i = 0 def peek(self): try: ...
normal
{ "blob_id": "cb08f64d1ad7e53f1041684d4ca4ef65036c138d", "index": 44, "step-1": "<mask token>\n\n\ndef is_element(el, tag):\n return isinstance(el, Tag) and el.name == tag\n\n\nclass ElemIterator:\n\n def __init__(self, els):\n self.els = els\n self.i = 0\n\n def peek(self):\n try:\n...
[ 10, 12, 14, 15, 16 ]
# Generated by Django 3.1.3 on 2020-11-19 06:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myems', '0004_auto_20201118_1446'), ] operations = [ migrations.RenameField( model_name='dg', old_name='sn', ...
normal
{ "blob_id": "11d96a8a400afb0861b92d8900e003826614c99a", "index": 7502, "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 = [('myems', '00...
[ 0, 1, 2, 3, 4 ]
""" 리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라. [12, 17, 19, 17, 23] = 17 [26, 37, 26, 37, 91] = 26, 37 [28, 30, 32, 34, 144] = 없다 최빈값 : 자료의 값 중에서 가장 많이 나타난 값 ① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다. ② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다. """ n_list = [[12, 17, 19, 17, 23], [26, 37, 26, 37, 91], [28,...
normal
{ "blob_id": "39f9341313e29a22ec5e05ce9371bf65e89c91bd", "index": 25, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor numbers in n_list:\n n_dict = {}\n for n in numbers:\n if n in n_dict:\n n_dict[n] += 1\n else:\n n_dict[n] = 1\n mode = []\n if len(n_di...
[ 0, 1, 2, 3 ]
from flask import Flask, jsonify, request import requests, json, random from bs4 import BeautifulSoup import gspread import pandas as pd import dataservices as dss from oauth2client.service_account import ServiceAccountCredentials # page = requests.get("https://www.worldometers.info/coronavirus/") # soup = BeautifulSou...
normal
{ "blob_id": "267cb37f2ccad5b02a809d9b85327eacd9a49515", "index": 1061, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello():\n return 'Flask setup'\n\n\ndef sheets_row_writer(data_list):\n print('sheets method invoked')\n credentials = ServiceAccountCredentials.from_json_keyfile_name(\n 'mec...
[ 5, 6, 9, 10, 11 ]
import numpy as np import cv2 FRAME_WIDTH = 320 FRAME_HEIGHT = 240 cv2.namedWindow('Measure Angle with centerline') # WebCam Initialize vidCapture = cv2.VideoCapture(1) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('webcam_record.avi', fourcc, 20.0, (640, 480)) while True: # ke...
normal
{ "blob_id": "500d6f473f07b35bf2d075d3061ac2e54eab702a", "index": 4156, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.namedWindow('Measure Angle with centerline')\n<mask token>\nwhile True:\n ret, frame = vidCapture.read()\n if ret == True:\n out.write(frame)\n cv2.imshow('frame',...
[ 0, 1, 2, 3, 4 ]
auto_duration_sec = 15 teleop_duration_sec = 135
normal
{ "blob_id": "5229002103379ff10969e64289d5a0f36641c0a3", "index": 3497, "step-1": "<mask token>\n", "step-2": "auto_duration_sec = 15\nteleop_duration_sec = 135\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from bs4 import BeautifulSoup from pprint import pprint from scraper.sas.sas_models import SASEvent, SASCategory, SASCategoryStage, SASEventStage from scraper.base_models.models import Event, Category, CategoryStage, EventStage, Participant, Result from scraper.sas.sas_config import DESTINATION_URL, MTB_EVENT_TYPE, YE...
normal
{ "blob_id": "ecc351cf95254e0bbc5021eff11c500fa0950bd3", "index": 2653, "step-1": "<mask token>\n\n\ndef scrape_sas():\n pprint('Scraping Events')\n get_mtb_events()\n pprint('Getting categories and stages')\n for event in db.session.query(SASEvent):\n pprint(event.event_id)\n get_catego...
[ 8, 9, 10, 11, 12 ]
from ..translators.translator import Translator
normal
{ "blob_id": "ab844143ceddf32982682f5092762af0c97db577", "index": 391, "step-1": "<mask token>\n", "step-2": "from ..translators.translator import Translator\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
__author__='rhyschris' """ Defines the set of actions. This functions exactly the same as Actions.cs in the Unity game. """ from enum import Enum class Actions(Enum): doNothing = 0 crouch = 1 jump = 3 walkTowards = 0x1 << 2 runTowards = 0x2 << 2 moveAway = 0x3 << 2 blockUp = 0x1 ...
normal
{ "blob_id": "bc0bfb0ff8eaf21b15b06eea2ea333381c70bc75", "index": 6775, "step-1": "__author__='rhyschris'\n\n\"\"\" Defines the set of actions.\n This functions exactly the same as \n Actions.cs in the Unity game.\n\"\"\"\nfrom enum import Enum\n\n\nclass Actions(Enum):\n doNothing = 0\n crouch = 1\n ...
[ 0 ]
#!/usr/local/bin/python3 def printGrid(grid): for row in grid: print(row) print("") def validFormatting(grid): if (type(grid) is not list): return False elif (len(grid) != 9): return False else: for row in grid: if (type(row) is not list): ...
normal
{ "blob_id": "67452f31a49f50cdb2555406287b31e53a994224", "index": 7906, "step-1": "<mask token>\n\n\ndef validRows(grid):\n found_zero = False\n for row in range(9):\n bit_dict = {}\n for col in range(9):\n current_item = grid[row][col]\n if current_item != 0 and current_...
[ 5, 7, 9, 12, 13 ]
from django.conf.urls import patterns, include, url from views.index import Index from views.configuracoes import Configuracoes from views.parametros import * urlpatterns = patterns('', url(r'^$', Index.as_view(), name='core_index'), url(r'^configuracoes/', Configuracoes.as_view(), name='core.core_c...
normal
{ "blob_id": "74c60c9e37e4e13ed4c61f631c3426b685b5d38f", "index": 8875, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^$', Index.as_view(), name='core_index'),\n url('^configuracoes/', Configuracoes.as_view(), name=\n 'core.core_configurations'), url('^parametros/dat...
[ 0, 1, 2, 3 ]
import json import os from subprocess import PIPE, Popen as popen from unittest import TestCase from substra.commands import Config objective = [[{ 'descriptionStorageAddress': 'http://chunantes.substrabac:8001/objective/d5002e1cd50bd5de5341df8a7b7d11b6437154b3b08f531c9b8f93889855c66f/description/', 'key': 'd...
normal
{ "blob_id": "c55b768466309d2e655c9222e0674a6bc2a958b3", "index": 9899, "step-1": "<mask token>\n\n\nclass TestList(TestCase):\n <mask token>\n <mask token>\n\n def test_list_objective(self):\n output = popen(['substra', 'list', 'objective',\n '--config=/tmp/.substra_e2e'], stdout=PIPE)...
[ 4, 6, 8, 9, 12 ]
""" Read a real number. If it is positive print it's square root, if it's not print the square of it. """ import math print('Insert a number') num1 = float(input()) if num1 > 0: print(f'The square root of {num1} is {math.sqrt(num1)}') else: print(f'The square of {num1} is {num1**2}')
normal
{ "blob_id": "a68d682ba6d441b9d7fb69ec1ee318a0ef65ed40", "index": 3146, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Insert a number')\n<mask token>\nif num1 > 0:\n print(f'The square root of {num1} is {math.sqrt(num1)}')\nelse:\n print(f'The square of {num1} is {num1 ** 2}')\n", "step-3"...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python #=============================================================================== # # Board Data File Analyzer # # Copyright (c) 2017 by QUALCOMM Atheros, Incorporated. # All Rights Reserved # QUALCOMM Atheros Confidential and Proprietary # # Notifications and licenses are retained for attribution purp...
normal
{ "blob_id": "5c12ff4f88af991fa275cd08adf3678ee4a678f3", "index": 8532, "step-1": "#!/usr/bin/python\n#===============================================================================\n#\n# Board Data File Analyzer\n#\n# Copyright (c) 2017 by QUALCOMM Atheros, Incorporated.\n# All Rights Reserved\n# QUALCOMM Ather...
[ 0 ]
def execute(n,dico): """ Prend en argument n, la position de la requête dans le dictionaire et dico le nom du dictionnaire. Renvoie une liste dont chaque élément est une réponse de la requête. """ l = [] import sqlite3 conn = sqlite3.connect('imdb.db') c = conn.cursor() c.execute(dic...
normal
{ "blob_id": "7618d7fde3774a04ac2005dad104e54b9988d3e8", "index": 9487, "step-1": "<mask token>\n\n\ndef taille_plus_grande_reponse(reponses):\n \"\"\"\n Prend en argument une liste.\n Renvoie la taille du plus grand élément de la liste.\n \"\"\"\n l = reponses\n maxi = 0\n for i in range(len...
[ 8, 11, 13, 14, 21 ]
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import func from extensions import bcrypt db = SQLAlchemy() class User(db.Model): id = db.Column(db.Integer(), primary_key=True) username = db.Column(db.String(255)) password = db.Column(db.String(255)) posts = db.relationship('Post', backref='us...
normal
{ "blob_id": "dd0e96a1f93cbffedc11262a883dda285f5c224c", "index": 9703, "step-1": "<mask token>\n\n\nclass Post(db.Model):\n id = db.Column(db.Integer(), primary_key=True)\n title = db.Column(db.String(255))\n text = db.Column(db.Text())\n date = db.Column(db.DateTime())\n user_id = db.Column(db.In...
[ 12, 17, 20, 21 ]
from django.db import models from datetime import datetime class Folder(models.Model): folder = models.CharField(max_length=200, default = "misc") num_of_entries = models.IntegerField(default=0) def __str__(self): return self.folder class Meta: verbose_name_plural = "Folders/Categories" class Bookmark(model...
normal
{ "blob_id": "ca3cdbd5d5d30be4f40925366994c3ea9d9b9614", "index": 3195, "step-1": "<mask token>\n\n\nclass Folder(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_name_plural = 'Folders/Categories'\n\n\nclass Bookmark(models.Model):\n name = models.Char...
[ 4, 5, 6, 7, 8 ]
import os from PIL import Image import urllib import json import math def download_images(a,b): image_count = 0 k = a no_of_images = b baseURL='https://graph.facebook.com/v2.2/' imgURL='/picture?type=large' sil_check='/picture?redirect=false' while image_count<no_of_images: obj=urllib.urlopen(baseURL+str(k)+s...
normal
{ "blob_id": "533154fe58511ac9c9c693bf07f076146b0c6136", "index": 4445, "step-1": "import os\nfrom PIL import Image\nimport urllib\nimport json\nimport math\n\ndef download_images(a,b):\n\timage_count = 0\n\tk = a\n\tno_of_images = b\n\tbaseURL='https://graph.facebook.com/v2.2/'\n\timgURL='/picture?type=large'\n\...
[ 0 ]
prompt = "Enter a message and I will repeat it to you: " message = " " while message != 'quit': message = input(prompt) if message != 'quit': print(message) # using the 'flag' variable prompt = "Enter a message and I will repeat it to you: " # active is the variable used in this case as flag activ...
normal
{ "blob_id": "1a6f84835ec2f5fbbb064aef2cd872c24eb3839d", "index": 8717, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile message != 'quit':\n message = input(prompt)\n if message != 'quit':\n print(message)\n<mask token>\nwhile active:\n message = input(prompt)\n if message == 'quit...
[ 0, 1, 2, 3 ]
from django.db import models from django.utils.text import slugify # Create your models here. class SponsorType(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Sponsor(models.Model): type = models.ForeignKey(SponsorType, on_delete=models.CASCADE, ...
normal
{ "blob_id": "81f0119f6f348f6d33e8d22f588fc8c2e0593d3c", "index": 1536, "step-1": "<mask token>\n\n\nclass SponsorType(models.Model):\n <mask token>\n <mask token>\n\n\nclass Sponsor(models.Model):\n type = models.ForeignKey(SponsorType, on_delete=models.CASCADE, null=True)\n id = models.AutoField(pri...
[ 5, 6, 7, 8, 9 ]
''' Created on Feb 21, 2013 @author: dharadarji ''' def get_row(row_index): entry = [1] if row_index == 0: return entry tmp = [] for i in range(1, row_index + 2): tmp = entry print "i: ", i, "tmp: ", tmp entry = [] entry.append(1) ...
normal
{ "blob_id": "2579b0c31c5f7cad361ed317f87cb8b0ffcb0098", "index": 875, "step-1": "'''\nCreated on Feb 21, 2013\n\n@author: dharadarji\n'''\n\ndef get_row(row_index):\n entry = [1]\n \n if row_index == 0:\n return entry\n \n tmp = []\n \n for i in range(1, row_index + 2):\n tmp =...
[ 0 ]