code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
import random my_randoms = random.sample(100, 10) print(my_randoms)
normal
{ "blob_id": "d39f6fca80f32a4d13764eb5cfb29999785b1d16", "index": 1629, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(my_randoms)\n", "step-3": "<mask token>\nmy_randoms = random.sample(100, 10)\nprint(my_randoms)\n", "step-4": "import random\nmy_randoms = random.sample(100, 10)\nprint(my_rando...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-10 12:20 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Complet...
normal
{ "blob_id": "d2368ab243a0660cf98f1cf89d3d8f6cc85cefaa", "index": 6384, "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 ]
import RPi.GPIO as GPIO import time from datetime import datetime led1 = [('g', 40), ('f', 38), ('a', 36), ('b', 32), ('e', 26), ('d', 24), ('c', 22)] led2 = [('g', 19), ('f', 15), ('a', 13), ('b', 11), ('e', 7), ('d', 5), ('c', 3)] numbers = [ ('a', 'b', 'c', 'd', 'e', 'f'), ('b', 'c'), ('...
normal
{ "blob_id": "0d022291f9ace02ef1ee5c462657ea6376a0e6a4", "index": 9436, "step-1": "<mask token>\n\n\ndef setupLed1():\n for port in led1:\n GPIO.setup(port[1], GPIO.OUT)\n\n\ndef setupLed2():\n for port in led2:\n GPIO.setup(port[1], GPIO.OUT)\n\n\ndef statusLed(port, status):\n GPIO.output...
[ 10, 11, 12, 13, 15 ]
from django.db import models from django.utils.safestring import mark_safe from ondoc.authentication.models import TimeStampedModel, CreatedByModel, Image import datetime from django.contrib.contenttypes.models import ContentType from django.urls import reverse from ondoc.doctor.models import Doctor, PracticeSpecializ...
normal
{ "blob_id": "9bc15f063adc7d2a5ea81d090736ab6ce66a03d4", "index": 5028, "step-1": "<mask token>\n\n\nclass ArticleLinkedUrl(TimeStampedModel):\n article = models.ForeignKey(Article, on_delete=models.CASCADE)\n url = models.CharField(max_length=2000, unique=True)\n title = models.CharField(max_length=500)...
[ 9, 18, 21, 22, 28 ]
## CreateDGNode.py # This files creates the boilerplate code for a Dependency Graph Node import FileCreator ## Class to create Maya DG node plugin files class DGNodeFileCreator(FileCreator.FileCreator): ## Constructor def __init__(self): FileCreator.FileCreator.__init__(self, "DGNodePluginData.json") self.writ...
normal
{ "blob_id": "8271935901896256b860f4e05038763709758296", "index": 4722, "step-1": "## CreateDGNode.py\n# This files creates the boilerplate code for a Dependency Graph Node\n\nimport FileCreator\n\n## Class to create Maya DG node plugin files\nclass DGNodeFileCreator(FileCreator.FileCreator):\n\n\t## Constructor\...
[ 0 ]
from django.db import models class Link(models.Model): text = models.CharField(max_length=100) link = models.URLField() def __str__(self): return self.text
normal
{ "blob_id": "61a58b934c6663e87824e4f9f9ffd92c3236947c", "index": 7930, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Link(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Link(models.Model):\n <mask token>\n <mask token>\n\n ...
[ 0, 1, 2, 3, 4 ]
from activitystreams.core import Object class Actor(Object): """Describes a generic actor.""" pass class Application(Actor): """Describes a software application.""" pass class Group(Actor): """Represents a formal or informal collective of Actors.""" pass class Organization(Actor): ""...
normal
{ "blob_id": "b92f24cddae7b392af2417b39bb4f58e3f661cc6", "index": 2785, "step-1": "<mask token>\n\n\nclass Group(Actor):\n \"\"\"Represents a formal or informal collective of Actors.\"\"\"\n pass\n\n\nclass Organization(Actor):\n \"\"\"Represents an organization.\"\"\"\n pass\n\n\nclass Person(Actor):...
[ 8, 10, 11, 12, 13 ]
from tkinter import * from PIL import ImageTk,Image import sys, os # This will display images and icon root = Tk() root.title("Expanding GUI") # With ubuntu, it did not work the icon part #root.iconbitmap('@/home/gxgarciat/Documents/Tkinter/gdrive.ico') #root.iconphoto(True, PhotoImage(file="@/home/gxgarciat/Docume...
normal
{ "blob_id": "2da10163a40c9720ca9deecd9afb0e39aa885546", "index": 5523, "step-1": "<mask token>\n", "step-2": "<mask token>\nroot.title('Expanding GUI')\n<mask token>\nmy_label.pack()\n<mask token>\nbuttonquit.pack()\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nroot.title('Expanding GUI')\nmy_im...
[ 0, 1, 2, 3, 4 ]
x, y = map(int, input().split()) print(max((y - x + 9) // 10, 0))
normal
{ "blob_id": "c9f3e956d4016846c8efe0382b79882559d6ce64", "index": 1488, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(max((y - x + 9) // 10, 0))\n", "step-3": "x, y = map(int, input().split())\nprint(max((y - x + 9) // 10, 0))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
from rdflib import Graph from rdflib.plugins.sparql import prepareQuery def is_file_ontology(file_path): """ Method that, given a file, returns its URI. This method is in a separate file in case we want to extract additional metadata if required Parameters ---------- @param file_path: path of ...
normal
{ "blob_id": "c327f8f7aece1a9c25079613809df52e9a8e7a52", "index": 8763, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_file_ontology(file_path):\n \"\"\"\n Method that, given a file, returns its URI.\n This method is in a separate file in case we want to extract additional metadata if ...
[ 0, 1, 2, 3 ]
was = input() print(was)
normal
{ "blob_id": "e12c411814efd7cc7417174b51f0f756589ca40b", "index": 3325, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(was)\n", "step-3": "was = input()\nprint(was)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
"""slack_utils.py: slack-specific utilities""" from os import path import pprint HERE = path.abspath(path.dirname(__file__)) PP = pprint.PrettyPrinter(indent=2) def parse_slack_message_object(message_obj): """parse user_name/channel_name out of slack controller Notes: `slackbot.message`.keys(): [type...
normal
{ "blob_id": "2df2cccc22aba2104ab15820e13d304addf83f63", "index": 7163, "step-1": "<mask token>\n\n\ndef parse_slack_message_object(message_obj):\n \"\"\"parse user_name/channel_name out of slack controller\n\n Notes:\n `slackbot.message`.keys(): [type, channel, user, text, ts, source_team, team]\n\n...
[ 1, 2, 3, 4, 5 ]
#! /usr/bin/env python3 import arg_parser import colors import logging import sys def parse_args(argv): parser = arg_parser.RemoteRunArgParser() return parser.parse(argv[1:]) def main(argv): logging.basicConfig( format='%(levelname)s: %(message)s', level='INFO', handlers=[colors...
normal
{ "blob_id": "72d1a0689d4cc4f78007c0cfa01611e95de76176", "index": 3908, "step-1": "<mask token>\n\n\ndef main(argv):\n logging.basicConfig(format='%(levelname)s: %(message)s', level='INFO',\n handlers=[colors.ColorizingStreamHandler(sys.stderr)])\n try:\n args = parse_args(argv)\n except Ex...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python import sys import random def apply(mine, target, diff): if mine == [1, 1, 1, 1] or target == [1, 1, 1, 1]: return -1 if diff < 0: for i in range(0, 4): if i - diff < 4: mine[i] = mine[i - diff] else: mine[i] = 0 elif diff > 0: for i in range(3, -1, -1): if i - diff > -1...
normal
{ "blob_id": "44d1412d48886eb9126a895d61004e6ccbd4850b", "index": 7636, "step-1": "#!/usr/bin/env python\nimport sys\nimport random\n\ndef apply(mine, target, diff):\n\tif mine == [1, 1, 1, 1] or target == [1, 1, 1, 1]:\n\t\treturn -1\n\n\tif diff < 0:\n\t\tfor i in range(0, 4):\n\t\t\tif i - diff < 4:\n\t\t\t\tm...
[ 0 ]
from typing import List class CourseSchedule: """ Problem: Course Schedule (#207) Key Insights: 1. Create adjaceny list of courses to prerequisites. 2. Use DFS and visited set to detect a cycle. If there is a cycle, cannot finish all the courses. 3. Remember to remove a course (node) from visi...
normal
{ "blob_id": "7c53c7bec6b6b2d4d6be89b750eeef83ca9115cc", "index": 2960, "step-1": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CourseSchedule:\n <mask token>\n\n def can_finish(self, numCourses: int, prerequisites: List[List[int]]\n ...
[ 1, 2, 3, 4 ]
import numpy as np """ function for calculating integrals using the trapezoid method x is a vector of independent variables y is a vector of dependent variables a is the initial value b is the final value n is the number of intervals y_generator is the function to be integrated """ def tra...
normal
{ "blob_id": "8ce468460a81c7869f3abb69035a033c58e0f699", "index": 8828, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef trapezoid_integral(**kwargs):\n a = kwargs.get('a', None)\n b = kwargs.get('b', None)\n n = kwargs.get('n', 2)\n y_generator = kwargs.get('y_generator', None)\n x =...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: utf-8 -*- from fieldsets import getSingleField, SortAsc from sqlalchemy import func from ladderdb import ElementNotFoundException, EmptyRankingListException from db_entities import Player, Result from bottle import route,request from globe import db,env @route('/player') def output( ):...
normal
{ "blob_id": "97d128694709c4fe0d9ec2b2749d8e4ec5df7322", "index": 8812, "step-1": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom fieldsets import getSingleField, SortAsc\nfrom sqlalchemy import func\nfrom ladderdb import ElementNotFoundException, EmptyRankingListException\nfrom db_entities import Player, Res...
[ 0 ]
import pyglet import math from lvl1_resources import fireball class Fire(pyglet.sprite.Sprite): def __init__( self, *args, **kwargs): super(Fire, self).__init__(img= fireball, *args, **kwargs) self.rotation= 45 self.rotate_speed= 5 self.velocity_x= 5 def check_bounds(self): max_x= 1000 + self.image.width/...
normal
{ "blob_id": "cf2bbe332237bd849df62be099f1719eaf1f2082", "index": 1523, "step-1": "<mask token>\n\n\nclass Fire(pyglet.sprite.Sprite):\n <mask token>\n <mask token>\n\n def update(self):\n self.rotation += self.rotate_speed\n self.x += self.velocity_x\n self.check_bounds()\n\n def...
[ 5, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- """ Created on Sun Jan 28 12:54:27 2018 @author: Alex """ import numpy as np def saveListToCSV(filepath, _list): with open(filepath,'ab') as f: np.savetxt(f, [_list], delimiter=',', fmt='%f')
normal
{ "blob_id": "555f4e41661ff4cbf4b9d72feab41ca8b7da2d5f", "index": 750, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef saveListToCSV(filepath, _list):\n with open(filepath, 'ab') as f:\n np.savetxt(f, [_list], delimiter=',', fmt='%f')\n", "step-3": "<mask token>\nimport numpy as np\n\n\...
[ 0, 1, 2, 3 ]
""" PROYECTO : Portal EDCA-HN NOMBRE : ZipTools Descripcion : Clase utilitaria para descomprimir archivos ZIP. MM/DD/YYYY Colaboradores Descripcion 05/07/2019 Alla Duenas Creacion. """ import zipfile from edca_mensajes import EdcaErrores as err, EdcaMensajes as msg from edca_logs.EdcaLogger...
normal
{ "blob_id": "1190e802fde6c2c6f48bd2720688bd9231b622e0", "index": 6564, "step-1": "<mask token>\n\n\nclass ZipTools:\n <mask token>\n\n @staticmethod\n def descomprimir(archivo, dir_extraer):\n try:\n zip_ref = zipfile.ZipFile(archivo, 'r')\n zip_list = zip_ref.infolist()\n ...
[ 2, 3, 4, 5, 6 ]
C = {i:0 for i in range(9)} N = int(input()) A = list(map(int,input().split())) for i in range(N): a = A[i] if a<400: C[0] += 1 elif a<800: C[1] += 1 elif a<1200: C[2] += 1 elif a<1600: C[3] += 1 elif a<2000: C[4] += 1 elif a<2400: C[5] += 1 ...
normal
{ "blob_id": "a1ca6c258298feda99b568f236611c1c496e3262", "index": 8993, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n a = A[i]\n if a < 400:\n C[0] += 1\n elif a < 800:\n C[1] += 1\n elif a < 1200:\n C[2] += 1\n elif a < 1600:\n C[3] += 1\n ...
[ 0, 1, 2, 3 ]
from rest_framework import serializers from .models import Backend class BackendSerializer(serializers.ModelSerializer): class Meta: model = Backend fields = '__all__'
normal
{ "blob_id": "b4787d65fb8adf5dc6a99c1a13922c8f9acc2087", "index": 1971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BackendSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Backend\n fields = '__all__'\n", "step-3": "from rest_framework import serializers...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Mon Feb 20 17:13:46 2017 @author: pmonnot """ import blpapi import datetime # Create a Session session = blpapi.Session() # Start a Session if not session.start(): print "Failed to start session." if not session.openService("//blp/refdata"): print "Faile...
normal
{ "blob_id": "a8a2d672369f61c6412229380cc6097d152ba126", "index": 9883, "step-1": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Mon Feb 20 17:13:46 2017\r\n\r\n@author: pmonnot\r\n\"\"\"\r\n\r\nimport blpapi\r\nimport datetime\r\n\r\n# Create a Session\r\nsession = blpapi.Session()\r\n# Start a Session\r\nif n...
[ 0 ]
from django.db import models class Kit(models.Model): name = models.CharField(max_length=100, null=True) main_image_url = models.URLField(max_length=1000) price = models.DecimalField(max_digits=10, decimal_places=2, default=0) description = models.CharField(max_length=1000, null=True) class Meta...
normal
{ "blob_id": "ea2183530667437e086bc89f137e464dec6f363a", "index": 1800, "step-1": "<mask token>\n\n\nclass KitSubImageUrl(models.Model):\n image_url = models.URLField(max_length=1000)\n kit = models.ForeignKey('kit.Kit', on_delete=models.CASCADE)\n\n\n class Meta:\n db_table = 'kit_sub_image_urls'...
[ 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- # # Copyright (C) 2011 Taobao .Inc # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://code.taobao.org/license.html. # # This software consists of voluntary ...
normal
{ "blob_id": "bacd0c729193f064b21ab8e01e98dfc276094458", "index": 7853, "step-1": "<mask token>\n\n\ndef need_owner(view_func):\n\n def _wrapped_view(request, *args, **kwargs):\n rc = request.rc\n rc.project = q_get(Project, name=kwargs['name'], status=consts.\n PROJECT_ENABLE)\n ...
[ 7, 14, 16, 17, 18 ]
a = range(10) [x*x for x in a]
normal
{ "blob_id": "018b9533074d2766dc5010ff9c5e70888d249b45", "index": 1832, "step-1": "<mask token>\n", "step-2": "<mask token>\n[(x * x) for x in a]\n", "step-3": "a = range(10)\n[(x * x) for x in a]\n", "step-4": "a = range(10)\n[x*x for x in a]\n", "step-5": null, "step-ids": [ 0, 1, 2, 3...
[ 0, 1, 2, 3 ]
""" Supreme bot???? """ import os import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait import selenium.webdriver.support.expected_conditions as EC from selenium.common.exceptions import TimeoutException from selenium.webdriver.ch...
normal
{ "blob_id": "8fed95cf809afca7b6008d5abcdcf697367a33c2", "index": 2929, "step-1": "\"\"\"\nSupreme bot????\n\n\"\"\"\nimport os\nimport time\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nimport selenium.webdriver.support.expe...
[ 0 ]
from unittest import TestCase from utils.fileutils import is_empty_dir, clear_attributes class FileUtilsTest(TestCase): def test_is_empty_dir(self): self.assertFalse(is_empty_dir(r'c:\Windows')) def test_clear_attributes(self): clear_attributes(__file__)
normal
{ "blob_id": "89059915df8891efcbe742174bd468a1390598e3", "index": 3001, "step-1": "<mask token>\n\n\nclass FileUtilsTest(TestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FileUtilsTest(TestCase):\n <mask token>\n\n def test_clear_attributes(self):\n clear_attribu...
[ 1, 2, 3, 4, 5 ]
from django.urls import re_path from .consumers import ChatConsumer, ChatLobbyConsumer websocket_urlpatterns = [ re_path(r'ws/chat/(?P<room_id>\w+)/$', ChatConsumer), re_path(r'ws/lobby/$', ChatLobbyConsumer), ]
normal
{ "blob_id": "1bd1769f94b93e0bb674adfd1bb96c778708f6d8", "index": 5593, "step-1": "<mask token>\n", "step-2": "<mask token>\nwebsocket_urlpatterns = [re_path('ws/chat/(?P<room_id>\\\\w+)/$',\n ChatConsumer), re_path('ws/lobby/$', ChatLobbyConsumer)]\n", "step-3": "from django.urls import re_path\nfrom .con...
[ 0, 1, 2, 3 ]
from core.detector import Detector from utils.augmentations import * from torchvision.transforms.transforms import Compose from config.mask_config import * from config.train_config import model_info np.random.seed(3) colors = np.random.randint(128, 256, (100, 3)) def to_image(det): size = 512 val_trans = [...
normal
{ "blob_id": "97e7ca02d85267492a0dcbbda9d8754a0a3735a5", "index": 5315, "step-1": "<mask token>\n\n\ndef to_image(det):\n size = 512\n val_trans = [Normalization([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])]\n val_trans = Compose(val_trans)\n for i in range(5, 200):\n path = f'D:/temp_data/mask/test/{i}.j...
[ 2, 3, 4, 5, 6 ]
s=input() count=0 while(len(s)!=1): count+=1 a=0 for i in range(len(s)): a+=int(s[i]) s=str(a) print(count)
normal
{ "blob_id": "638e21e1eb1e2e14244628260d9c7ac179983721", "index": 2541, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile len(s) != 1:\n count += 1\n a = 0\n for i in range(len(s)):\n a += int(s[i])\n s = str(a)\nprint(count)\n", "step-3": "s = input()\ncount = 0\nwhile len(s) != 1...
[ 0, 1, 2, 3 ]
"""Changed Views table name Revision ID: 7f559bb24ca4 Revises: cc927fe47c8f Create Date: 2021-08-20 23:20:31.959984 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "7f559bb24ca4" down_revision = "cc927fe47c8f" branch_labels = None depends_on = None def upgrade...
normal
{ "blob_id": "fd2b60de2ef540264855f04e1c5bcb9d1cf23c51", "index": 9561, "step-1": "<mask token>\n\n\ndef upgrade():\n op.create_table('views', sa.Column('id', sa.Integer(), autoincrement=\n True, nullable=False), sa.Column('url_id', sa.String(length=31),\n nullable=True), sa.ForeignKeyConstraint(...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # encoding=utf-8 import MySQLdb import re # 打开数据库连接 db = MySQLdb.connect(host='wonderfulloffline.mysql.rds.aliyuncs.com',port=3306,user='wonderfull_ai',password='868wxRHrPaTKkjvC', db='wonderfull_ai_online', charset='utf8' ) def load_stop_word(): stop_word=set() with open("data...
normal
{ "blob_id": "4942b20a8e4f58c52b82800fb4c59db169cd8048", "index": 3562, "step-1": "<mask token>\n\n\ndef load_stop_word():\n stop_word = set()\n with open('data/stop_word.txt', 'r', encoding='utf-8') as file:\n for line in file.readlines():\n stop_word.add(line.strip())\n return stop_wo...
[ 2, 3, 4, 5, 7 ]
# -*- coding: utf-8 -*- import requests import csv from lxml import html import json class ycombinatorParser(): siteurl = 'https://news.ycombinator.com/' def getNextPage(pageurl): response = requests.get(pageurl) parsed_body = html.fromstring(response.text) nextpage=parsed_body.xpa...
normal
{ "blob_id": "87c27711c0089ca2c7e5c7d0e9edb51b9d4008d9", "index": 6717, "step-1": "<mask token>\n\n\nclass ycombinatorParser:\n <mask token>\n\n def getNextPage(pageurl):\n response = requests.get(pageurl)\n parsed_body = html.fromstring(response.text)\n nextpage = parsed_body.xpath('//...
[ 3, 4, 5, 6, 7 ]
#dependencies go here import numpy as np import datetime as dt from datetime import timedelta import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify #Set up the engine to connect to HW8 datab...
normal
{ "blob_id": "7ab964352c1d51b70e3a1a7bf0a624f2d96cfd55", "index": 8168, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n \"\"\"List all available api routes.\"\"\"\n return (\n f'Available Routes:<br/>/api/v1.0/precipitation<br/>/api/v1.0/stations<br/>/api/v1.0/tobs<br/>/api/v1.0/<start><b...
[ 3, 6, 7, 9, 10 ]
""" Mount /sys/fs/cgroup Option """ from typing import Callable import click def cgroup_mount_option(command: Callable[..., None]) -> Callable[..., None]: """ Option for choosing to mount `/sys/fs/cgroup` into the container. """ function = click.option( '--mount-sys-fs-cgroup/--no-mount-sys-...
normal
{ "blob_id": "237f5e2e37187e26b5628032e37d3a525ef72b9a", "index": 7261, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cgroup_mount_option(command: Callable[..., None]) ->Callable[..., None]:\n \"\"\"\n Option for choosing to mount `/sys/fs/cgroup` into the container.\n \"\"\"\n functi...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.1 on 2020-10-29 13:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registered_user', '0005_auto_20201029_1710'), ] operations = [ migrations.AlterField( model_name='user_details', nam...
normal
{ "blob_id": "f2c96b3133137019dc6bd462f096f3b4c5f12648", "index": 6635, "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 = [('registered_...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # coding: utf-8 #%%: import secrets import hashlib import base64 import ecdsa from sys import byteorder #%%: class k_box: def __init__(self, string = 0, file = 0): if string != 0: if not(len(string) == 64): raise Exception("Bad len") self.__pr...
normal
{ "blob_id": "1ff2f06349ab1906a1649bdb83828fbdb3cf584f", "index": 4516, "step-1": "<mask token>\n\n\nclass k_box:\n\n def __init__(self, string=0, file=0):\n if string != 0:\n if not len(string) == 64:\n raise Exception('Bad len')\n self.__priv_key = bytes.fromhex(st...
[ 9, 12, 14, 16, 18 ]
from .isearch import ISearcher __all__ = ['ISearcher']
normal
{ "blob_id": "13e2f474294edb7c78bd81456097d1389e6a0f1b", "index": 5003, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['ISearcher']\n", "step-3": "from .isearch import ISearcher\n__all__ = ['ISearcher']\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
DEBUG = True ADMINS = frozenset(["briandowe@gmail.com"])
normal
{ "blob_id": "68bade5767d4f418bcae07485a179df5e47e652c", "index": 9066, "step-1": "<mask token>\n", "step-2": "DEBUG = True\nADMINS = frozenset(['briandowe@gmail.com'])\n", "step-3": "DEBUG = True\nADMINS = frozenset([\"briandowe@gmail.com\"])", "step-4": null, "step-5": null, "step-ids": [ 0, 1...
[ 0, 1, 2 ]
a = int(input('점수를 입력하세요')) if a >= 70 : print:('통과입니다.') print:('축하합니다.') else : print:('불합격입니다.') print("안녕")
normal
{ "blob_id": "f8d0cc9cb0e5f8adf9077ffb39dd6abedfedaa12", "index": 5427, "step-1": "<mask token>\n", "step-2": "<mask token>\nif a >= 70:\n print: '통과입니다.'\n print: '축하합니다.'\nelse:\n print: '불합격입니다.'\nprint('안녕')\n", "step-3": "a = int(input('점수를 입력하세요'))\nif a >= 70:\n print: '통과입니다.'\n print: ...
[ 0, 1, 2, 3 ]
#!/software/python-2.7-2014q3-el6-x86_64/bin/python import SNANA_Reader as simread import REAL_Reader as dataread #import astropy.cosmology as cosmo import traceback import scipy import scipy.stats as stats import numpy as np import matplotlib.pyplot as plt plt.switch_backend('Agg') #import Cosmology import scipy.stats...
normal
{ "blob_id": "27976e9f7fbe030910b3595ea1a13e0e505183e5", "index": 7131, "step-1": "#!/software/python-2.7-2014q3-el6-x86_64/bin/python\nimport SNANA_Reader as simread\nimport REAL_Reader as dataread\n#import astropy.cosmology as cosmo\nimport traceback\nimport scipy\nimport scipy.stats as stats\nimport numpy as n...
[ 0 ]
from collections import defaultdict, namedtuple from color import RGB, clamp import math import controls_model as controls from eyes import Eye, MutableEye from geom import ALL #from icicles.ice_geom import ALL def load_geometry(mapfile): """ Load sheep neighbor geometry Returns a map { panel: [(edge-ne...
normal
{ "blob_id": "fe01b78d29dc456f7a537dd5639bc658fc184e36", "index": 5035, "step-1": "from collections import defaultdict, namedtuple\nfrom color import RGB, clamp\n\nimport math\n\nimport controls_model as controls\nfrom eyes import Eye, MutableEye\n\nfrom geom import ALL\n#from icicles.ice_geom import ALL\n\ndef l...
[ 0 ]
from sklearn.linear_model import LinearRegression, LogisticRegression import numpy as np import pickle import os def Run(datasetFile): # Get file from user userFile = open(datasetFile, "r") # Starter list of all instances of the data file instanceList = [] instanceCount = 0 featureCou...
normal
{ "blob_id": "ee7efea569b685ad8d6922e403421227e9ea6922", "index": 6277, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Run(datasetFile):\n userFile = open(datasetFile, 'r')\n instanceList = []\n instanceCount = 0\n featureCount = 0\n for instance in userFile:\n tempStr = inst...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from selenium.webdriver.common.keys import Keys from titan.components import Base class Input(Base): def clear(self): element = self.driver.find_element_by_xpath(self.params['xpath']) if self.params.get('clear', None): element.clear() return True ...
normal
{ "blob_id": "7503a0c8f83ff0ce370ed7bce733b09d9a2c69c4", "index": 817, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Input(Base):\n\n def clear(self):\n element = self.driver.find_element_by_xpath(self.params['xpath'])\n if self.params.get('clear', None):\n element.c...
[ 0, 2, 3, 4, 5 ]
import kwic mystr = "hello world\nmy test\napples oranges" #asseirt(kwic0.kwic(mystr) == []) #assert(kwic1.kwic(mystr) == [mystr]) #assert(len(kwic3.kwic(mystr))==2) assert len(kwic.kwic(mystr)) == 3
normal
{ "blob_id": "1f21fdc9a198b31bb0d5bd6dd8f46a1b3b28ec94", "index": 6773, "step-1": "<mask token>\n", "step-2": "<mask token>\nassert len(kwic.kwic(mystr)) == 3\n", "step-3": "<mask token>\nmystr = \"\"\"hello world\nmy test\napples oranges\"\"\"\nassert len(kwic.kwic(mystr)) == 3\n", "step-4": "import kwic\n...
[ 0, 1, 2, 3, 4 ]
dic = {} try: print(dic[55]) except Exception as err: print('Mensagem: ', err)
normal
{ "blob_id": "618aa64c08ebf8d9a0bc9662195ece2bbd485c17", "index": 1079, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err)\n", "step-3": "dic = {}\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err...
[ 0, 1, 2 ]
# Generated by Django 2.1.5 on 2019-01-20 18:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Destination', fields=[ ...
normal
{ "blob_id": "6907a1e08d728732eebf81fec7c0dab8729448e2", "index": 9712, "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 ]
# %% import libs import os import argparse import logging as logger import mxnet as mx import tqdm from mxnet import autograd from mxnet import gluon from gluoncv.utils import makedirs import datasets as gan_datasets from utils import vis, get_cpus, TrainingHistory import models mx.random.seed(5) logger.basicConfig(l...
normal
{ "blob_id": "c14d76493cd3dacc55c993f588dec555b7a4a13c", "index": 4192, "step-1": "<mask token>\n\n\ndef make_noises(bs):\n return mx.nd.random_normal(0, 1, shape=(bs, 512), ctx=CTX, dtype='float32'\n ).reshape((bs, 512, 1, 1))\n\n\n<mask token>\n", "step-2": "<mask token>\nmx.random.seed(5)\nlogger.b...
[ 1, 3, 4, 5, 6 ]
from time import time class Task: def __init__(self, f, ready: float): self._f = f self._ready = ready def set_ready(self, ready: float) -> None: self._ready = ready def get_ready(self) -> float: return self._ready def __call__(self) -> None: self._f() de...
normal
{ "blob_id": "b094693b11fdc4f5fbff30e79a9f82d40104611d", "index": 2697, "step-1": "<mask token>\n\n\nclass Task:\n <mask token>\n\n def set_ready(self, ready: float) ->None:\n self._ready = ready\n <mask token>\n\n def __call__(self) ->None:\n self._f()\n <mask token>\n\n def __str...
[ 4, 5, 6, 7, 9 ]
""" Program file: DataParser.py. This program parses and returns a dataset for a plotting program """ from sys import exit from csv import Sniffer, DictReader class DataParser: """ Summary: parses a data file, and returns list of the filtered data. Instances: 1. accepted_records 2. ignored_reco...
normal
{ "blob_id": "af609f1558276bab96477d3a2c61d813b9dd3d82", "index": 9660, "step-1": "<mask token>\n\n\nclass DataParser:\n <mask token>\n\n def __init__(self, csvfile, data_centers):\n \"\"\"DataParser constructor.\"\"\"\n self.accepted_records = []\n self.ignored_records = []\n wi...
[ 5, 6, 7, 8, 9 ]
import random import numpy as np import pandas as pd def linear_combination_plus_error(X, num_dependent_cols=5, parameter_mean=0, parameter_std=1, error_mean=0, error_std=1): """ Generate a column that is a random linear combination of X1, X2 and X3 plus some random error """ length = X.shape[0] ...
normal
{ "blob_id": "48f2cc5b6d53c7317ad882947cabbc367cda0fb7", "index": 905, "step-1": "<mask token>\n\n\ndef linear_combination_plus_error(X, num_dependent_cols=5, parameter_mean=0,\n parameter_std=1, error_mean=0, error_std=1):\n \"\"\"\n Generate a column that is a random linear combination of\n X1, X2 a...
[ 1, 2, 3, 4, 5 ]
''' Created on June 24, 2019 @author: Andrew Habib ''' import json import jsonref import sys from jsonsubschema.api import isSubschema def main(): assert len( sys.argv) == 3, "jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema" s1_file = sys.argv[1] s2_file = sys.argv[2] ...
normal
{ "blob_id": "ba78a1e29736c4f109a0efc6f5b9993994661058", "index": 3527, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n assert len(sys.argv\n ) == 3, 'jsonsubschema cli takes exactly two arguments lhs_schema and rhs_schema'\n s1_file = sys.argv[1]\n s2_file = sys.argv[2]\n...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.2 on 2021-02-13 14:40 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('post', '0014_profilepic_user'), ] operations = [ migrations.CreateModel( name='profile_pic', fields=[ ...
normal
{ "blob_id": "bf05a096956ca4f256832e2fc6659d42c5611796", "index": 6712, "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 = [('post', '001...
[ 0, 1, 2, 3, 4 ]
#%% # -*- coding: utf-8 -*- import numpy as np import plotly from plotly.subplots import make_subplots import plotly.graph_objects as go import pandas as pd import os output_directory = r'C:/Users/jgamm/Desktop/rssi_measurement/2020-06-10/figures' antennas = ['original_whip'] folder = r'C:/Users/jgamm/Desktop/rssi_me...
normal
{ "blob_id": "3d3b9956a98f11a170d66280abe7f193cef9ccfb", "index": 808, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i_angle in np.arange(0, 360, 45):\n ri_filenames.append('r%di%d.csv' % (i_angle, i_angle))\n ri_filenames.append('r%di%d.csv' % (i_angle + 45, i_angle))\nri_filenames.append('r36...
[ 0, 1, 2, 3, 4 ]
import mxnet as mx import numpy as np import cv2 import random class Even_iterator(mx.io.DataIter): ''' data iterator, shuffle data but always make pairs as neighbors for verification and triplet loss ''' def __init__(self, lst_name, batch_size, aug_params=dict(), shuffle=False): super(Eve...
normal
{ "blob_id": "a824bd7577134227f5c136f2a4382c056f1175be", "index": 9663, "step-1": "import mxnet as mx\nimport numpy as np\nimport cv2\nimport random\n\n\nclass Even_iterator(mx.io.DataIter):\n '''\n data iterator, shuffle data but always make pairs as neighbors\n for verification and triplet loss\n ''...
[ 0 ]
# -*- coding: utf-8 -*- from nose.tools import * # noqa import mock import httpretty from tests.base import OsfTestCase from tests.factories import AuthUserFactory, ProjectFactory import urlparse from framework.auth import Auth from website.addons.mendeley.tests.factories import ( MendeleyAccountFactory, ...
normal
{ "blob_id": "f69351474fb3eb48eeb65eaf1aa46d2f4a390471", "index": 1887, "step-1": "<mask token>\n\n\nclass MendeleyViewsTestCase(OsfTestCase):\n\n def setUp(self):\n super(MendeleyViewsTestCase, self).setUp()\n self.account = MendeleyAccountFactory()\n self.user = AuthUserFactory(external_...
[ 11, 14, 16, 20, 25 ]
# -*- coding: utf-8 -*- from qav5.http.client import BaseClient from qav5.http.helper import api from qav5.utils import Bunch, low_case_to_camelcase class AppusersClient(BaseClient): def __init__(self, base_url, access_token=None, **kwargs): super().__init__(base_url, kwargs) self.access_token = ...
normal
{ "blob_id": "1af6bda6eb4e7a46b22379180ea82e78c67ce771", "index": 4269, "step-1": "<mask token>\n\n\nclass AppusersClient(BaseClient):\n <mask token>\n\n @api(rule='/app_users/app_order_create_info', method='get', is_json_req\n =True)\n def app_order_create_info(self, order_id: int=None):\n ...
[ 3, 4, 6, 7, 8 ]
import numpy as np import pytest import torch from ignite.contrib.metrics.regression import MeanNormalizedBias from ignite.engine import Engine from ignite.exceptions import NotComputableError def test_zero_sample(): m = MeanNormalizedBias() with pytest.raises( NotComputableError, match=r"MeanNormali...
normal
{ "blob_id": "452f35fe2ae9609949a3f92ad7768fc37094a2f1", "index": 3786, "step-1": "<mask token>\n\n\ndef test_zero_sample():\n m = MeanNormalizedBias()\n with pytest.raises(NotComputableError, match=\n 'MeanNormalizedBias must have at least one example before it can be computed'\n ):\n ...
[ 3, 4, 5, 6, 7 ]
import random import cv2 img = cv2.imread('assets/logo.jpg', -1) print(img.shape) #3 channels, bgr #look at the 257. row and pixel 400 --> has bgr values: [41 98 243] print(img[257][400]) ''' # manipulate the first 100 rows, all columns, and randomize the 3 pixel values # (rows, colums, pixels) where pixels: b,g,...
normal
{ "blob_id": "35e66e5e154f5cd70f187a1cde33cef71102e1a6", "index": 6829, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(img.shape)\nprint(img[257][400])\n<mask token>\ncv2.imshow('Image', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('assets/logo.jpg', ...
[ 0, 1, 2, 3, 4 ]
# Create your models here. from django.db import models from django.utils import timezone from django.db import models # Create your models here. #필드 개수가 다르다. class Post(models.Model): #이 Post의 저자이다라는 의미, CASCADE : 종속이라는 의미 author = models.ForeignKey('auth.User', on_delete=models.CASCADE) title = models.C...
normal
{ "blob_id": "fe5398b03d2f0cfc7c972677faa0ea3ec701469e", "index": 7858, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def publish(self):\n self.published_date = timezone.now()\n self.save()\n ...
[ 2, 3, 4, 5, 6 ]
# find the 12-digit number formed by concatenating a series of 3 4-digit # numbers who are permutations of each other and are all prime from itertools import permutations, dropwhile from pe_utils import prime_sieve prime_set = set(prime_sieve(10000)) def perm(n, inc): perm_set = set(map(lambda x: int("".join(x))...
normal
{ "blob_id": "e03290746d6520fde63836e917f6af0c76596704", "index": 3816, "step-1": "<mask token>\n\n\ndef perm(n, inc):\n perm_set = set(map(lambda x: int(''.join(x)), permutations(str(n))))\n perms = n, n + inc, n + inc * 2\n if any(map(lambda x: x not in prime_set or x not in perm_set, perms)):\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python3 # Copyright (c) 2018 Nobody # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test perforance of descendant package (chained transactions)""" import time import copy from test_framework.test_framework import...
normal
{ "blob_id": "661eef8500309191514fd760b7518014dee2bb5f", "index": 9225, "step-1": "<mask token>\n\n\nclass ChainedTest(BitcoinTestFramework):\n\n def set_test_params(self):\n \"\"\" our test network requires a peer node so that getblocktemplate succeeds \"\"\"\n self.num_nodes = 2\n chaine...
[ 7, 8, 9, 10, 13 ]
# -*- coding: utf-8 -*- from Clases import Lugar from Clases import Evento import Dialogos import Funciones puntuacion_necesaria = 10 hp_inicial = 5 eventos = [ Evento("dormir", 2, False, -3, 4, Dialogos.descripciones_eventos[0], Dialogos.descripciones_triunfos[0], Dialogos.descripciones...
normal
{ "blob_id": "fe45fc6cd16be37b320844c5a8b43a964c016dd1", "index": 5018, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(Dialogos.saludo[0])\n<mask token>\nprint('\\nHola', nombre, 'tienes,', edad, 'años.')\nif edad >= 18:\n print('¡Tienes edad suficiente para jugar!')\n quiere_jugar = input('¿Q...
[ 0, 1, 2, 3, 4 ]
import collections import datetime import os import pickle import random import time from lastfm_utils import PlainRNNDataHandler from test_util import Tester reddit = "subreddit" lastfm = "lastfm" instacart = "instacart" # # Choose dataset here # dataset = lastfm # # Specify the correct path to the dataset # datase...
normal
{ "blob_id": "9e8ddf6c35ebad329e1f5a48513e4bfaae0d9a6f", "index": 4925, "step-1": "<mask token>\n\n\ndef log_config(baseline):\n message = (\n '------------------------------------------------------------------------'\n )\n message += '\\nDATASET: ' + dataset\n message += '\\nBASELINE: ' + ...
[ 4, 6, 7, 8, 9 ]
#!/usr/bin/python3 import requests import urllib3 urllib3.disable_warnings() response = requests.get('https://freeaeskey.xyz', verify=False) data = response.text.encode('utf-8') key = data[data.index(b'<b>')+3:data.index(b'</b>')] print(key.decode('ascii'))
normal
{ "blob_id": "368e209f83cc0cade81791c8357e01e7e3f940c8", "index": 97, "step-1": "<mask token>\n", "step-2": "<mask token>\nurllib3.disable_warnings()\n<mask token>\nprint(key.decode('ascii'))\n", "step-3": "<mask token>\nurllib3.disable_warnings()\nresponse = requests.get('https://freeaeskey.xyz', verify=Fals...
[ 0, 1, 2, 3, 4 ]
from .alexnet import * from .lenet import * from .net import * from .vae import *
normal
{ "blob_id": "56d5915d30e85285da549cc69ef25714bacc6f3a", "index": 8304, "step-1": "<mask token>\n", "step-2": "from .alexnet import *\nfrom .lenet import *\nfrom .net import *\nfrom .vae import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# python3 from random import randint def partition3(array, left, right): pivot = array[right] begin = left - 1 end = left - 1 for j in range(left, right): if array[j] < pivot: begin += 1 array[begin], array[j] = array[j], array[begin] end += 1 i...
normal
{ "blob_id": "a2fc9d947c75eaaaeafcd92750c99f4cfcdb9d7d", "index": 4517, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef partition3(array, left, right):\n pivot = array[right]\n begin = left - 1\n end = left - 1\n for j in range(left, right):\n if array[j] < pivot:\n be...
[ 0, 2, 3, 4, 5 ]
# Generated by Django 3.2.3 on 2021-06-01 07:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('info', '0002_auto_20210531_1958'), ] operations = [ migrations.AddField( model_name='well', name='well_status', ...
normal
{ "blob_id": "a3239bbe4f85c9f0e1bc845245f024c3feb64923", "index": 7476, "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 = [('info', '000...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 14 01:32:26 2019 @author: himanshu """ import numpy as np from scipy.interpolate import interp1d from option import Option class FFTPricing: def __init__(self, option : Option, riskFreeRate, ...
normal
{ "blob_id": "25987c15c28e3939f9f531dbc1d4bd9bf622b5a9", "index": 5691, "step-1": "<mask token>\n\n\nclass FFTPricing:\n\n def __init__(self, option: Option, riskFreeRate, volatility,\n samplePoints, bandwidth, dampingFactor, underlyingModel='GBM'):\n self.__option = option\n self.__r = ri...
[ 5, 6, 7, 8, 9 ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^class/([^/]+)/?$', views.puppet_class, name='puppet-class'), url(r'^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'), url(r'^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='add-host'), url(r'^delete/([^/...
normal
{ "blob_id": "add56d52f3c88f814a166d12c3bc5a5906268864", "index": 484, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^class/([^/]+)/?$', views.puppet_class, name=\n 'puppet-class'), url('^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host,\n name='edit-host'), url('^add-host/(?P<fq...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # Copyright (c) 2020 Maryushi3 import emoji_data_python as edp import sys import pyautogui from Xlib import display from PyQt5.QtWidgets import QApplication, QGridLayout, QLabel, QLineEdit, QScrollArea, QSizePolicy, QStackedLayout, QVBoxLayout, QWidget from PyQt5.QtCore import QEvent, QSettings, Qt, ...
normal
{ "blob_id": "c860c1fa6e7610c60077f0eab1572895a23393fd", "index": 3725, "step-1": "<mask token>\n\n\ndef fill_grid_with_char_list(charList):\n global emojiToShowCount\n global fullRowsCount\n global lastRowEmojiCount\n emojiToShowCount = min(len(charList), emojiGridColumnCount *\n emojiGridRowC...
[ 17, 19, 21, 24, 29 ]
from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() for name, hexcode in zip(cs.colornames, cs.colors): print('%s: %s' % (hexcode, name)) fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')
normal
{ "blob_id": "7106a8ddbec60ce4b7d9e8e5ce8d7df02e5f7222", "index": 6854, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor name, hexcode in zip(cs.colornames, cs.colors):\n print('%s: %s' % (hexcode, name))\n<mask token>\ncs.example_plot(ax)\nfig.savefig('latest.png', dpi=200, bbox_inches='tight')\n", ...
[ 0, 1, 2, 3 ]
#################################################################################### # # Kaggle Competition: https://www.kaggle.com/c/msk-redefining-cancer-treatment # Sponsor : Memorial Sloan Kettering Cancer Center (MSKCC) # Author: Amrut Shintre # #####################################################################...
normal
{ "blob_id": "1305991a9cd82ddeaffff1545a35ced992e6792f", "index": 7300, "step-1": "<mask token>\n\n\ndef text_cleaning(text_df):\n corpus = []\n for i in range(len(text_df)):\n text = re.sub('[^a-zA-Z]', ' ', text_df['Text'][i])\n text = text.lower()\n text = text.split()\n ps = ...
[ 4, 5, 6, 7, 8 ]
n = int(input()) lista = [] for i in range(n): inp = int(input()) lista.append(inp) lista.sort(reverse=True) print(lista[0]) print(lista[1])
normal
{ "blob_id": "b03960999fa30a55932ada7fbf731a3861b840ae", "index": 3496, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n inp = int(input())\n lista.append(inp)\nlista.sort(reverse=True)\nprint(lista[0])\nprint(lista[1])\n", "step-3": "n = int(input())\nlista = []\nfor i in range...
[ 0, 1, 2 ]
# vim: set et ts=4 sw=4 fileencoding=utf-8: ''' tests.integration.test_pipeline =============================== ''' import unittest import yaml import subprocess import time import pickle from datetime import datetime from amqp.exceptions import ChannelError from yalp.config import settings @unittest.skip('need to...
normal
{ "blob_id": "c945dc4df68fe110e8b38713fb77e2dce9efad8d", "index": 8418, "step-1": "<mask token>\n\n\n@unittest.skip('need to make this less brittle')\nclass TestSerialization(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_default_serializer(self):\n from yalp.pipe...
[ 2, 4, 5, 6, 7 ]
# -*- coding: utf-8 -*- """ Created on Sun Sep 10 12:18:06 2017 @author: wqmike123 """ #%% build a simple CNN with gloVec as initial from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers impo...
normal
{ "blob_id": "e235be879cf8a00eb9f39f90859689a29b26f1c6", "index": 3161, "step-1": "<mask token>\n\n\nclass cnn:\n\n def __init__(self, maxlen, max_voc, embedweight=None, embedding_dims=\n 300, batch_size=30, filters=1024, conv_kernel=3, hidden_dim=2048,\n epochs=20, output_dim=2, dropout=0.1, tra...
[ 4, 5, 7, 8, 9 ]
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 12:28:39 2020 @author: Ксения """ import serial import time import serial.tools.list_ports as lp def get_comports_list(): ports=list(lp.comports(include_links=False)) for p in ports: print(p.device) return ports def read_while_LF(com, timeout...
normal
{ "blob_id": "e08fddefabf1b92aa97b939e05bb31d888df4e6a", "index": 2241, "step-1": "<mask token>\n\n\ndef get_comports_list():\n ports = list(lp.comports(include_links=False))\n for p in ports:\n print(p.device)\n return ports\n\n\ndef read_while_LF(com, timeout_ms=500):\n read_data = ''\n de...
[ 3, 4, 5, 6, 7 ]
import time with open("src/time.txt", "w") as f: f.write(str(int(time.time())))
normal
{ "blob_id": "0058a6d3c9d4e600885b876614362ea4401ce2fe", "index": 1640, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('src/time.txt', 'w') as f:\n f.write(str(int(time.time())))\n", "step-3": "import time\nwith open('src/time.txt', 'w') as f:\n f.write(str(int(time.time())))\n", "step...
[ 0, 1, 2, 3 ]
#!/usr/bin/python #import Bio def findLCS(read, cassette, rIndex, cIndex,cassettes): LCS='' while True: if read[rIndex] == cassette[cIndex]: LCS+= read[rIndex] rIndex= rIndex +1 cIndex= cIndex +1 #elif checkLCS(cIndex,cassettes)==True: else: break #print(LCS) ret...
normal
{ "blob_id": "5cec9e82aa994d07e25d8356a8218fc461bb8b4e", "index": 4728, "step-1": "def findLCS(read, cassette, rIndex, cIndex, cassettes):\n LCS = ''\n while True:\n if read[rIndex] == cassette[cIndex]:\n LCS += read[rIndex]\n rIndex = rIndex + 1\n cIndex = cIndex + 1...
[ 4, 5, 6, 7, 9 ]
def longest(s1, s2): # your code s=s1+s2 st="".join(sorted(set(s))) return st longest("xyaabbbccccdefww","xxxxyyyyabklmopq")
normal
{ "blob_id": "7d54d5fd855c7c03d2d4739e8ad4f9ab8772ca2b", "index": 3977, "step-1": "<mask token>\n", "step-2": "def longest(s1, s2):\n s = s1 + s2\n st = ''.join(sorted(set(s)))\n return st\n\n\n<mask token>\n", "step-3": "def longest(s1, s2):\n s = s1 + s2\n st = ''.join(sorted(set(s)))\n re...
[ 0, 1, 2, 3 ]
import numpy as np n = int(input()) a = [list(map(int, input().split())) for _ in range(n)] b = [list(map(int, input().split())) for _ in range(n)] a = np.array(a) b = np.array(b) print(np.dot(a, b))
normal
{ "blob_id": "17b8fec5583f2544bd02a2409528082fa1dc2a1e", "index": 4107, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(np.dot(a, b))\n", "step-3": "<mask token>\nn = int(input())\na = [list(map(int, input().split())) for _ in range(n)]\nb = [list(map(int, input().split())) for _ in range(n)]\na = ...
[ 0, 1, 2, 3 ]
# # Copyright (C) 2017 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
normal
{ "blob_id": "a34584a71fdff65e5b1bb15a6304af79774dac2c", "index": 1315, "step-1": "<mask token>\n\n\ndef upgrade():\n op.drop_constraint('component_files_component_id_fkey', 'component_files')\n op.drop_constraint('components_topic_id_fkey', 'components')\n op.drop_constraint('files_job_id_fkey', 'files'...
[ 1, 2, 3, 4, 5 ]
from django import forms from django.contrib.auth.models import User from .models import TblPublish , TblSnippetTopics, TblSnippetData, TblLearnTopics, TblLearnData, TblBlog, TblBlogComments,TblLearnDataComments, TblBlogGvp, TblLearnDataGvp,TblSnippetDataGvp, TblHome, TblAbout, TblQueries from django.contrib.auth.forms...
normal
{ "blob_id": "9e02b1a90d61de6d794dd350b50417a2f7260df6", "index": 5947, "step-1": "<mask token>\n\n\nclass TblBlogForm(forms.ModelForm):\n\n\n class Meta:\n model = TblBlog\n fields = ['blog_title', 'blog_description', 'blog_keyword',\n 'blog_content', 'blog_pics', 'blog_publish', 'blo...
[ 19, 20, 22, 26, 32 ]
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Aplicação H2HC criado para CTF Exploit criado por M4v3r1ck (helvio_junior[at]hotmail[dot]com) ''' from pwn import * import os context(arch='amd64', os='windows', log_level='debug') host= "192.168.255.201" port = 54345 # Estágio 1 log.info("Enviando estágio 1") payload1...
normal
{ "blob_id": "4fff64a62776a9d1b06cc11d5e55fc00f6787338", "index": 8128, "step-1": "<mask token>\n", "step-2": "<mask token>\ncontext(arch='amd64', os='windows', log_level='debug')\n<mask token>\nlog.info('Enviando estágio 1')\n<mask token>\npayload1 += 'ÿ\\x00\\x00\\x00'\npayload1 += 'A' * 255\npayload1 += '\\n...
[ 0, 1, 2, 3, 4 ]
#from skimage import measure #from svmutil import * import cv2 import numpy as np def inside(r, q): rx, ry, rw, rh = r qx, qy, qw, qh = q return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh def draw_detections(img, rects, thickness = 1): for x, y, w, h in rects: # the HOG detector returns ...
normal
{ "blob_id": "f012f862ad064fc168bd5328b97c433164a3a36f", "index": 3742, "step-1": "<mask token>\n\n\ndef draw_detections(img, rects, thickness=1):\n for x, y, w, h in rects:\n pad_w, pad_h = int(0.15 * w), int(0.05 * h)\n cv2.rectangle(img, (x + pad_w, y + pad_h), (x + w - pad_w, y + h -\n ...
[ 1, 2, 3, 4, 5 ]
# Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def insert(self, intervals, newInterval): """ :type intervals: List[Interval] :type newInterval: Interval :rtype: List[...
normal
{ "blob_id": "7dd5ac1110f38c40f2fddf9d7175a5ac40303d73", "index": 5796, "step-1": "# Definition for an interval.\n# class Interval(object):\n# def __init__(self, s=0, e=0):\n# self.start = s\n# self.end = e\n\nclass Solution(object):\n def insert(self, intervals, newInterval):\n \"\"...
[ 0 ]
def Return(): s = raw_input('Enter a s: ') i = 0 s1 = '' leng = len(s) while i < leng: if s[i] == s[i].lower(): s1 += s[i].upper() else: s1 += s[i].lower() i += 1 return s1 if __name__ == '__main__': print Return()
normal
{ "blob_id": "6dafb60b79a389499ae2a0f17f9618426faf45a9", "index": 8880, "step-1": "def Return():\n s = raw_input('Enter a s: ')\n i = 0\n s1 = ''\n leng = len(s)\n while i < leng:\n if s[i] == s[i].lower():\n s1 += s[i].upper()\n else:\n s1 += s[i].lower()\n ...
[ 0 ]
''' Can you print numbers from 1 to 100 without using any loop. ''' # Use Recursion
normal
{ "blob_id": "cc703690151acd17430b5a9715e71a694fdeca10", "index": 2116, "step-1": "<mask token>\n", "step-2": "'''\nCan you print numbers from 1 to 100 without using any loop.\n'''\n\n# Use Recursion", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django.urls import path from . import views app_name = 'restuarant' urlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/', views.restuarent, name='restuarant'), path('login/restaurant/', views. restLogin, name='rlogin'), path('register/restaurant/', views. restRegister, name='rregi...
normal
{ "blob_id": "63830a3c09a2d0a267b030a336062d5e95b9a71a", "index": 3308, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'restuarant'\nurlpatterns = [path('orderplaced/', views.orderplaced), path('restaurant/',\n views.restuarent, name='restuarant'), path('login/restaurant/', views.\n restL...
[ 0, 1, 2 ]
import numpy as np import sklearn.cluster as sc import sklearn.metrics as sm import matplotlib.pyplot as mp x = np.loadtxt('C:\\Users\\Administrator\\Desktop\\sucai\\ml_data\\perf.txt', delimiter=',') # 准备训练模型相关数据 epsilons, scores, models = np.linspace(0.3, 1.2, 10), [], [] # 遍历所有的半径,训练模型,查看得分 for epsilon in eps...
normal
{ "blob_id": "01128ebd156b24791548c50c92d2fc1969c42e70", "index": 9756, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor epsilon in epsilons:\n model = sc.DBSCAN(eps=epsilon, min_samples=5)\n model.fit(x)\n score = sm.silhouette_score(x, model.labels_, sample_size=len(x),\n metric='eucli...
[ 0, 1, 2, 3, 4 ]
import pandas import numpy as np train_set = pandas.read_csv("./dataset/train.csv") test_set = pandas.read_csv("./dataset/test.csv") print(train_set) train_set = train_set.drop('id',axis=1) print(train_set.describe()) train_set['type'], categories = train_set['type'].factorize() import matplotlib.pyplot as plt print...
normal
{ "blob_id": "ccedca543fc4dee284a9243317d028ffdeac229d", "index": 2923, "step-1": "<mask token>\n\n\nclass CreateExtraFeatures(BaseEstimator, TransformerMixin):\n <mask token>\n <mask token>\n\n def transform(self, X, y=None):\n X['hair_soul'] = X['hair_length'] * X['has_soul']\n X['flesh_s...
[ 6, 8, 9, 10, 12 ]
vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0, 0....
normal
{ "blob_id": "dc6cbf43424a31f1aefde8bd71b6f1b7ecf8166b", "index": 5998, "step-1": "<mask token>\n", "step-2": "vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, \n 5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,\n 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0...
[ 0, 1 ]
def firstDuplicate(array): """ Time O(n) | Space O(n) """ dic = {} for num in array: if num in dic: return num else: dic[num] = True return -1 print(firstDuplicate([2, 1, 3, 5, 3]))
normal
{ "blob_id": "47259844f76f12060f0cf52f1086c05b9f300175", "index": 8581, "step-1": "<mask token>\n", "step-2": "def firstDuplicate(array):\n \"\"\"\n Time O(n) | Space O(n)\n \"\"\"\n dic = {}\n for num in array:\n if num in dic:\n return num\n else:\n dic[num] ...
[ 0, 1, 2 ]
# The sort() method sorts the list ascending by default. #syntax # list.sort(reverse=True|False, key=myFunc) # Parameter Description # reverse Optional. reverse=True will sort the list descending. Default is reverse=False # key Optional. A function to specify the sorting criteria(s) cars ...
normal
{ "blob_id": "5ab8d9eab30d72557f1a85b5b82c0df456e3843d", "index": 1740, "step-1": "<mask token>\n\n\ndef length_of_cars(car):\n return len(car)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef length(data):\n return len(data)\n\n\n<mask token>\n\n\ndef year(data):\n return data['year']\n\n\n<mask...
[ 1, 3, 4, 5, 6 ]
from terminaltables import AsciiTable import copy table_data = [ ['WAR', 'WAW'], ['S1 -> S2: R1', 'row1 column2'], ['row2 column1', 'row2 column2'], ['row3 column1', 'row3 column2'] ] table = AsciiTable(table_data) def getDependenceStr(ins1, ins2, reg): return f"{ins1} -> {ins2}: {reg}" def get...
normal
{ "blob_id": "e045dc348fb2e9de51dbeada1d1826211cf89eae", "index": 3114, "step-1": "<mask token>\n\n\ndef getDependenceStr(ins1, ins2, reg):\n return f'{ins1} -> {ins2}: {reg}'\n\n\ndef getInstructionStr(ins, reg1, reg2, reg3):\n return f'{ins} {reg1} {reg2} {reg3}'\n\n\n<mask token>\n\n\ndef validateInput(s...
[ 7, 10, 11, 13, 16 ]
#!/usr/bin/python import operator import cgi, sys, LINK_HEADERS import simplejson as json from datetime import datetime from dateutil import tz from decimal import * sys.path.insert(0, str(LINK_HEADERS.DAO_LINK)) from transaction_dao import Transaction_dao from user_portfolio_dao import User_portfolio_dao from user_st...
normal
{ "blob_id": "4264cba9a6c39219d21bd21d4b21009bacd1db38", "index": 61, "step-1": "#!/usr/bin/python\n\nimport operator\nimport cgi, sys, LINK_HEADERS\nimport simplejson as json\nfrom datetime import datetime\nfrom dateutil import tz\nfrom decimal import *\nsys.path.insert(0, str(LINK_HEADERS.DAO_LINK))\nfrom trans...
[ 0 ]
from random import randint class Game(object): def __init__(self, players): if len(players) < 2: raise ValueError('Number of player must be at least 2') self.play_order = players self.player_data = {} for player in self.play_order: # ...
normal
{ "blob_id": "52f3000514fd39083daa6316d551f1685c7cea23", "index": 6792, "step-1": "<mask token>\n\n\nclass Game(object):\n <mask token>\n\n def game_loop(self):\n while not self.won():\n hunches = []\n for player, data in self.player_data.items():\n print('Jogador...
[ 7, 10, 11, 12, 13 ]
# [BEGIN IMPORTS] from mainhandler import MainHandler from sec.data import * # [END IMPORTS] class UpVoteHandler (MainHandler): def get(self): user = self.get_user() if user: post_id = self.request.get('post_id') post = PostData.get_by_id(int(post_id)) voter_l...
normal
{ "blob_id": "5711613df0bda10512466f147febcffacfe1607b", "index": 7794, "step-1": "<mask token>\n\n\nclass DownVoteHandler(MainHandler):\n\n def get(self):\n user = self.get_user()\n if user:\n post_id = self.request.get('post_id')\n post = PostData.get_by_id(int(post_id))\n...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/4/14 14:31 # @Author : lixiaofeng # @File : page_zaojiao.py # @Software: PyCharm # @desc : from common.basics import Crazy class Zaojiaopage(Crazy): """早教小程序""" zao_btn_loc = ('xpath', '//*[@resource-id="com.tencent.mm:id/cx" and @text="...
normal
{ "blob_id": "1980fb4d6e7d3c6fe51f4a242610b5489e553859", "index": 128, "step-1": "<mask token>\n\n\nclass Zaojiaopage(Crazy):\n <mask token>\n <mask token>\n\n def click_zao(self):\n self.click(self.zao_btn_loc)\n <mask token>\n <mask token>\n\n def click_find(self):\n self.click(s...
[ 73, 89, 121, 148, 152 ]