code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import sys input = sys.stdin.readline from collections import deque size, num = map(int, input().split()) position = list(map(int, input().split())) cnt = 0 nums = [] for k in range(1, size + 1): nums.append(k) size = deque(nums) position = deque(position) while position != deque([]): if position[0] == 1: ...
normal
{ "blob_id": "c0c0ed31a09f2b49448bc1f3519aa61daaba20af", "index": 5023, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in range(1, size + 1):\n nums.append(k)\n<mask token>\nwhile position != deque([]):\n if position[0] == 1:\n size.popleft()\n position.popleft()\n for i i...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from scrapy import Request from ..items import ZhilianSpiderItem from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor from scrapy_redis.spiders import RedisCrawlSpider class ZhilianSpider(RedisCrawlSpider): name = 'zhilianspider' headers = { 'User-Ag...
normal
{ "blob_id": "894fa01e16d200add20f614fd4a5ee9071777db9", "index": 3339, "step-1": "<mask token>\n\n\nclass ZhilianSpider(RedisCrawlSpider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://sou.zhaopin.com/jobs/searchresult.ashx?jl=%E4%B8...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "da783355c5f888a66f623fa7eeeaf0e4e9fcfa48", "index": 4982, "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 = [('cart', '001...
[ 0, 1, 2, 3, 4 ]
{% load code_generator_tags %}from rest_framework.serializers import ModelSerializer {% from_module_import app.name|add:'.models' models %}{% comment %} {% endcomment %}{% for model in models %} class {{ model.name }}Serializer(ModelSerializer): class Meta: model = {{ model.name }} depth = 1 ...
normal
{ "blob_id": "888ec915d89f1fd8fd6465f1035f7c658af78596", "index": 6166, "step-1": "{% load code_generator_tags %}from rest_framework.serializers import ModelSerializer\n{% from_module_import app.name|add:'.models' models %}{% comment %}\n{% endcomment %}{% for model in models %}\n\n\nclass {{ model.name }}Serial...
[ 0 ]
<|reserved_special_token_0|> class MIPCLSolver(Solver): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|...
flexible
{ "blob_id": "191154c896fe441519ad4f343c6d92d6304fb3db", "index": 8187, "step-1": "<mask token>\n\n\nclass MIPCLSolver(Solver):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <...
[ 3, 4, 5, 6, 7 ]
import time import random import math people = [('Seymour', 'BOS'), ('Franny', 'DAL'), ('Zooey', 'CAK'), ('Walt', 'MIA'), ('Buddy', 'ORD'), ('Les', 'OMA')] destination = 'LGA' flights = dict() for line in file('schedule.txt'): origin, dest, depart, arrive, price...
normal
{ "blob_id": "bd5f298027f82edf5451f5297d577005674de4c3", "index": 3577, "step-1": "import time\nimport random\nimport math\n\npeople = [('Seymour', 'BOS'),\n ('Franny', 'DAL'),\n ('Zooey', 'CAK'),\n ('Walt', 'MIA'),\n ('Buddy', 'ORD'),\n ('Les', 'OMA')]\n\ndestination ...
[ 0 ]
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 ]
import os from PIL import Image import cv2 import shutil root = './train' save_path = './thumbnail' for r, d, files in os.walk(root): if files != []: for i in files: fp = os.path.join(r, i) label = i.split('_')[0] dst = os.path.join(save_path, label) if not o...
normal
{ "blob_id": "cc19ff829cc4a11c3dc873353fa2194ec9a87718", "index": 8584, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor r, d, files in os.walk(root):\n if files != []:\n for i in files:\n fp = os.path.join(r, i)\n label = i.split('_')[0]\n dst = os.path.join(s...
[ 0, 1, 2, 3, 4 ]
from datetime import timedelta, datetime import glob import json import os import re import pickle import os,time import pandas as pd import numpy as np from collections import Counter from sentencepiece import SentencePieceTrainer from sentencepiece import SentencePieceProcessor from sklearn.feature_extraction.text i...
normal
{ "blob_id": "05573b4ff68ca8638f8e13946b410df2a012840a", "index": 1829, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef song_inference():\n sp_total_model_path = 'sp_total'\n train = pd.read_json('./dataset/train.json', typ='frame', encoding='utf-8')\n song = pd.read_json('./dataset/song_m...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def __main__(): email = input("Please input the departing user's email address: ") ad_result = deprovision_AD(email) print(ad_result) <|reserved_special_token_1|> <|reserved_special_token_0|> def deprovision_AD(email): memberOf_list = [] ad_info = get_secret('TS/A...
flexible
{ "blob_id": "9ca5c052db43c1d8b0cafa18038b3ebcd80067f7", "index": 4710, "step-1": "<mask token>\n\n\ndef __main__():\n email = input(\"Please input the departing user's email address: \")\n ad_result = deprovision_AD(email)\n print(ad_result)\n", "step-2": "<mask token>\n\n\ndef deprovision_AD(email):\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class _DatabaseResourceTableController: <|reserved_special_token_0|> <|reserved_special_token_0|> def register_peer(self, peer_id: str, peer_ip: str, peer_port: int, resource_name: str, resource_path: str, resource_hash: str) ->None: """ Register 'peer...
flexible
{ "blob_id": "c024e12fe06e47187c25a9f384ceed566bf94645", "index": 6909, "step-1": "<mask token>\n\n\nclass _DatabaseResourceTableController:\n <mask token>\n <mask token>\n\n def register_peer(self, peer_id: str, peer_ip: str, peer_port: int,\n resource_name: str, resource_path: str, resource_hash...
[ 5, 6, 7, 9, 11 ]
<|reserved_special_token_0|> class UBDDPGAgent(Agent): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def compile(self, optimizer, metrics=[]): metrics += [mean_q] if type(optimizer) in (list, tuple): if len(optimizer) != 2: ...
flexible
{ "blob_id": "a2fe62b6bbb6b753ef6aec6f44758b8aceeeafe6", "index": 9691, "step-1": "<mask token>\n\n\nclass UBDDPGAgent(Agent):\n <mask token>\n <mask token>\n <mask token>\n\n def compile(self, optimizer, metrics=[]):\n metrics += [mean_q]\n if type(optimizer) in (list, tuple):\n ...
[ 9, 12, 15, 17, 18 ]
import torch import torch.nn as nn from model.common import UpsampleBlock, conv_, SELayer def wrapper(args): act = None if args.act == 'relu': act = nn.ReLU(True) elif args.act == 'leak_relu': act = nn.LeakyReLU(0.2, True) elif args.act is None: act = None else: rais...
normal
{ "blob_id": "b2c0ef4a0af12b267a54a7ae3fed9edeab2fb879", "index": 6570, "step-1": "<mask token>\n\n\nclass AFB_L1(nn.Module):\n <mask token>\n <mask token>\n\n\nclass AFB_L2(nn.Module):\n\n def __init__(self, channels, n_l1=4, act=nn.ReLU(True)):\n super(AFB_L2, self).__init__()\n self.n = ...
[ 10, 14, 17, 18, 19 ]
<|reserved_special_token_0|> def draw_detections(img, rects, thickness=1): for x, y, w, h in rects: pad_w, pad_h = int(0.15 * w), int(0.05 * h) cv2.rectangle(img, (x + pad_w, y + pad_h), (x + w - pad_w, y + h - pad_h), (0, 255, 0), thickness) <|reserved_special_token_0|> <|reserved...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def readme(): with open('README.rst') as f: return f.read() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def readme(): with open('README.rst') as f: return...
flexible
{ "blob_id": "6da828a797efac7c37723db96a2682e960c317b5", "index": 1007, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef readme():\n with open('README.rst') as f:\n ...
[ 0, 1, 2, 3, 4 ]
from flask import Flask app = Flask(__name__) import orderapi, views, models, processing if __name__=="__main__": orderapi.app.debug = True orderapi.app.run(host='0.0.0.0', port=34203) views.app.debug = True views.app.run(host='0.0.0.0', port=42720)
normal
{ "blob_id": "3218a9e82cd19bab1680079aee5f09a97992629e", "index": 6038, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n orderapi.app.debug = True\n orderapi.app.run(host='0.0.0.0', port=34203)\n views.app.debug = True\n views.app.run(host='0.0.0.0', port=42720)\n", ...
[ 0, 1, 2, 3, 4 ]
# 30_Days_Of_Code # Day 2 # Boolean print(True) print(False)
normal
{ "blob_id": "f1ca3d7ff7efcf500f1a16e415b13c47fd08688d", "index": 5044, "step-1": "<mask token>\n", "step-2": "print(True)\nprint(False)\n", "step-3": "# 30_Days_Of_Code\n# Day 2\n# Boolean\nprint(True)\nprint(False)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# Generated by Django 3.2.4 on 2021-06-29 13:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('blog', '0002_blogdetail'), ] operations = [ migrations.RenameField( model_name='bloglist', old_name='about', new...
normal
{ "blob_id": "1cf5ce11b965d65426ed421ef369954c59d7eba9", "index": 3199, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('blog', '000...
[ 0, 1, 2, 3, 4 ]
__author__ = "Rick Sherman" __credits__ = "Jeremy Schulman, Nitin Kumar" import unittest from nose.plugins.attrib import attr from jnpr.junos import Device from jnpr.junos.utils.scp import SCP from mock import patch @attr('unit') class TestScp(unittest.TestCase): def setUp(self): self.dev = Device(host...
normal
{ "blob_id": "65ea40ad1c1bf6bf23aed5316b91862c9cdc353d", "index": 5564, "step-1": "<mask token>\n\n\n@attr('unit')\nclass TestScp(unittest.TestCase):\n <mask token>\n <mask token>\n\n @patch('paramiko.SSHClient')\n def test_scp_close(self, mock_connect):\n self.dev.bind(scp=SCP)\n self.d...
[ 4, 6, 7, 8, 9 ]
def test_logsources_model(self): """ Comprobacion de que el modelo de la fuente de seguridad coincide con su asociado Returns: """ log_source = LogSources.objects.get(Model="iptables v1.4.21") self.assertEqual(log_source.get_model(), "iptables v1.4.21")
normal
{ "blob_id": "c645461effe288a1959b783473d62ff99ca29547", "index": 8746, "step-1": "<mask token>\n", "step-2": "def test_logsources_model(self):\n \"\"\"\n Comprobacion de que el modelo de la fuente de seguridad coincide con su asociado\n Returns:\n\n \"\"\"\n log_source = LogSources.objects.get(M...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class BackendThread(QThread): <|reserved_special_token_0|> def run(self): while True: data = QDateTime.currentDateTime() currentTime = data.toString('yyyy-MM-dd hh:mm:ss') self.update_date.emit(str(currentTime)) time.sleep(1...
flexible
{ "blob_id": "ec625bf57388281b3cbd464459fc3ad1c60b7db9", "index": 3305, "step-1": "<mask token>\n\n\nclass BackendThread(QThread):\n <mask token>\n\n def run(self):\n while True:\n data = QDateTime.currentDateTime()\n currentTime = data.toString('yyyy-MM-dd hh:mm:ss')\n ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class CategorySerializers(serializers.ModelSerializer): childcategories = RecursiveSerializer(many=True, read_only=True) class Meta: model = Category fields = 'id', 'name', 'parent', 'childcategories' class ProductSerializer(serializers.ModelSerializer): ...
flexible
{ "blob_id": "cd9cc656a62728b3649b00c03ca8d05106015007", "index": 7949, "step-1": "<mask token>\n\n\nclass CategorySerializers(serializers.ModelSerializer):\n childcategories = RecursiveSerializer(many=True, read_only=True)\n\n\n class Meta:\n model = Category\n fields = 'id', 'name', 'parent'...
[ 3, 4, 5, 6, 7 ]
import os from tqdm import tqdm from system.krl import KRL from system.utils.format import format_data from system.oie import OIE # extract one file def execute_file(input_fp, output_fp): oie = OIE() oie.extract_file(input_fp, output_fp) # extract one sentence def execute_sentence(): ...
normal
{ "blob_id": "bc5e928305d82c92c10106fe1f69f5979d57e3d2", "index": 5446, "step-1": "<mask token>\n\n\ndef execute_file(input_fp, output_fp):\n oie = OIE()\n oie.extract_file(input_fp, output_fp)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef execute_file(input_fp, output_fp):\n oie = OIE()\n ...
[ 1, 3, 4, 5, 6 ]
import sys sys.stdin = open("1868_input.txt") dr = [-1, -1, -1, 0, 0, 1, 1, 1] dc = [-1, 0, 1, -1, 1, -1, 0, 1] def is_wall(r, c): if r < 0 or r >= n or c < 0 or c >= n: return True return False def find(r, c, cnt): Q = [] Q.append((r, c)) visited[r][c] = 1 while Q: tr, tc = Q...
normal
{ "blob_id": "8bce394c651931304f59bbca3e2f019212be9fc1", "index": 4620, "step-1": "<mask token>\n\n\ndef is_wall(r, c):\n if r < 0 or r >= n or c < 0 or c >= n:\n return True\n return False\n\n\ndef find(r, c, cnt):\n Q = []\n Q.append((r, c))\n visited[r][c] = 1\n while Q:\n tr, t...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class hackernewsUpvoter: <|reserved_special_token_0|> def sign_in(self, login_page='https://news.ycombinator.com/login'): self.driver.get(login_page) time.sleep(2) account = self.driver.find_element_by_name('acct') account.send_keys(self.username) ...
flexible
{ "blob_id": "742b655ee6aad2575f67e7329ed7a14c4fb6aa06", "index": 7242, "step-1": "<mask token>\n\n\nclass hackernewsUpvoter:\n <mask token>\n\n def sign_in(self, login_page='https://news.ycombinator.com/login'):\n self.driver.get(login_page)\n time.sleep(2)\n account = self.driver.find...
[ 4, 5, 7, 8, 10 ]
from texttable import Texttable from nexuscli import exception from nexuscli.api import cleanup_policy from nexuscli.cli import constants def cmd_list(nexus_client): """Performs ``nexus3 cleanup_policy list``""" policies = nexus_client.cleanup_policies.list() if len(policies) == 0: return excepti...
normal
{ "blob_id": "521b90ffb4bace4cbd50d08ed4be278d4f259822", "index": 7049, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef cmd_create(nexus_client, **kwargs):\n \"\"\"Performs ``nexus3 cleanup_policy create``\"\"\"\n policy = cleanup_policy.CleanupPolicy(None, **kwargs)\n nexus_client.cleanup...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SendMes(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> reg...
flexible
{ "blob_id": "daecbf5280c199b31f3b9d9818df245d9cd165a7", "index": 4295, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SendMes(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n region_provider.add_endpoint(PRODUCT_NAME, REGI...
[ 0, 1, 3, 4, 5 ]
from gerador_senha import gerar_senha gerar_senha()
normal
{ "blob_id": "e81da535408cc36655328b37ca99b4f775f3a78e", "index": 8435, "step-1": "<mask token>\n", "step-2": "<mask token>\ngerar_senha()\n", "step-3": "from gerador_senha import gerar_senha\ngerar_senha()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
def area (a, b): resultado = a * b return (resultado) def main(): #escribe tu código abajo de esta línea num1 = float(input("INTRODUCE LA BASE: ")) num2 = float(input("INTRODUCE LA ALTURA: ")) print ("EL AREA DEL RECTANGULO ES: ", area (num1, num2)) pass if __name__ == '__main__': main()
normal
{ "blob_id": "282dbdb3a8d9ed914e8ca5c7fa74d2873920e18c", "index": 7308, "step-1": "<mask token>\n", "step-2": "def area(a, b):\n resultado = a * b\n return resultado\n\n\n<mask token>\n", "step-3": "def area(a, b):\n resultado = a * b\n return resultado\n\n\ndef main():\n num1 = float(input('IN...
[ 0, 1, 2, 3, 4 ]
from selenium import webdriver driver = webdriver.Chrome() driver.get("http://192.168.1.248:9079/#/") lanuage = driver.find_element_by_class_name("el-dropdown-trigger-text") print(type(lanuage)) print(lanuage.text) try: driver.find_element_by_class_name("el-dropdown-trigger-text").text =="中文" print("符合要求") ...
normal
{ "blob_id": "6a1f58af26bbc4d584ffd699c512ef433ffb80d8", "index": 7206, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('http://192.168.1.248:9079/#/')\n<mask token>\nprint(type(lanuage))\nprint(lanuage.text)\ntry:\n driver.find_element_by_class_name('el-dropdown-trigger-text').text == '中文'\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CenterOriginToZero(bpy.types.Operator): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def execute(self, context): for x in bpy.context.selected_objects: x.location = 0, 0, ...
flexible
{ "blob_id": "f7a511beaea869cf32eb905a4f3685077297a5ec", "index": 1654, "step-1": "<mask token>\n\n\nclass CenterOriginToZero(bpy.types.Operator):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def execute(self, context):\n for x in bpy.context.selected_objects:\n ...
[ 10, 14, 15, 16, 18 ]
thisdict = {"brand": "ford", "model": "Mustang", "year": 1964} module = thisdict["modal"] print("model:", module) thisdict = {"brand": "ford", "model": "Mustang", "year": 1964} module = thisdict.get["modal"] print("model:", module)
normal
{ "blob_id": "3d854c83488eeafa035ccf5d333eeeae63505255", "index": 6908, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('model:', module)\n<mask token>\nprint('model:', module)\n", "step-3": "thisdict = {'brand': 'ford', 'model': 'Mustang', 'year': 1964}\nmodule = thisdict['modal']\nprint('model:',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class NURBS: <|reserved_special_token_0|> <|reserved_special_token_0|> def addKnot(self, knot: float) ->None: self._knots.append(knot) def pointCount(self) ->int: return len(self._points) <|reserved_special_token_0|> def _N(self, i: int, n: int, ...
flexible
{ "blob_id": "40b3cacf55f6c5056c3541d70d8b2c0e2cc7d01b", "index": 2564, "step-1": "<mask token>\n\n\nclass NURBS:\n <mask token>\n <mask token>\n\n def addKnot(self, knot: float) ->None:\n self._knots.append(knot)\n\n def pointCount(self) ->int:\n return len(self._points)\n <mask toke...
[ 6, 7, 8, 9, 11 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 25 18:40:07 2021 @author: tomachache """ import numpy as np from qiskit import * # Various state preparation def state_preparation(m, name, p): # m : nb of qubits # name : name of the state we want # p : proba associated with nois...
normal
{ "blob_id": "6962bf99e3ecae473af54ded33fde09527cb82c0", "index": 8284, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef state_preparation(m, name, p):\n circ = QuantumCircuit(m, name='State prep')\n if name == 'GHZ':\n circ.h(0)\n for k in range(1, m):\n circ.cx(0, k)...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def optical_flow_from_video(): cap = cv2.VideoCapture( '/home/ubuntu/data1.5TB/异常dataset/Avenue_dataset/training_videos/01.avi' ) feature_params = dict(maxCorners=100, qualityLevel=0.3, minDistance=7, blockSize=7) lk_params = dict(winSize=(15, 15), maxL...
flexible
{ "blob_id": "ae0547aa1af2d4dd73bb60154574e64e74107a58", "index": 4062, "step-1": "<mask token>\n\n\ndef optical_flow_from_video():\n cap = cv2.VideoCapture(\n '/home/ubuntu/data1.5TB/异常dataset/Avenue_dataset/training_videos/01.avi'\n )\n feature_params = dict(maxCorners=100, qualityLevel=0.3,...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(argv) is not 3: print('Usage: python dna.py data.csv sequence.txt') sys.exit() with open(argv[1], 'r') as csv_file: datafile = csv.reader(csv_file) line_count = 0 for row in datafile: datasave.in...
flexible
{ "blob_id": "1eeb7a539f43e9fb013494e2aa0d81b4eab0ae1a", "index": 9353, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(argv) is not 3:\n print('Usage: python dna.py data.csv sequence.txt')\n sys.exit()\nwith open(argv[1], 'r') as csv_file:\n datafile = csv.reader(csv_file)\n line_count ...
[ 0, 2, 3, 4, 5 ]
import nox @nox.session(python=["3.9", "3.8", "3.7", "3.6"], venv_backend="conda", venv_params=["--use-local"]) def test(session): """Add tests """ session.install() session.run("pytest") @nox.session(python=["3.9", "3.8", "3.7", "3.6"]) def lint(session): """Lint the code with flake8. """ ...
normal
{ "blob_id": "9aecf297ed36784d69e2be6fada31f7c1ac37500", "index": 4778, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@nox.session(python=['3.9', '3.8', '3.7', '3.6'], venv_backend='conda',\n venv_params=['--use-local'])\ndef test(session):\n \"\"\"Add tests\n \"\"\"\n session.install()\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Container(object): <|reserved_special_token_0|> def __init__(self, svc_cfg, containers_all=None): self.cfg = svc_cfg self.env = dict(self.cfg) args_to_delete = ['priority', 'depends-on', 'detach', 'api_cfg', 'cluster', 'images_dir', 'path...
flexible
{ "blob_id": "c2c1194ed23adda015b23897888d1a4cc11423d5", "index": 5074, "step-1": "<mask token>\n\n\nclass Container(object):\n <mask token>\n\n def __init__(self, svc_cfg, containers_all=None):\n self.cfg = svc_cfg\n self.env = dict(self.cfg)\n args_to_delete = ['priority', 'depends-on...
[ 9, 10, 12, 13, 14 ]
<|reserved_special_token_0|> class DengueInfection(BasedDataset): <|reserved_special_token_0|> def cyclic_encoder(self, col, max_val): self.df[col + '_sin'] = np.sin(2 * np.pi * self.df[col] / max_val) self.df[col + '_cos'] = np.cos(2 * np.pi * self.df[col] / max_val) return self.df ...
flexible
{ "blob_id": "93ac8a1f795f7809a3e88b56ce90bf1d31706554", "index": 1139, "step-1": "<mask token>\n\n\nclass DengueInfection(BasedDataset):\n <mask token>\n\n def cyclic_encoder(self, col, max_val):\n self.df[col + '_sin'] = np.sin(2 * np.pi * self.df[col] / max_val)\n self.df[col + '_cos'] = np...
[ 16, 18, 22, 25, 33 ]
a = input().split(' ') A = int(a[0]) B = int(a[1]) X = int(a[2]) if A <= X and A + B >= X: print('YES') else: print('NO')
normal
{ "blob_id": "9a60449aa13bc5e7e413d0e47a1972d93ccfe69f", "index": 7194, "step-1": "<mask token>\n", "step-2": "<mask token>\nif A <= X and A + B >= X:\n print('YES')\nelse:\n print('NO')\n", "step-3": "a = input().split(' ')\nA = int(a[0])\nB = int(a[1])\nX = int(a[2])\nif A <= X and A + B >= X:\n pr...
[ 0, 1, 2 ]
# coding=utf-8 while True: a,b=input().split() a=float(a) b=float(b) if b==0: print("error") else: c=a/b+0.5 c=int(c) print(c)
normal
{ "blob_id": "dab5e7ee1d14cba485cbaece1354ec8d686ca4ab", "index": 9080, "step-1": "<mask token>\n", "step-2": "while True:\n a, b = input().split()\n a = float(a)\n b = float(b)\n if b == 0:\n print('error')\n else:\n c = a / b + 0.5\n c = int(c)\n print(c)\n", "step...
[ 0, 1, 2 ]
import os import shutil from tqdm import tqdm from pathlib import Path from eval_mead import PERCENT DATAPATH = '../../../data/test' # MEAD_DIR = 'mead' MEAD_DIR = os.path.abspath('mead') MEAD_DATA_PATH = f'{MEAD_DIR}/data' MEAD_BIN = f'{MEAD_DIR}/bin' MEAD_LIB = f'{MEAD_DIR}/lib' MEAD_FORMATTING_ADDONS = f'{MEAD_BIN}...
normal
{ "blob_id": "887ae9b7c629be679bf4f5fb4311c31bff605c73", "index": 8874, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.path.exists(DATA_DIR):\n override = input('Data exist, override (delete and re-parse)? (Y/n): ')\n if override.lower() == 'y':\n shutil.rmtree(DATA_DIR)\n else:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def retrieve_all_years(database_connection: mysql.connector.connect) ->List[int ]: """Retrieve a list of all available show years""" cursor = database_connection.cursor() query = ( 'SELECT DISTINCT YEAR(s.showdate) FROM ww_shows s ORDER BY YEAR(s.showdate) ASC' ...
flexible
{ "blob_id": "2d20bac0f11fa724b2d0a2e0676e5b9ce7682777", "index": 7387, "step-1": "<mask token>\n\n\ndef retrieve_all_years(database_connection: mysql.connector.connect) ->List[int\n ]:\n \"\"\"Retrieve a list of all available show years\"\"\"\n cursor = database_connection.cursor()\n query = (\n ...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> class SimpleControlComponentGuide(SimpleControlComponent): <|reserved_special_token_0|> def __init__(self, name='SimpleControl', parent=None): Profiler.getInstance().push( 'Construct Simple Control Guide Component:' + name) super(SimpleControlComponent...
flexible
{ "blob_id": "20167058697450f342c2ac3787bd1721f860dc58", "index": 3169, "step-1": "<mask token>\n\n\nclass SimpleControlComponentGuide(SimpleControlComponent):\n <mask token>\n\n def __init__(self, name='SimpleControl', parent=None):\n Profiler.getInstance().push(\n 'Construct Simple Contr...
[ 12, 15, 17, 18, 20 ]
def del_ops3(str1, str2): # find all common letters in both strings common1 = [x for x in str1 if x in str2] common2 = [x for x in str2 if x in str1] if len(common2) < len(common1): common1, common2 = common2, common1 # find total of strings with 0, 1, or 2 characters, (2 chars - only if c...
normal
{ "blob_id": "f9d1013fa278b9078e603b012abbdde0be2e0962", "index": 7926, "step-1": "<mask token>\n", "step-2": "def del_ops3(str1, str2):\n common1 = [x for x in str1 if x in str2]\n common2 = [x for x in str2 if x in str1]\n if len(common2) < len(common1):\n common1, common2 = common2, common1\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(md5.hexdigest()) <|reserved_special_token_0|> print(sha1.hexdigest()) <|reserved_special_token_0|> print(sha224.hexdigest()) <|reserved_special_token_0|> print(sha256.hexdigest()) <|reserved_special_token_0|> print(sha384.he...
flexible
{ "blob_id": "ab4c668c8a167f8c387199b7aa49aa742d563250", "index": 1698, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(md5.hexdigest())\n<mask token>\nprint(sha1.hexdigest())\n<mask token>\nprint(sha224.hexdigest())\n<mask token>\nprint(sha256.hexdigest())\n<mask token>\nprint(sha384.hexdigest())\n<...
[ 0, 1, 2, 3 ]
#Peptide Encoding Problem: Find substrings of a genome encoding a given amino acid sequence. # Input: A DNA string Text, an amino acid string Peptide, and the array GeneticCode. # Output: All substrings of Text encoding Peptide (if any such substrings exist). def reverse_string(seq): return seq[::-1] def compl...
normal
{ "blob_id": "0f2d215a34758f85a29ef7ed8264fccd5e85b66f", "index": 3017, "step-1": "def reverse_string(seq):\n return seq[::-1]\n\n\ndef complement(seq):\n seq = seq.upper()\n basecomplement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N'}\n letters = list(seq)\n letters = [basecomplement[base] ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with fh as f: lines = f.readlines() n_lines = len(lines) for i, line in enumerate(lines): line = line.rstrip() if line.startswith('\tBibID & rank') and n_lines > i + 2 and lines[ i + 2].star...
flexible
{ "blob_id": "fc06d8a26a99c16a4b38ad0b4bbb28a1dc522991", "index": 6902, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith fh as f:\n lines = f.readlines()\n n_lines = len(lines)\n for i, line in enumerate(lines):\n line = line.rstrip()\n if line.startswith('\\tBibID & rank') and n...
[ 0, 1, 2, 3, 4 ]
from template.db import Database from template.query import Query import os ''' READ ME!! Before using this demo, be sure that the Tail_Const is set to a value high enough to guaranteed that all updates are contained within the same block. config.py -> TAIL_CONST = 4 This program is mean...
normal
{ "blob_id": "8f5b7711d913c7375d6816dd94731f1ce5ca1a62", "index": 8289, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.open('ECS165')\nprint(db)\n<mask token>\nprint('Merge Start')\nq.table.merge(0)\nprint('Merge End')\ndb.close()\n", "step-3": "<mask token>\ndb = Database()\ndb.open('ECS165')\nprint...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for x in array: print(x) <|reserved_special_token_1|> array = [1, 2, 3, 4, 5] for x in array: print(x)
flexible
{ "blob_id": "224e13331ad93278f47a5582bbd24208d9ce5dcc", "index": 3705, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in array:\n print(x)\n", "step-3": "array = [1, 2, 3, 4, 5]\nfor x in array:\n print(x)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from .models import CNNClassifier, load_weights, LastLayer_Alexnet, classes, MyResNet from .transforms import image_transforms, tensor_transform from .utils import newest_model, Dataset, load_data
normal
{ "blob_id": "17781ae5e9c72232fbc11c7eda7daeaeb0fa3670", "index": 9277, "step-1": "<mask token>\n", "step-2": "from .models import CNNClassifier, load_weights, LastLayer_Alexnet, classes, MyResNet\nfrom .transforms import image_transforms, tensor_transform\nfrom .utils import newest_model, Dataset, load_data\n"...
[ 0, 1 ]
<|reserved_special_token_0|> def _get_headers(environ): """ Returns only proper HTTP headers. """ for key, value in iteritems(environ): key = str(key) if key.startswith('HTTP_') and key not in ('HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH'): yield key[5:].replace('...
flexible
{ "blob_id": "53cd9d5a79e97bb1af69446a82c747248c3cc298", "index": 1367, "step-1": "<mask token>\n\n\ndef _get_headers(environ):\n \"\"\"\n Returns only proper HTTP headers.\n \"\"\"\n for key, value in iteritems(environ):\n key = str(key)\n if key.startswith('HTTP_') and key not in ('HTT...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TcpTestProtocol(asyncio.Protocol): <|reserved_special_token_0|> <|reserved_special_token_0|> @property def socket_id(self): """Return socket id""" return self._sock_id def set_owner(self, owner, is_stream=False): """Update owner to test ...
flexible
{ "blob_id": "9f0e286268732e8cabb028b7c84f5ba72a6e8528", "index": 3068, "step-1": "<mask token>\n\n\nclass TcpTestProtocol(asyncio.Protocol):\n <mask token>\n <mask token>\n\n @property\n def socket_id(self):\n \"\"\"Return socket id\"\"\"\n return self._sock_id\n\n def set_owner(self...
[ 9, 11, 12, 13, 15 ]
from sonosscripts import common from sonosscripts.common import round_nearest def run(_): parser = common.get_argument_parser() parser.add_argument("--step", help="volume step", type=int, default=5) parsed_args = parser.parse_args() sonos = common.get_sonos(parsed_args) step = parsed_args.step ...
normal
{ "blob_id": "6e78dee46276f738197ba6796fe1a027ab743354", "index": 1769, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(_):\n parser = common.get_argument_parser()\n parser.add_argument('--step', help='volume step', type=int, default=5)\n parsed_args = parser.parse_args()\n sonos = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __author__ = 'samar' <|reserved_special_token_0|> <|reserved_special_token_1|> __author__ = 'samar' import mv_details import product
flexible
{ "blob_id": "7ac53779a98b6e4b236b1e81742163d2c610a274", "index": 4556, "step-1": "<mask token>\n", "step-2": "__author__ = 'samar'\n<mask token>\n", "step-3": "__author__ = 'samar'\nimport mv_details\nimport product\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import requests,cv2,numpy,time,imutils class imageAnalyzer(): def __init__(self, roverName="Rover03", url="http://192.168.1.10:5000/api/", temp_img_path = "./temp", ): self.url = url + roverName self.temp_img_path = ...
normal
{ "blob_id": "7d3264e9a90ebd72439f77983cbf4f9755048a85", "index": 4300, "step-1": "<mask token>\n\n\nclass imageAnalyzer:\n <mask token>\n\n def getImage(self, img_number):\n temp = open(self.temp_img_path + str(img_number) + '.jpeg', 'wb')\n img = requests.get(self.url + '/image')\n te...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> def test_get_strategy(): bytes_per_voxel = 1 R = 20, 9, 10 cs = 5, 3, 2 partition = 4, 3, 5 bs, brs, bss = get_entity_sizes(cs, bytes_per_voxel, partition) test_case = {(5 * 2 * 3): 0, (5 * 2 * 3 * 4): 0, (5 * 2 * 3 * 5): 1, (5 * 2 * 3 * 5 * 2): 1, (5 * 2 *...
flexible
{ "blob_id": "6dd11f71e514a46462bf0b97ddac9ea474e86ad0", "index": 366, "step-1": "<mask token>\n\n\ndef test_get_strategy():\n bytes_per_voxel = 1\n R = 20, 9, 10\n cs = 5, 3, 2\n partition = 4, 3, 5\n bs, brs, bss = get_entity_sizes(cs, bytes_per_voxel, partition)\n test_case = {(5 * 2 * 3): 0,...
[ 1, 3, 4, 5, 6 ]
import pandas as pd #1. 读入数据 #从本地读入“wheat.csv”文件,指定index_col参数为00,即将第一列作为每行的索引。用head()函数查看前几行数据。 data = pd.read_csv("wheat.csv",index_col=0) print(data.head(6)) #2. 缺失值处理 #该数据集中包含部分缺失值,在模型训练时会遇到特征值为空的问题,故对缺失值进行处理, ## 用DataFrame的fillna方法进行缺失值填充,填充值为用mean方法得到的该列平均值。 data = data.fillna(data.mean()) print(data) #3. 划分数据...
normal
{ "blob_id": "7da2be1b530faa8ce9a8570247887e8e0d74c310", "index": 711, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(data.head(6))\n<mask token>\nprint(data)\n<mask token>\nprint(X_train.shape)\nprint(y_train.shape)\nprint(X_test.shape)\nprint(y_test.shape)\n<mask token>\nmodel.fit(X_train, y_train...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2.3 on 2021-08-26 09:18 import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Restaura...
normal
{ "blob_id": "1ea61ab4003de80ffe9fb3e284b6686d4bf20b15", "index": 787, "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 = Tr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestRedshiftCreateClusterTrigger: <|reserved_special_token_0|> @pytest.mark.asyncio @async_mock.patch( 'airflow.providers.amazon.aws.hooks.redshift_cluster.RedshiftHook.async_conn' ) async def test_redshift_create_cluster_trigger_run(self, mock_async...
flexible
{ "blob_id": "5c291dbc241a80e7f2625ba338a4b9b3a3f3b2d0", "index": 1119, "step-1": "<mask token>\n\n\nclass TestRedshiftCreateClusterTrigger:\n <mask token>\n\n @pytest.mark.asyncio\n @async_mock.patch(\n 'airflow.providers.amazon.aws.hooks.redshift_cluster.RedshiftHook.async_conn'\n )\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Line: def __init__(self, point1, point2): if isinstance(point1, Point): self.p1 = point1 elif isinstance(point1, (Tuple, List)): self.p1 = Point(*point1) else: raise TypeError('Incorrect types') if isinstance(p...
flexible
{ "blob_id": "e59a51641dc2966b0170678de064e2845e170cf5", "index": 4943, "step-1": "<mask token>\n\n\nclass Line:\n\n def __init__(self, point1, point2):\n if isinstance(point1, Point):\n self.p1 = point1\n elif isinstance(point1, (Tuple, List)):\n self.p1 = Point(*point1)\n ...
[ 11, 12, 15, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def jindutiao(jindu, zonge): ret = jindu / zonge * 100 r = '\r%s%d%%' % ('=' * jindu, ret) sys.stdout.write(r) sys.stdout.flush() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_...
flexible
{ "blob_id": "f7afd08fb8316e44c314d17ef382b98dde7eef91", "index": 1605, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef jindutiao(jindu, zonge):\n ret = jindu / zonge * 100\n r = '\\r%s%d%%' % ('=' * jindu, ret)\n sys.stdout.write(r)\n sys.stdout.flush()\n\n\n<mask token>\n", "step-3"...
[ 0, 1, 2, 3, 4 ]
from flask import Flask, render_template, redirect, request, session, flash from data import db_session from data import users, products import os from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField, BooleanField, SelectField, IntegerField from wtforms.fields.html5 import E...
normal
{ "blob_id": "d373d283a622262e2da974549907bdd8f61e89ec", "index": 2114, "step-1": "<mask token>\n\n\ndef allowed_file(filename):\n return '.' in filename and filename.rsplit('.', 1)[1].lower() == 'jpg'\n\n\ndef get_profile_img():\n os.chdir('static\\\\img\\\\profile_img')\n if os.access(f'{current_user.i...
[ 30, 35, 37, 40, 41 ]
# _*_ coding:utf-8 _*_ from __future__ import unicode_literals from django.db import models from django.core.urlresolvers import reverse # Create your models here. # 本文件中,用__unicode__代替了__str__,以免在admin界面中显示中文而引发错误。 # 参考:http://blog.csdn.net/jiangnanandi/article/details/3574007 # 或者另一个解决方案:http://blog.sina.com.cn/s...
normal
{ "blob_id": "49b007b723b9c43fb79d5dffa2546c856faf4937", "index": 8625, "step-1": "<mask token>\n\n\nclass SonMenu(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n verbose_name = u'二级菜单'\n verbose_name_plural = u'二级菜单'\n <mask token>\n\n\nclass Img(model...
[ 7, 8, 10, 11, 14 ]
<|reserved_special_token_0|> def readOnePolicy(path2): ethic_set = wn.synsets('ethic') standard_set = wn.synsets('standard') privacy_set = wn.synsets('privacy') education_set = wn.synsets('education') investment_set = wn.synsets('investment') application_set = wn.synsets('application') con...
flexible
{ "blob_id": "caca4309034f08874e1e32828a601e7e3d4d3efd", "index": 2058, "step-1": "<mask token>\n\n\ndef readOnePolicy(path2):\n ethic_set = wn.synsets('ethic')\n standard_set = wn.synsets('standard')\n privacy_set = wn.synsets('privacy')\n education_set = wn.synsets('education')\n investment_set =...
[ 1, 2, 3, 4, 5 ]
from sklearn.metrics import roc_auc_score, matthews_corrcoef, f1_score, confusion_matrix import numpy as np from scipy.stats import rankdata def iou_score(target, prediction): intersection = np.logical_and(target, prediction) union = np.logical_or(target, prediction) iou_score = np.sum(intersection) / (np...
normal
{ "blob_id": "c599a75788e3548c52ebb3b29e7a2398ff1b28a2", "index": 1808, "step-1": "<mask token>\n\n\ndef iou_score(target, prediction):\n intersection = np.logical_and(target, prediction)\n union = np.logical_or(target, prediction)\n iou_score = np.sum(intersection) / (np.sum(union) + 1e-06)\n return ...
[ 3, 5, 6, 7, 8 ]
import os CSRF_ENABLED = True basedir = os.path.abspath(os.path.dirname(__file__)) # Heroku vs. Local Configs if os.environ.get('HEROKU') is None: # Database path SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') # CSRF Key SECRET_KEY = os.urandom(24) # Pocket API CONSUM...
normal
{ "blob_id": "0656aba517023c003e837d5ad04daeb364f7fda8", "index": 4688, "step-1": "<mask token>\n", "step-2": "<mask token>\nif os.environ.get('HEROKU') is None:\n SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')\n SECRET_KEY = os.urandom(24)\n CONSUMER_KEY = '23571-333bb5dbab87...
[ 0, 1, 2, 3, 4 ]
from ob import * if __name__ == "__main__": # Game starts print('New game!') # Deal deck = Deck() deck.shuffle() players = deck.deal() # Bid auction = Auction(players) auction.bid() # Play tricks = Tricks(auction) tricks.play()
normal
{ "blob_id": "06161b1f45e435d0273dd193229ad2ecfd46c625", "index": 9002, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n print('New game!')\n deck = Deck()\n deck.shuffle()\n players = deck.deal()\n auction = Auction(players)\n auction.bid()\n tricks = Trick...
[ 0, 1, 2, 3 ]
print(" whats your name boi ?") name = input(); if name == "arrya": print("u are a boi"); elif name == "jon": print("basterd") elif name == "ned": print("you are dead man") elif name == "rob": print("the king in the north") else: print("carry on")
normal
{ "blob_id": "483a5e95a7bfca2cc6b1e7e81740620468fb5623", "index": 9646, "step-1": "<mask token>\n", "step-2": "print(' whats your name boi ?')\n<mask token>\nif name == 'arrya':\n print('u are a boi')\nelif name == 'jon':\n print('basterd')\nelif name == 'ned':\n print('you are dead man')\nelif name ==...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestSolution(unittest.TestCase): def test_findOriginalArray(self): solution = Solution() self.assertEqual(solution.findOriginalArray([1, 3, 4, 2, 6, 8]), [1, 3, 4]) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_tok...
flexible
{ "blob_id": "d5acda0d5d066d381a7f6310eb4fe6280d7e84de", "index": 5309, "step-1": "<mask token>\n\n\nclass TestSolution(unittest.TestCase):\n\n def test_findOriginalArray(self):\n solution = Solution()\n self.assertEqual(solution.findOriginalArray([1, 3, 4, 2, 6, 8]), [1,\n 3, 4])\n\n\...
[ 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = 'localhost', 8886 sock.connect(server_address) data = 'TCP' length = len(data) ret = bytearray([]) for byte in dat...
flexible
{ "blob_id": "c6fd848bb3d845a50b928c18a51f296a500e7746", "index": 2922, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n server_address = 'localhost', 8886\n sock.connect(server_address)\n data = 'TCP'\n length = len...
[ 0, 1, 2, 3, 4 ]
from typing import List import pytest from raiden import waiting from raiden.api.python import RaidenAPI from raiden.raiden_service import RaidenService from raiden.tests.utils.detect_failure import raise_on_failure from raiden.tests.utils.network import CHAIN from raiden.tests.utils.transfer import block_offset_time...
normal
{ "blob_id": "c4a13069b5add538589886b5e282d4fc9f2b72ad", "index": 6807, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@raise_on_failure\n@pytest.mark.parametrize('channels_per_node', [CHAIN])\n@pytest.mark.parametrize('number_of_nodes', [3])\ndef test_leave_token_network(raiden_network: List[RaidenSe...
[ 0, 1, 2, 3 ]
# TODO: Add correct copyright header import io from unittest.mock import mock_open, patch from django.test import TestCase from importer.models import * from importer.tasks import * from importer.tests import mock_data class MockResponse: """ This class will be used by the mock to replace requests.get ...
normal
{ "blob_id": "b131107d2161634e2c09e0b3ab80dd322d13fbc2", "index": 2881, "step-1": "<mask token>\n\n\nclass GetCollectionItemidsTest(TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass GetCollectionItemAssetURLsTest(TestCase):\n\n def setUp(self):\n \"\"\"\n Setting up the ...
[ 16, 25, 31, 33, 38 ]
<|reserved_special_token_0|> class terrainDeJeu: def __init__(self, nCoupes, profondeur, nGrainesParCoupelle=4): self.plateau = np.full(2 * nCoupes, nGrainesParCoupelle) self.nGrainesParCoupelleInit = nGrainesParCoupelle self.nCoupes = nCoupes self.scores = [0, 0] self.tou...
flexible
{ "blob_id": "576d6bec4a91ba6f0597b76a5da5ad3ef6562b19", "index": 9592, "step-1": "<mask token>\n\n\nclass terrainDeJeu:\n\n def __init__(self, nCoupes, profondeur, nGrainesParCoupelle=4):\n self.plateau = np.full(2 * nCoupes, nGrainesParCoupelle)\n self.nGrainesParCoupelleInit = nGrainesParCoupe...
[ 14, 20, 21, 24, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def z(i, j, dim): t = dim ** 2 if dim == 2: return t_dim_2[i - 1][j - 1] d = dim // 2 if i <= d: if j <= d: return z(i, j, d) else: j -= d return t // 4...
flexible
{ "blob_id": "07ed8c12e8e5c568c897b6b632c48831267eba51", "index": 1815, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef z(i, j, dim):\n t = dim ** 2\n if dim == 2:\n return t_dim_2[i - 1][j - 1]\n d = dim // 2\n if i <= d:\n if j <= d:\n return z(i, j, d)\n ...
[ 0, 1, 2, 3, 4 ]
from text_to_word_cloud import * from collections import Counter from preprocess import * if __name__ == '__main__': data = load_data('train.json') words = text_to_words(get_all_text(data), as_set=False) cnt = Counter(words) save_il_to_word_cloud_file("cloudofw.txt",cnt,len(words),call_R=True...
normal
{ "blob_id": "b3bba1119bfaf0c1e684e8835259ec6fa8c42cf7", "index": 1838, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n data = load_data('train.json')\n words = text_to_words(get_all_text(data), as_set=False)\n cnt = Counter(words)\n save_il_to_word_cloud_file('clou...
[ 0, 1, 2, 3 ]
import csv import datetime with open('/Users/wangshibao/SummerProjects/analytics-dashboard/myapp/CrimeHistory.csv','rU') as f: reader = csv.reader(f) header = reader.next() date_time = "20140501 00:00" date_time = datetime.datetime.strptime(date_time, "%Y%m%d %H:%M") print date_t...
normal
{ "blob_id": "cfb49d78dc14e6f4b6d2357d292fd6275edec711", "index": 6844, "step-1": "import csv\nimport datetime\nwith open('/Users/wangshibao/SummerProjects/analytics-dashboard/myapp/CrimeHistory.csv','rU') as f:\n reader = csv.reader(f)\n header = reader.next()\n date_time = \"20140501 00:00\...
[ 0 ]
#-*- coding:utf-8 -*- ''' ''' from flask import Flask, jsonify app = Flask(__name__) app.debug = True from datetime import timedelta from flask import make_response, request, current_app, render_template from functools import update_wrapper import json from subprocess import * def crossdomain(origin=None, methods=No...
normal
{ "blob_id": "70c78021a2544ea372545b037ed55298c26391d1", "index": 1182, "step-1": "<mask token>\n\n\ndef getIkbResult(search_str):\n ans_list = get_search_res('ikb', 'kb', search_str)\n for i in ans_list:\n i['kb_id'] = i.pop('id')\n return ans_list\n\n\ndef get_search_res(index, doc_type, query):...
[ 4, 5, 7, 8, 10 ]
<|reserved_special_token_0|> class Comic(models.Model): MAX_PAGES_PER_ISSUE = 1000 sort_number = models.IntegerField(blank=True, null=True) page_number = models.IntegerField(blank=True, null=True) last_page = models.IntegerField(default=1) title = models.CharField(max_length=200, blank=True, null=...
flexible
{ "blob_id": "45dc9d362a2ddfd408f93452bda0b7338057ca81", "index": 8322, "step-1": "<mask token>\n\n\nclass Comic(models.Model):\n MAX_PAGES_PER_ISSUE = 1000\n sort_number = models.IntegerField(blank=True, null=True)\n page_number = models.IntegerField(blank=True, null=True)\n last_page = models.Intege...
[ 12, 13, 14, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def download_subreddit(sub): reddit = praw.Reddit(client_id='oFOYuOd31vUb4UstBWDhnQ', client_secret= '0W_86zufGFCJlSE4lK3CwF_0UEQEQw', username='MarshallBranin', password='#Marshall2', user_agent= 'ma...
flexible
{ "blob_id": "d19310a45a684a7bbb456555a954439df8ae92b6", "index": 1392, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef download_subreddit(sub):\n reddit = praw.Reddit(client_id='oFOYuOd31vUb4UstBWDhnQ', client_secret=\n '0W_86zufGFCJlSE4lK3CwF_0UEQEQw', username='MarshallBranin',\n ...
[ 0, 1, 2, 3 ]
import json import requests as requests from flask import Flask from flask import request from tools import AESCipher, tokenId, TokenKey, appId from tools import TCApplyNeedleUrl, TCCreditNeedleUrl, TCWJNeedleUrl app = Flask(__name__) @app.route('/', methods=['POST']) def hello_world(): if reques...
normal
{ "blob_id": "4652cd5548b550cc21d126fc4fbe3e316ecb71b2", "index": 143, "step-1": "<mask token>\n\n\n@app.route('/', methods=['POST'])\ndef hello_world():\n if request.method == 'POST':\n json_data = request.get_data().decode('utf-8')\n _data = json.loads(json_data)\n orderNo = _data['order...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def countBits(self, num: int) ->List[int]: total = [] for i in range(num + 1): counter = bin(i).count('1') total.appe...
flexible
{ "blob_id": "c6554ff18c23a61d3694e73b808f44c96f9a19c4", "index": 2012, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def countBits(self, num: int) ->List[int]:\n total = []\n for i in range(num + 1):\n counter = bin(i)....
[ 0, 1, 2, 3 ]
import numpy as np import math import matplotlib.pyplot as plt def signif_conf(ts, p): ''' Given a timeseries (ts), and desired probability (p), compute the standard deviation of ts (s) and use the number of points in the ts (N), and the degrees of freedom (DOF) to calculate chi. ''' s = np.std(ts...
normal
{ "blob_id": "84a4a0a16aea08ee874b09de163fd777be925f18", "index": 3041, "step-1": "import numpy as np\nimport math\nimport matplotlib.pyplot as plt\n\n\ndef signif_conf(ts, p):\n ''' Given a timeseries (ts), and desired probability (p),\n compute the standard deviation of ts (s) and use the\n number of p...
[ 0 ]
<|reserved_special_token_0|> class Client(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Request(BaseRequest): """A webob.Request with additional ...
flexible
{ "blob_id": "ca11e9cf0bcfcbd714c45b5c95bd2c2044b65909", "index": 384, "step-1": "<mask token>\n\n\nclass Client(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Request(BaseRequest):\n \"\"\"A webob.Request with additional properti...
[ 8, 11, 12, 14, 16 ]
import pygame naytto = pygame.display.set_mode((740, 500)) pygame.display.set_caption("Piirtäminen") x = 100 y = 300 def main(): while True: tapahtuma = pygame.event.poll() if tapahtuma.type == pygame.QUIT: break naytto.fill((0, 0, 0)) pygame.draw.line(naytto, (0, 0, ...
normal
{ "blob_id": "3fdb29797894737edae37ad7890e14cb9ce705e8", "index": 5901, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.display.set_caption('Piirtäminen')\n<mask token>\n\n\ndef main():\n while True:\n tapahtuma = pygame.event.poll()\n if tapahtuma.type == pygame.QUIT:\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Series(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Genre(models.Model): genre = models.CharField('Genre', max_length=50, blank=False, null=False) description = models.TextField('About this genre', ...
flexible
{ "blob_id": "b34ad8d7fc8df0ab86c5930ab2b5aa1f86d13ae3", "index": 7580, "step-1": "<mask token>\n\n\nclass Series(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass Genre(models.Model):\n genre = models.CharField('Genre', max_length=50, blank=False, null=False)\n description = m...
[ 7, 9, 11, 12, 14 ]
# -*- coding: utf-8 -*- # This file is auto-generated, don't edit it. Thanks. from typing import Dict from Tea.core import TeaCore from alibabacloud_tea_openapi.client import Client as OpenApiClient from alibabacloud_tea_openapi import models as open_api_models from alibabacloud_tea_util.client import Client as UtilCl...
normal
{ "blob_id": "2e5d66033c2a049ba2423d01792a629bf4b8176d", "index": 8728, "step-1": "<mask token>\n\n\nclass Client(OpenApiClient):\n <mask token>\n <mask token>\n\n def get_endpoint(self, product_id: str, region_id: str, endpoint_rule:\n str, network: str, suffix: str, endpoint_map: Dict[str, str],...
[ 8, 10, 11, 12, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> database.read_data() <|reserved_special_token_0|> print(prices.shape) <|reserved_special_token_0|> model.load_state_dict(torch.load('rnn_inner')) model.init_hidden() model.eval() with torch.no_grad(): preds = list(model(prices...
flexible
{ "blob_id": "8abfb6a9ca3a7a909a1e8125e8c03e29b2bacda8", "index": 109, "step-1": "<mask token>\n", "step-2": "<mask token>\ndatabase.read_data()\n<mask token>\nprint(prices.shape)\n<mask token>\nmodel.load_state_dict(torch.load('rnn_inner'))\nmodel.init_hidden()\nmodel.eval()\nwith torch.no_grad():\n preds =...
[ 0, 1, 2, 3 ]
import random choices = ['X', 'O'] try: # Choice of X-O given to the player player_sym = input("Choose 'X' or 'O' : ") # raising an exception if the variable is not X or O if player_sym!='X' and player_sym!='O': raise Exception("Symbol not found") except Exception as e: print(e.args) else: ...
normal
{ "blob_id": "d2f6d7c779d3d6e61d9da7af01a2931fdabec828", "index": 371, "step-1": "<mask token>\n\n\ndef gameOver(board, symbol):\n if board[0] == board[3] == board[6] == symbol or board[1] == board[7\n ] == board[4] == symbol or board[2] == board[5] == board[8\n ] == symbol or board[0] == board[1...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(T): start, end = map(int, input().split()) between = end - start flag = 0 num = 1 while between > 0: if flag % 2 == 1: between -= num num += 1 flag += ...
flexible
{ "blob_id": "a96761fc483c0883b058c2b045b038522c23d426", "index": 3441, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(T):\n start, end = map(int, input().split())\n between = end - start\n flag = 0\n num = 1\n while between > 0:\n if flag % 2 == 1:\n betwee...
[ 0, 1, 2 ]
from django.db import models # Create your models here. class Logins(models.Model): created = models.DateTimeField(auto_now_add=True) login_addr = models.GenericIPAddressField() hostname = models.CharField(max_length=200)
normal
{ "blob_id": "9a55ccf758b4b2cc440153ab3b1f97823863a848", "index": 165, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Logins(models.Model):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Logins(models.Model):\n created = models.DateTimeField(aut...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ZhilianSpider(RedisCrawlSpider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def start_requests(self): url = ( 'https://sou.zhaopin.com/jobs/searchresult.ashx?jl=%E4%B8%8A%E6%B5%B7%2B%E5%8C%97%E4%BA%AC%2...
flexible
{ "blob_id": "894fa01e16d200add20f614fd4a5ee9071777db9", "index": 3339, "step-1": "<mask token>\n\n\nclass ZhilianSpider(RedisCrawlSpider):\n <mask token>\n <mask token>\n <mask token>\n\n def start_requests(self):\n url = (\n 'https://sou.zhaopin.com/jobs/searchresult.ashx?jl=%E4%B8...
[ 2, 3, 4, 5, 6 ]
from bs4 import BeautifulSoup, CData import requests,sys,csv,json,os, urllib.request, re import json url2 = "http://ufm.edu/Estudios" def estudios(Minisoup): print("2.Estudios") #now navigate to /Estudios (better if you obtain href from the DOM) try: html_content = requests.get(url2).text except: print(...
normal
{ "blob_id": "846682072a125c76fc9ffa011109abce7c3bb5d7", "index": 3269, "step-1": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef estudios(Minisoup):\n print('2.Estudios')\n\n\ntry:\n html_content = requests.get(url2).text\nexcept:...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def foo(x, y=5): def bar(x): return x + 1 return bar(y * 2) <|reserved_special_token_0|> <|reserved_special_token_1|> def foo(x, y=5): def bar(x): return x + 1 return bar(y * 2) print(foo(3))
flexible
{ "blob_id": "80d1979c5767d0ff90f464651c9d0ca6d65effb2", "index": 6472, "step-1": "<mask token>\n", "step-2": "def foo(x, y=5):\n\n def bar(x):\n return x + 1\n return bar(y * 2)\n\n\n<mask token>\n", "step-3": "def foo(x, y=5):\n\n def bar(x):\n return x + 1\n return bar(y * 2)\n\n\...
[ 0, 1, 2 ]
import sys class Obj: def __init__(self, name): self.name = name self.down = [] def add_child(self, obj): self.down.append(obj) def prnt(self, prev): if not self.down: print(prev + '=' + self.name) else: for d in self.down: ...
normal
{ "blob_id": "7d3f4e0a5031f9ce618c568b440c7425489060a1", "index": 4122, "step-1": "<mask token>\n\n\nclass Obj:\n\n def __init__(self, name):\n self.name = name\n self.down = []\n\n def add_child(self, obj):\n self.down.append(obj)\n\n def prnt(self, prev):\n if not self.down:...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .hacker import HackerRegistrationPage from .judge import JudgeRegistrationPage from .mentor import MentorRegistrationPage from .organizer import OrganizerRegistrationPage from .user import UserRegistrationPage
flexible
{ "blob_id": "34f3212b0254cbcb5e1ca535a29d4fe820dcaad8", "index": 2978, "step-1": "<mask token>\n", "step-2": "from .hacker import HackerRegistrationPage\nfrom .judge import JudgeRegistrationPage\nfrom .mentor import MentorRegistrationPage\nfrom .organizer import OrganizerRegistrationPage\nfrom .user import Use...
[ 0, 1 ]
<|reserved_special_token_0|> def parse_args(): import argparse import os.path def isfile(path): Error = argparse.ArgumentTypeError if not os.path.exists(path): raise Error("No such file: '{0}'".format(path)) elif not os.path.isfile(path): raise Error("Not a...
flexible
{ "blob_id": "9fdcaf65f070b7081afd327442dd20e3284c71eb", "index": 7905, "step-1": "<mask token>\n\n\ndef parse_args():\n import argparse\n import os.path\n\n def isfile(path):\n Error = argparse.ArgumentTypeError\n if not os.path.exists(path):\n raise Error(\"No such file: '{0}'\...
[ 6, 7, 8, 11, 12 ]
<|reserved_special_token_0|> class Ui_Rec1(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ui_Rec1(object): <|reserved_special_token_0|> def retranslateUi(self, Rec1): _translate = QtCore.QCoreApplication....
flexible
{ "blob_id": "c500ecaa66672ac960dc548c3f3882e4bc196745", "index": 6870, "step-1": "<mask token>\n\n\nclass Ui_Rec1(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Rec1(object):\n <mask token>\n\n def retranslateUi(self, Rec1):\n _translate = QtCore.QCoreApplic...
[ 1, 2, 3, 4, 5 ]
import cv2 import sys # Load the Haar cascades face_cascade = cv2.CascadeClassifier('./haar_cascades/haarcascade_frontalface_default.xml') eyes_cascade = cv2.CascadeClassifier('./haar_cascades/haarcascade_eye.xml') capture = cv2.VideoCapture(0) _, image = capture.read() gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ...
normal
{ "blob_id": "4d707e23f66e8b6bea05a5901d3d8e459247c6c1", "index": 3840, "step-1": "<mask token>\n", "step-2": "<mask token>\ncapture.release()\ncv2.destroyAllWindows()\n<mask token>\nif len(faces) >= 1:\n sys.stdout.write('1')\nelse:\n sys.stdout.write('0')\n", "step-3": "<mask token>\nface_cascade = cv...
[ 0, 1, 2, 3, 4 ]
'''Module for generating and plotting networks.''' from trafpy.generator.src import tools import copy import networkx as nx import matplotlib.pyplot as plt import json def gen_arbitrary_network(num_eps, ep_label=None, ep_capacity=12500, ...
normal
{ "blob_id": "4cf2829282cb0a1673e741f78f17ce27a2817ff2", "index": 651, "step-1": "<mask token>\n\n\ndef gen_arbitrary_network(num_eps, ep_label=None, ep_capacity=12500,\n num_channels=1, racks_dict=None, topology_type=None):\n \"\"\"Generates an arbitrary network with num_eps nodes labelled as ep_label.\n\n...
[ 11, 12, 13, 15, 16 ]