code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
# coding: utf-8 import datetime import json import requests import os import re import sys from todoist.api import TodoistAPI #SLACK_CHANNEL = os.environ['SLACK_CHANNEL'] #SLACK_POSTURL = os.environ['SLACK_POSTURL'] TDIAPI = TodoistAPI(os.environ['TODOISTAPITOKEN'], cache=False) TDIAPI.sync() name = os.environ['TODOI...
normal
{ "blob_id": "3c3d45f0844496b8d623286b36a4935a154f410a", "index": 4133, "step-1": "<mask token>\n\n\ndef lambda_handler(event, context):\n if event['function'] == 'tasklist':\n msg = tasklist(name)\n if event['function'] == 'activity':\n msg = activity(name)\n return\n\n\n<mask token>\n\n\n...
[ 3, 5, 6, 7, 8 ]
""" Script to run pilon iteratively to correct genome assemblies """ import os import argparse import logging import subprocess def parse_arguments(): """ Parse command line arguments """ # Create parser parser = argparse.ArgumentParser(description='Run pilon many times') # Add arguments pars...
normal
{ "blob_id": "fdfb71595bf86fbe1763535814ec9c3cfd312d87", "index": 2722, "step-1": "<mask token>\n\n\ndef run_bwa(reference_genome, forward_read, reverse_read, threads, output, i):\n \"\"\" Run bwa to align reads to reference genome \"\"\"\n print('Align reads with BWA MEM')\n bwa_index_args = ['bwa', 'in...
[ 3, 4, 6, 7, 8 ]
from mcpi.minecraft import Minecraft from time import sleep import random mc = Minecraft.create() myID=mc.getPlayerEntityId("Baymax1112") mineral = [14,15,16,56,73,129,57] while True: sleep(0.5) r=random.choice(mineral) x,y,z = mc.entity.getTilePos(myID) mc.setBlocks(x+1,y+3,z+1,x-1,y-3,z-1,r)
normal
{ "blob_id": "b28ae19f31ae746f901dea645dfeaa211a15cd31", "index": 1879, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n sleep(0.5)\n r = random.choice(mineral)\n x, y, z = mc.entity.getTilePos(myID)\n mc.setBlocks(x + 1, y + 3, z + 1, x - 1, y - 3, z - 1, r)\n", "step-3": "<mask...
[ 0, 1, 2, 3, 4 ]
''' 删除排序数组中的重复项: 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑数组中超出新长度后...
normal
{ "blob_id": "ac0f0fbb9bcb450ac24198069ef8bea8b049ef47", "index": 5824, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef delete_sort_array(origin_list):\n if len(origin_list) == 0:\n return 0\n elif len(origin_list) == 1:\n return 1\n else:\n for index, item in enumerat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> with open('sequence.protein.2.fasta', 'w') as fw: with open('sequence.protein.fasta', 'r') as fr: for line in fr: fw.write(line) <|reserved_special_token_1|> # 내 풀이 with open("sequence.protein.2.fasta", "w") as fw: with open("se...
flexible
{ "blob_id": "84fb0e364ee3cd846148abfc9326f404f008c510", "index": 7908, "step-1": "<mask token>\n", "step-2": "with open('sequence.protein.2.fasta', 'w') as fw:\n with open('sequence.protein.fasta', 'r') as fr:\n for line in fr:\n fw.write(line)\n", "step-3": "# 내 풀이\nwith open(\"sequence...
[ 0, 1, 2 ]
class Model: def derivativesDependsOn(self, models): return [] def derivedVariablesDependsOn(self, models): return [] def initializeSimplifiedModel(self, timeHistory, stateHistory, derivedVariablesHistory): return False def computeSimplifiedState(self, args, time): return [] def comput...
normal
{ "blob_id": "b27e89ff799f26b87a61254e1c4a5f782fcbe605", "index": 2540, "step-1": "class Model:\n <mask token>\n\n def derivedVariablesDependsOn(self, models):\n return []\n <mask token>\n <mask token>\n\n def computeSimplifiedDerivedVariables(self, args, time):\n return []\n\n def...
[ 4, 5, 7, 8, 10 ]
/home/openerp/production/extra-addons/productivity_analysis/report/productivity_analysis.py
normal
{ "blob_id": "6531833a4fe57c15c0668cee9015c7d43491427a", "index": 341, "step-1": "/home/openerp/production/extra-addons/productivity_analysis/report/productivity_analysis.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
class FieldDesigner: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return '\n'.join(map(str, self.field)) <|reserved_special_token_1|> class FieldDesigner: <|reserved_special_token_0|> def __init__(self): self.field...
flexible
{ "blob_id": "c812419e7e024b0bb1207832b2b4a726ef61b272", "index": 9137, "step-1": "class FieldDesigner:\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return '\\n'.join(map(str, self.field))\n", "step-2": "class FieldDesigner:\n <mask token>\n\n def __init__(self)...
[ 2, 3, 4, 5, 6 ]
import re import gpxpy def extract_gpx_data(gpx_file_path, attribute='elevation'): """Reads in a GPX file and returns a list of values for a specified GPX attribute. Parameters ---------- gpx_file_path : str File path to the GPX file (.gpx extension). attribute: str Name of t...
normal
{ "blob_id": "cc6d18785eff0406ff7f38f18f15476375e31b76", "index": 9254, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef extract_gpx_data(gpx_file_path, attribute='elevation'):\n \"\"\"Reads in a GPX file and returns a list of values\n for a specified GPX attribute.\n\n Parameters\n ----...
[ 0, 1, 2, 3 ]
from a10sdk.common.A10BaseClass import A10BaseClass class MacAgeTime(A10BaseClass): """Class Description:: Set Aging period for all MAC Interfaces. Class mac-age-time supports CRUD Operations and inherits from `common/A10BaseClass`. This class is the `"PARENT"` class for this module.` :para...
normal
{ "blob_id": "f08677430e54822abbce61d0cac5a6fea14d3872", "index": 6078, "step-1": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MacAgeTime(A10BaseClass):\n <mask token>\n\n def __init__(self, **kwargs):\n self.ERROR_MSG...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @client.command() async def wasitfunny(): possible_responses = [ 'Per the judgement from the committee of comedy, we have decided that the joke was indeed funny' , 'Per the judgement from the committe...
flexible
{ "blob_id": "f047afeb6462ab01a8fea1f3c8693608335eb960", "index": 3488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@client.command()\nasync def wasitfunny():\n possible_responses = [\n 'Per the judgement from the committee of comedy, we have decided that the joke was indeed funny'\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while len(sc_lst) < 10: try: sc = int(input('请第%d位评委打分:' % i)) if sc > 0 and sc < 101: sc_lst.append(sc) i += 1 else: print('超出范围,输入无效') except: print('请输...
flexible
{ "blob_id": "a17abd3947a946daf2c453c120f2e79d2ba60778", "index": 901, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile len(sc_lst) < 10:\n try:\n sc = int(input('请第%d位评委打分:' % i))\n if sc > 0 and sc < 101:\n sc_lst.append(sc)\n i += 1\n else:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Tutorial(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Tutorial(models.Model): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "32499688db51f701173ec0ea212c483bf902c109", "index": 3048, "step-1": "<mask token>\n\n\nclass Tutorial(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Tutorial(models.Model):\n <mask token>\n <mask token>\n <mask...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'meet.ui' # # Created by: PyQt5 UI code generator 5.8.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName...
normal
{ "blob_id": "c076aed1bfff51f8edf5ab4ef029b7fa7ca2422c", "index": 9479, "step-1": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectName('Dialog')\n Dialog.resize(607, 723)\n self.start = QtWidgets.QLabel(Dialog)\n self.start.setGeometry(Qt...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> default_app_config = 'child.apps.ChildConfig'
flexible
{ "blob_id": "290f96bb210a21183fe1e0e53219ad38ba889625", "index": 1602, "step-1": "<mask token>\n", "step-2": "default_app_config = 'child.apps.ChildConfig'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
""" This file contains the ScoreLoop which is used to show the user thw at most 10 highest scores made by the player """ import pygame from score_fetcher import fetch_scores from entities.sprite_text import TextSprite class ScoreLoop: def __init__(self): self.scores = fetch_scores() self.sprites...
normal
{ "blob_id": "047b3398a73c9e7d75d43eeeab85f52c05ff90c3", "index": 4534, "step-1": "<mask token>\n\n\nclass ScoreLoop:\n\n def __init__(self):\n self.scores = fetch_scores()\n self.sprites = pygame.sprite.Group()\n self.get_score_sprites()\n self.space_cooldown = True\n <mask toke...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TestUrls(SimpleTestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestUrls(SimpleTestCase): def test_profile_resolves(self): url = reverse('profile') self.assertEqual(...
flexible
{ "blob_id": "5dc6b54357df87077d8159192cd52697b2616db8", "index": 9186, "step-1": "<mask token>\n\n\nclass TestUrls(SimpleTestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestUrls(SimpleTestCase):\n\n def test_profile_resolves(self):\n url = reverse('profile')\n ...
[ 1, 2, 3, 4, 5 ]
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from sbpy.data import Phys from sbpy import bib @pytest.mark.remote_data def test_from_sbdb(): """ test from_horizons method""" # query one object data = Phys.from_sbdb('Ceres') assert len(data.table) == 1 # query se...
normal
{ "blob_id": "0bfb089556bfa253bf139f03cd3079ced962d858", "index": 1021, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.remote_data\ndef test_from_sbdb():\n \"\"\" test from_horizons method\"\"\"\n data = Phys.from_sbdb('Ceres')\n assert len(data.table) == 1\n data = Phys.from_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Mas(object): def __init__(self, module): self.module = module self.mas_path = self.module.get_bin_path('mas') self._checked_signin = False self._installed = None self._outdated = None self.count_install = 0 self.count_upgr...
flexible
{ "blob_id": "8b965fd91396735e0153390b4eff540d3aac3aff", "index": 4916, "step-1": "<mask token>\n\n\nclass Mas(object):\n\n def __init__(self, module):\n self.module = module\n self.mas_path = self.module.get_bin_path('mas')\n self._checked_signin = False\n self._installed = None\n ...
[ 14, 15, 16, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> aws_glue_integration_tests += deployment_patterns <|reserved_special_token_1|> <|reserved_special_token_0|> aws_glue_integration_tests = [] deployment_patterns = [IntegrationTestFixture(name= 'how_to_use_great_expectations_...
flexible
{ "blob_id": "e288403cb310bb7241b25e74d1b5bcc63967128c", "index": 1031, "step-1": "<mask token>\n", "step-2": "<mask token>\naws_glue_integration_tests += deployment_patterns\n", "step-3": "<mask token>\naws_glue_integration_tests = []\ndeployment_patterns = [IntegrationTestFixture(name=\n 'how_to_use_grea...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Layer: def __init__(self, m1, m2, f=T.nnet.relu, use_bias=True, zeros=False): if zeros: w = np.zeros((m1, m2)) else: w = np.random.randn(m1, m2) * np.sqrt(2 / m1) self.w = theano.shared(w) self.params = [self.w] se...
flexible
{ "blob_id": "63ee25791177ead5389c14990ce6da3e2c11b683", "index": 6356, "step-1": "<mask token>\n\n\nclass Layer:\n\n def __init__(self, m1, m2, f=T.nnet.relu, use_bias=True, zeros=False):\n if zeros:\n w = np.zeros((m1, m2))\n else:\n w = np.random.randn(m1, m2) * np.sqrt(2...
[ 9, 11, 12, 13, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> graph.write_png('mydecisiontree.png') <|reserved_special_token_0|> plt.show() print(X) print(y) <|reserved_special_token_1|> <|reserved_special_token_0|> df = pandas.read_csv('show.csv') d = {'UK': 0, 'USA': 1, 'N': 2} df['Nati...
flexible
{ "blob_id": "c9cf65eeec49eba004312491cdd2321200fa6a61", "index": 469, "step-1": "<mask token>\n", "step-2": "<mask token>\ngraph.write_png('mydecisiontree.png')\n<mask token>\nplt.show()\nprint(X)\nprint(y)\n", "step-3": "<mask token>\ndf = pandas.read_csv('show.csv')\nd = {'UK': 0, 'USA': 1, 'N': 2}\ndf['Na...
[ 0, 1, 2, 3, 4 ]
from PIL import Image, ImageFilter import numpy as np import glob from numpy import array import matplotlib.pyplot as plt from skimage import morphology import scipy.ndimage def sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1, display1 = True): if (display1): new_list = [] new_list.a...
normal
{ "blob_id": "371c1c9e3ccf7dae35d435bdb013e0462f3add5d", "index": 4831, "step-1": "<mask token>\n\n\ndef sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1,\n display1=True):\n if display1:\n new_list = []\n new_list.append(stack)\n new_list.append(stack)\n new_list.a...
[ 1, 2, 3, 4, 5 ]
import sqlite3 import sys import threading from time import sleep sq = None def get_queue(category, parser): if sq == None: return liteQueue(category, parser) return sq """ SqLite Job Handler class for Links """ class liteQueue: _create = "CREATE TABLE IF NOT EXISTS link ( 'url' TEXT,'cat...
normal
{ "blob_id": "ed6eda4b6dbf3e94d8efb53004b19cd9c49e927e", "index": 3979, "step-1": "<mask token>\n\n\nclass liteQueue:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def _get_conn(self):\n id = threading.current_thread().i...
[ 5, 6, 7, 8, 11 ]
import requests from multiprocessing import Process from atomic_counter import AtomicCounter class Downloader: def __init__(self, src_url, num_threads): try: header = requests.head(src_url).headers self.url = src_url self.file_size = int(header.get('content-length')) ...
normal
{ "blob_id": "3dc3bbd00f9c2d00093bf8669963d96f5019b2da", "index": 4648, "step-1": "<mask token>\n\n\nclass Downloader:\n <mask token>\n\n def _worker(self, download_range: tuple, counter: AtomicCounter):\n start, end = download_range\n header = {'Range': 'bytes=' + str(start) + '-' + str(end)}...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def walk_maze(maze: list[int], width: int, height: int, start: tuple[int, int] ) ->None: """ Does a random walk, setting the cells as it goes, until it cant find a path. """ maze_idx = lambda p: p[1] * width + p[0] north = lambda p: (p[0], p[1] - 1) east = ...
flexible
{ "blob_id": "54002bc7e2a1991d2405acbe1d399e8803ac5582", "index": 7210, "step-1": "<mask token>\n\n\ndef walk_maze(maze: list[int], width: int, height: int, start: tuple[int, int]\n ) ->None:\n \"\"\"\n Does a random walk, setting the cells as it goes, until it cant find a\n path.\n \"\"\"\n maz...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Area(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: unique_together = 'name', 'city' ordering = 'name', <|reserved_special_token_0|> class ApartmentQuerySet(QuerySet): def available(self): return ...
flexible
{ "blob_id": "89ba805e47a9727573e1e25371a70fb887ee170d", "index": 9141, "step-1": "<mask token>\n\n\nclass Area(models.Model):\n <mask token>\n <mask token>\n\n\n class Meta:\n unique_together = 'name', 'city'\n ordering = 'name',\n <mask token>\n\n\nclass ApartmentQuerySet(QuerySet):\n\...
[ 15, 19, 20, 21, 23 ]
class BucketSort: def __init__(self, a): self.a = a def result(self, bucketCount=10): buckets = [[] for i in range(bucketCount + 1)] maxElement = max(self.a) minElement = min(self.a) bucketRange = (maxElement - minElement + 1) / bucketCount for i in range(len(se...
normal
{ "blob_id": "3b803850418638bf65528088044918e93ecabff6", "index": 3085, "step-1": "<mask token>\n", "step-2": "class BucketSort:\n <mask token>\n <mask token>\n", "step-3": "class BucketSort:\n <mask token>\n\n def result(self, bucketCount=10):\n buckets = [[] for i in range(bucketCount + 1...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2]) ).json().get('id') print(get) <|reserved_special_token_1|> <|reserved_special_token_0|> from sys import argv i...
flexible
{ "blob_id": "8280f321b102cace462761f9ece2aebf9e28a432", "index": 3941, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n get = requests.get('https://api.github.com/user', auth=(argv[1], argv[2])\n ).json().get('id')\n print(get)\n", "step-3": "<mask token>\nfrom s...
[ 0, 1, 2, 3 ]
import json import pandas as pd import matplotlib.pyplot as plt f = open('Maradona-goals.json') jsonObject = json.load(f) f.close() l = [] for c, cl in jsonObject.items(): for d in cl: d.update({'player' : c}) l.append(d) df = pd.DataFrame(l) labels = df["year"] width = 0.75 fig = plt.figure(f...
normal
{ "blob_id": "33e9e45fbe0e3143d75d34c1db283c01e2693f68", "index": 4967, "step-1": "<mask token>\n", "step-2": "<mask token>\nf.close()\n<mask token>\nfor c, cl in jsonObject.items():\n for d in cl:\n d.update({'player': c})\n l.append(d)\n<mask token>\nax.set_xticks(labels)\nax.set_xticklabels(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def reorder_sentences(output_sentences, input): def custom_sort(s1, s2): return input.find(s1) - input.find(s2) output_sentences.sort(key=functools.cmp_to_key(custom_sort)) return output_sentences <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "837e84d4a58d8fd0d0ffc24973d196ae57f9a260", "index": 1723, "step-1": "<mask token>\n\n\ndef reorder_sentences(output_sentences, input):\n\n def custom_sort(s1, s2):\n return input.find(s1) - input.find(s2)\n output_sentences.sort(key=functools.cmp_to_key(custom_sort))\n return output_...
[ 1, 4, 5, 6, 7 ]
__author__ = 'fshaw' import gzip import hashlib import os import uuid import json import jsonpickle from chunked_upload.models import ChunkedUpload from chunked_upload.views import ChunkedUploadView, ChunkedUploadCompleteView from django.conf import settings from django.core import serializers from django.core.files.ba...
normal
{ "blob_id": "2b7415d86f9157ae55228efdd61c9a9e9920bc5c", "index": 7716, "step-1": "<mask token>\n\n\nclass CopoChunkedUploadCompleteView(ChunkedUploadCompleteView):\n do_md5_check = False\n\n def get_response_data(self, chunked_upload, request):\n \"\"\"\n Data for the response. Should return ...
[ 12, 13, 14, 15, 18 ]
print("rap.sweeps.data_management level init")
normal
{ "blob_id": "7d138a0ad7e4d8f7047dd73ae503bdc7ae5aa065", "index": 9801, "step-1": "<mask token>\n", "step-2": "print('rap.sweeps.data_management level init')\n", "step-3": "print(\"rap.sweeps.data_management level init\")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
input = """ t(Z) :- t0(Z). t(Z) :- g(X,Y,Z), t(X), not t(Y). t0(2). g(5,1,3). g(1,2,4). g(3,4,5). """ output = """ t(Z) :- t0(Z). t(Z) :- g(X,Y,Z), t(X), not t(Y). t0(2). g(5,1,3). g(1,2,4). g(3,4,5). """
normal
{ "blob_id": "df5c79c79d827b6b3de7ceb4b1e3c652c8956346", "index": 2620, "step-1": "<mask token>\n", "step-2": "input = \"\"\"\nt(Z) :- t0(Z).\nt(Z) :- g(X,Y,Z), t(X), not t(Y).\n\nt0(2).\ng(5,1,3).\ng(1,2,4).\ng(3,4,5).\n\n\"\"\"\noutput = \"\"\"\nt(Z) :- t0(Z).\nt(Z) :- g(X,Y,Z), t(X), not t(Y).\n\nt0(2).\ng(5...
[ 0, 1 ]
import os from PIL import Image import urllib import json import math def download_images(a,b): image_count = 0 k = a no_of_images = b baseURL='https://graph.facebook.com/v2.2/' imgURL='/picture?type=large' sil_check='/picture?redirect=false' while image_count<no_of_images: obj=urllib.urlopen(baseURL+str(k)+s...
normal
{ "blob_id": "533154fe58511ac9c9c693bf07f076146b0c6136", "index": 4445, "step-1": "import os\nfrom PIL import Image\nimport urllib\nimport json\nimport math\n\ndef download_images(a,b):\n\timage_count = 0\n\tk = a\n\tno_of_images = b\n\tbaseURL='https://graph.facebook.com/v2.2/'\n\timgURL='/picture?type=large'\n\...
[ 0 ]
# coding=utf-8 """ PYOPENGL-TOOLBOX UTILS General purpouse functions. MIT License Copyright (c) 2015-2019 Pablo Pizarro R. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, inc...
normal
{ "blob_id": "cffcfa08cd919f93dfe2ab8dc676efc76feafab3", "index": 2123, "step-1": "<mask token>\n\n\ndef create_axes(length, both=False, text=False, font=_glut.\n GLUT_BITMAP_HELVETICA_18):\n \"\"\"\n Create axes system.\n\n :param length: Axes length\n :param both: Both axes\n :param text: Show...
[ 2, 3, 5, 6, 7 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-02-24 11:30 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Create...
normal
{ "blob_id": "56157aaf3f98abc58572b45111becb91cb93f328", "index": 2926, "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> SUCCESS = 200 NotFound = 404 url_site = 'https://petstore.swagger.io/v2' new_username = 'Khrystyna' new_id = 12345 invalid_new_id = 1234 error_message = 'oops we have a problem!' store_inventory = {'1': 1, '4444': 2, 'teste': 1, '...
flexible
{ "blob_id": "54ed0683d0f8d907c27e2f3809f9533556593392", "index": 5546, "step-1": "<mask token>\n", "step-2": "<mask token>\nSUCCESS = 200\nNotFound = 404\nurl_site = 'https://petstore.swagger.io/v2'\nnew_username = 'Khrystyna'\nnew_id = 12345\ninvalid_new_id = 1234\nerror_message = 'oops we have a problem!'\ns...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def derf1(l, lp, kbt): return kbt / lp * (0.5 / ((1.0 - l) * (1.0 - l) * (1.0 - l)) + 1.0) def xdefWLC(kbt, l, p, f): l0 = 0.9999 lnew = l0 - (f1(l0, p, kbt) - f) / derf1(l0, p, kbt) if abs(f) < 1e-05: return 0.0 while abs(l0 - lnew) > 1e-05: l0 = lne...
flexible
{ "blob_id": "9817600759bc01e89f6c48bdc2d256651aedf74d", "index": 1788, "step-1": "<mask token>\n\n\ndef derf1(l, lp, kbt):\n return kbt / lp * (0.5 / ((1.0 - l) * (1.0 - l) * (1.0 - l)) + 1.0)\n\n\ndef xdefWLC(kbt, l, p, f):\n l0 = 0.9999\n lnew = l0 - (f1(l0, p, kbt) - f) / derf1(l0, p, kbt)\n if ab...
[ 4, 6, 7, 8, 9 ]
import matplotlib.image as mpimg import cv2 import rasterio from ode_data_access.image_utils import view_as_blocks, is_black, align_and_crop import os import numpy as np from tqdm import tqdm class ChunkProcessor: def write_result_blocks(self, result_blocks, window, product_name, chunk_size, save_dir=...
normal
{ "blob_id": "303e1b95c2ca60041a34b8c09e013849112a108d", "index": 3475, "step-1": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ChunkProcessor:\n <mask token>\n\n def chunkify(self, img_file, product_name, chunk_size=2...
[ 1, 2, 3, 5, 6 ]
import tensorflow as tf def Float32(): return tf.float32 def Float16(): return tf.float16
normal
{ "blob_id": "c60b8eec57d845c73ee3e00432747d23748c1706", "index": 9537, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Float32():\n return tf.float32\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef Float32():\n return tf.float32\n\n\ndef Float16():\n return tf.float16\n", "step...
[ 0, 1, 2, 3 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "e95de58828c63dc8ae24efff314665a308f6ce0c", "index": 983, "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|> <|reserved_special_token_1|> <|reserved_special_token_0|> print( 'Um funcioario que ganhava R$ {:.2f} com o aumento de 15% passa a ganhar R$ {:.2f}' .format(salario, novo)) <|reserved_special_token_1|> salario = float(input('Qual o valor do seu Salario atual? R$ ')) novo = sal...
flexible
{ "blob_id": "ffcd3c0086ff73eb722d867b335df23382615d20", "index": 1657, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n 'Um funcioario que ganhava R$ {:.2f} com o aumento de 15% passa a ganhar R$ {:.2f}'\n .format(salario, novo))\n", "step-3": "salario = float(input('Qual o valor do seu Sa...
[ 0, 1, 2, 3 ]
""" If you are using MultiScript Editor make sure to set PYTHONPATH to Winexs' editor. You can use set PYTHONPATH=c:/users/username/myscripts Set paths according to your project! """ CHROME_WEBDRIVER = 'c:/users/username/project/chromedriver.exe' WEBSITE_PDF_CONVERTER = 'https://www.ilovepdf.com/merge_pdf' PDF_FILES ...
normal
{ "blob_id": "0fdbdfe98496ebedb112c85b79836292ffa3a5a9", "index": 9076, "step-1": "<mask token>\n", "step-2": "<mask token>\nCHROME_WEBDRIVER = 'c:/users/username/project/chromedriver.exe'\nWEBSITE_PDF_CONVERTER = 'https://www.ilovepdf.com/merge_pdf'\nPDF_FILES = 'c:/users/username/project'\n", "step-3": "\"\...
[ 0, 1, 2 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Fetch screen scores with customizable search criteria that can be tailored to match your own requirements in tab format """ import requests from core import config as cfg screen_id = 178 request_url = cfg.BASE_URL + "/screen/" + str(screen_id) # These parameters ca...
normal
{ "blob_id": "80c6dd1c76b3ac56f34e36f571e8db3927994311", "index": 8162, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in screen:\n if row_count == 0:\n row_count = row_count + 1\n continue\n row = row.split('\\t')\n data[row[1]] = row\nprint(data['55299'])\nprint(data['5166...
[ 0, 1, 2, 3, 4 ]
import pytest from feast.pyspark.launchers.gcloud import DataprocClusterLauncher @pytest.fixture def dataproc_launcher(pytestconfig) -> DataprocClusterLauncher: cluster_name = pytestconfig.getoption("--dataproc-cluster-name") region = pytestconfig.getoption("--dataproc-region") project_id = pytestconfig....
normal
{ "blob_id": "ff13ac0ee401471fe5446e8149f019d9da7f3ddf", "index": 5147, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture\ndef dataproc_launcher(pytestconfig) ->DataprocClusterLauncher:\n cluster_name = pytestconfig.getoption('--dataproc-cluster-name')\n region = pytestconfig.getopt...
[ 0, 1, 2, 3 ]
from django.shortcuts import render, get_object_or_404 from django.core.paginator import Paginator from .models import Blog, BlogType from django.conf import settings from read_statistics.utils import read_statistics_once_read from user.forms import LoginForm # Create your views here. #分页函数 def get_blogs_common_data(r...
normal
{ "blob_id": "9731f45b19d40a031216f8a430c09764fd34e984", "index": 2594, "step-1": "<mask token>\n\n\ndef get_blogs_common_data(request, blogs_all_list):\n page_num = request.GET.get('page', 1)\n paginator = Paginator(blogs_all_list, settings.BLOGS_PER_PAGE)\n page_of_blogs = paginator.get_page(page_num)\...
[ 3, 4, 5, 6, 7 ]
from datetime import datetime import logging import os import re from bs4 import BeautifulSoup import requests from .utils.log import get_logger logger = get_logger(os.path.basename(__file__)) EVENTBRITE_TOKEN = os.environ['EVENTBRITE_TOKEN'] def get_category_name(page): if page["category_id"] is None: ...
normal
{ "blob_id": "edfc8794fab2c95e01ae254f9f13d446faafe6fd", "index": 9213, "step-1": "<mask token>\n\n\ndef scrape(event_id, event_cost):\n page = get(event_id, resource='events').json()\n venue = get(page['venue_id'], resource='venues').json()\n start = datetime.strptime(page['start']['local'], '%Y-%m-%dT%...
[ 5, 7, 8, 9, 10 ]
# 데이터 출처: kaggle # 데이터 개요: 511, 유리를 위한 다양한 속성(화학원소)들로부터 type 구별 # 데이터 예측 모델: 이진클래스 # 적용 머신러닝 모델: 깊은 다층 퍼셉트론 신경망 # 훈련 데이터셋: 160건 # 검증 데이터셋: 건 # 시험 데이터셋: 수집데이터로서 시험셋을 확보할 수 없으므로 고려하지 않음 # 입력 데이터: 10개 항목의 데이터 # 은닉층: 2개 # 사용한 활성화 함수 # - 제1 은닉층: Relu # - 제2 은닉층: Relu # - Output Layer: Softmax # 사용한 손실함수: categorical_cros...
normal
{ "blob_id": "bfa5739949c26758e3762fcff8347d23ad70f704", "index": 6114, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(5)\n<mask token>\nmodel.add(Dense(64, input_dim=input_data_number, activation='relu'))\nmodel.add(Dense(64, activation='relu'))\nmodel.add(Dense(7, activation='softmax'))\n...
[ 0, 1, 2, 3, 4 ]
from typing import * class Solution: def uniquePaths(self, m: int, n: int) -> int: map_: List[List[int]] = [[0 if (i > 0 and j > 0) else 1 for j in range(m)] for i in range(n)] for row in range(1, n): for col in range(1, m): map_[row][col] = map_[row][col - 1] + map_[ro...
normal
{ "blob_id": "e2a38d38d2ab750cf775ed0fbdb56bc6fc7300c4", "index": 8934, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def uniquePaths(self, m: int, n: int) ->int:\n map_: List[List[int]] = [[(0 if i > 0 and j > 0 e...
[ 1, 2, 3, 4, 5 ]
# # abc088 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.r...
normal
{ "blob_id": "8b97c1e14adfcb09806e2d37e2f5c4f0b356c009", "index": 2742, "step-1": "<mask token>\n\n\nclass TestClass(unittest.TestCase):\n <mask token>\n\n def test_入力例_1(self):\n input = '1 0 1\\n2 1 2\\n1 0 1'\n output = 'Yes'\n self.assertIO(input, output)\n <mask token>\n <mas...
[ 2, 6, 8, 9, 10 ]
from amqpstorm import management if __name__ == '__main__': # If using a self-signed certificate, change verify=True to point at your CA bundle. # You can disable certificate verification for testing by passing in verify=False. API = management.ManagementApi('https://rmq.amqpstorm.io:15671', 'guest', ...
normal
{ "blob_id": "0279057b3962e4b9839a86fc2e2683ac1da11b1a", "index": 8665, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n API = management.ManagementApi('https://rmq.amqpstorm.io:15671',\n 'guest', 'guest', verify=True)\n try:\n result = API.aliveness_test('/'...
[ 0, 1, 2, 3 ]
import random import matplotlib.pyplot as plt import numpy as np from sklearn.datasets import fetch_mldata from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, LabelBinarizer from ann.act import relu, softmax_with_xentropy from ann.loss import xentropy_with_softmax fr...
normal
{ "blob_id": "2f6e5ed4e2d52190551dec2ac18441b8355699b5", "index": 7096, "step-1": "<mask token>\n\n\ndef plot(ax, ls_batch, ls_dev, its, title):\n ax.plot(range(len(ls_batch)), ls_batch, label='Batch')\n ax.plot(range(len(ls_dev)), ls_dev, label='Dev')\n ax.text(0.3, 0.93, 'Batch: {:.3f}'.format(ls_batch...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> router.register('', views.RoomViewSet) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'rooms' router = DefaultRouter() router.register('', views.RoomViewSet) urlpatterns = rout...
flexible
{ "blob_id": "96708216c5ffa56a60475b295c21b18225e6eed9", "index": 6056, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouter.register('', views.RoomViewSet)\n<mask token>\n", "step-3": "<mask token>\napp_name = 'rooms'\nrouter = DefaultRouter()\nrouter.register('', views.RoomViewSet)\nurlpatterns = rou...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class YahooHelper: <|reserved_special_token_0|> def __init__(self): """ Default constructor which initiates object """ pass <|reserved_special_token_0|> def get_stock_data(symbol): """ Function to get stock data for current...
flexible
{ "blob_id": "b4b4dad5cf630dc1a627e323ea63577583d1e1c3", "index": 1551, "step-1": "<mask token>\n\n\nclass YahooHelper:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Default constructor which initiates object\n \"\"\"\n pass\n <mask token>\n\n def get_stock_data(symbol)...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def save_location(ip_addr): try: existing_location = Location.query.filter_by(ip=ip_addr).first() if existing_location: location_data = existing_location.location else: location_data = get_location(ip_addr=ip_addr) location =...
flexible
{ "blob_id": "eb8aec947cc1eeeb56b3884286b46ec7468dcc23", "index": 9035, "step-1": "<mask token>\n\n\ndef save_location(ip_addr):\n try:\n existing_location = Location.query.filter_by(ip=ip_addr).first()\n if existing_location:\n location_data = existing_location.location\n else:...
[ 1, 2, 3, 4 ]
from pythongame.core.buff_effects import get_buff_effect, register_buff_effect, StatModifyingBuffEffect from pythongame.core.common import ItemType, Sprite, BuffType, Millis, HeroStat from pythongame.core.game_data import UiIconSprite, register_buff_text from pythongame.core.game_state import Event, PlayerDamagedEnemy,...
normal
{ "blob_id": "61454a3d6b5b17bff871ededc6ddfe8384043884", "index": 59, "step-1": "<mask token>\n\n\nclass ItemEffect(AbstractItemEffect):\n <mask token>\n\n\nclass BuffedByHealingWand(StatModifyingBuffEffect):\n\n def __init__(self):\n super().__init__(BUFF_TYPE, {HeroStat.HEALTH_REGEN: HEALTH_REGEN_B...
[ 3, 4, 6, 7, 8 ]
from django.shortcuts import render from rest_framework import status from rest_framework.views import APIView from rest_framework.response import Response from django.conf import settings import subprocess import os import json class HookView(APIView): def post(self, request, *args, **kwargs): SCRIPT_PAT...
normal
{ "blob_id": "6f5bca8c1afcd9d9971a64300a576ca2b2f6ef70", "index": 1694, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass HookView(APIView):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass HookView(APIView):\n\n def post(self, request, *args, **kwargs):\n SCRIPT_PATH = os.path....
[ 0, 1, 2, 3, 4 ]
cardlist = [] card = [] for j in range(1,5): for k in range(1,14): if j == 1: cardlist.append(["S", "{}".format(k)]) elif j == 2: cardlist.append(["H", "{}".format(k)]) elif j == 3: cardlist.append(["C", "{}".format(k)]) elif j == 4: c...
normal
{ "blob_id": "937a101cf5c7e943fc62d18b77357eea151fdfaf", "index": 7789, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor j in range(1, 5):\n for k in range(1, 14):\n if j == 1:\n cardlist.append(['S', '{}'.format(k)])\n elif j == 2:\n cardlist.append(['H', '{}'.for...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Cell(Enum): BasicRNN = 1 BasicLSTM = 2 LSTMCellPeephole = 3 GRU = 4 <|reserved_special_token_0|> def normalize_data(df): min_max_scaler = sklearn.preprocessing.MinMaxScaler() df['Open'] = min_max_scaler.fit_transform(df['Open'].values.reshape(-1, 1)) ...
flexible
{ "blob_id": "4379d89c2ada89822acbf523d2e364599f996f8c", "index": 5456, "step-1": "<mask token>\n\n\nclass Cell(Enum):\n BasicRNN = 1\n BasicLSTM = 2\n LSTMCellPeephole = 3\n GRU = 4\n\n\n<mask token>\n\n\ndef normalize_data(df):\n min_max_scaler = sklearn.preprocessing.MinMaxScaler()\n df['Open...
[ 7, 8, 9, 10, 12 ]
# coding=utf-8 import pyautogui from xpinyin import Pinyin rubbish_dic=1 if rubbish_dic==0: chinese_rubbish=( u"草泥马", u"你妈死了", u"你是不是", u"低能", u"人话都听不懂", u"没家教的狗东西", ) elif rubbish_dic==1: rubbish_file=open("rubbish_dic.txt") chinese_rubbish=rubbish_file.read().splitlines() ...
normal
{ "blob_id": "23e673909b2f1eb9a265ce84ad63464e20e99c6a", "index": 3449, "step-1": "<mask token>\n\n\ndef trans_screen():\n pyautogui.doubleClick(492, 974)\n pyautogui.typewrite(['enter'], 0.01)\n\n\ndef trans_chinese():\n for c_rubbish in chinese_rubbish:\n pin = p.get_pinyin(c_rubbish, '')\n ...
[ 4, 5, 6, 7, 8 ]
from django import forms from . import models class PhotoForm(forms.Form): image = forms.ImageField()
normal
{ "blob_id": "3983f8dfb9c7b7e664af05857a0f6fe380154424", "index": 3684, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PhotoForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PhotoForm(forms.Form):\n image = forms.ImageField()\n", "step-4": "from django import form...
[ 0, 1, 2, 3 ]
IS_ZERO = lambda x: x == 0 ONE = 1 SUB1 = lambda x: x - 1 MULT = lambda x: lambda y: x * y IF = lambda cond: lambda t_func: lambda f_func: t_func(None) if cond else f_func(None) print( ( lambda myself: ( lambda n: ( IF( IS_ZERO(n) )( ...
normal
{ "blob_id": "f8601ed7ba7c2b8d2dd8d5f74f7b5ae8e99dad78", "index": 186, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint((lambda myself: lambda n: IF(IS_ZERO(n))(lambda _: ONE)(lambda _:\n MULT(n)(myself(myself)(SUB1(n)))))(lambda myself: lambda n: IF(IS_ZERO(\n n))(lambda _: ONE)(lambda _: MULT(...
[ 0, 1, 2, 3 ]
import sys n= int(sys.stdin.readline()) dp = {1:'SK', 2: 'CY', 3:'SK', 4:'SK', 5:'SK',6:'SK'} def sol(k): if k in dp: return dp[k] else: for i in range(7, k+1): if dp[i-3]=='SK' and dp[i-1]=='SK' and dp[i-4]=='SK': dp[i] = 'CY' else: dp[...
normal
{ "blob_id": "4b85479af7d65d208fab08c10afbf66086877329", "index": 8981, "step-1": "<mask token>\n\n\ndef sol(k):\n if k in dp:\n return dp[k]\n else:\n for i in range(7, k + 1):\n if dp[i - 3] == 'SK' and dp[i - 1] == 'SK' and dp[i - 4] == 'SK':\n dp[i] = 'CY'\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class FinalLevel(BaseLevel): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class FinalLevel(BaseLevel): def __init__(self): lvl_map = DefinedMap('levels/demon_lair.xp') super().__init__...
flexible
{ "blob_id": "7ba8f0bd962413f6ff825df27330447b11360f10", "index": 6089, "step-1": "<mask token>\n\n\nclass FinalLevel(BaseLevel):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass FinalLevel(BaseLevel):\n\n def __init__(self):\n lvl_map = DefinedMap('levels/demon_lair.xp')\n ...
[ 1, 2, 3, 4 ]
# My Godzilla Hat Code - @alt_bier from adafruit_circuitplayground.express import cpx import random #cpx.pixels.brightness = 0.5 # 50 pct cpx.pixels.fill((0, 0, 0)) # Turn off the NeoPixels if they're on! # Function to give us a nice color swirl on the built in NeoPixel (R,G,B) def wheeln(pos, sft): if (pos + sf...
normal
{ "blob_id": "1dd223854c10e69a397098511eab50b9ebd347c8", "index": 6027, "step-1": "<mask token>\n\n\ndef wheeln(pos, sft):\n if pos + sft > 255:\n pos = pos + sft - 256\n else:\n pos = pos + sft\n if pos < 0 or pos > 255:\n return 0, 0, 0\n if pos < 85:\n return int(255 - p...
[ 4, 5, 6, 7, 8 ]
import discord from discord.ext import commands class TestCommands(commands.Cog, description="Unstable test commands", command_attrs=dict(hidden=True, description="Can only be used by an Owner")): def __init__(self, bot): self.bot = bot self.hidden = True print("Loaded", __name__) as...
normal
{ "blob_id": "d5a5c6f9d483b2998cd0d9e47b37ab4499fa1c2a", "index": 6279, "step-1": "<mask token>\n\n\nclass TestCommands(commands.Cog, description='Unstable test commands',\n command_attrs=dict(hidden=True, description='Can only be used by an Owner')\n ):\n <mask token>\n\n async def cog_check(self, ct...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def str2int(strtime: str): hh, mm, ss = strtime.split(':') return 3600 * int(hh) + 60 * int(mm) + int(ss) def int2str(inttime: int): hh = inttime // 3600 mm = inttime % 3600 // 60 ss = inttime % 60 return str(hh).zfill(2) + ':' + str(mm).zfill(2) + ':' + str(ss)....
flexible
{ "blob_id": "cb50a5352b0ad7b04dee9393c50da54fdf507376", "index": 2018, "step-1": "<mask token>\n\n\ndef str2int(strtime: str):\n hh, mm, ss = strtime.split(':')\n return 3600 * int(hh) + 60 * int(mm) + int(ss)\n\n\ndef int2str(inttime: int):\n hh = inttime // 3600\n mm = inttime % 3600 // 60\n ss ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('hello') print('===================================================') print('Nama Lengkap : Agung Dharmawan') print('Kelas : Teknik Informatika 2018 A') print('Kampus : Universitas Nahdlatul Ulama Sidoarjo') print('=========================...
flexible
{ "blob_id": "4e10bc876797d0939c91cff5eff497b36af35dcb", "index": 1932, "step-1": "<mask token>\n", "step-2": "print('hello')\nprint('===================================================')\nprint('Nama Lengkap : Agung Dharmawan')\nprint('Kelas : Teknik Informatika 2018 A')\nprint('Kampus : Universit...
[ 0, 1, 2 ]
rom diseas import Disease from parse import analyzing from config import FILE_NAME from random import randint if __name__ == '__main__': """ Main module that runs the program. """ def working_with_user(disea): print('Choose what you want to know about that disease:\naverage_value(will return th...
normal
{ "blob_id": "b33af7aff0f3fde6499d5e24fc036d5bd74b6e47", "index": 3550, "step-1": "rom diseas import Disease\nfrom parse import analyzing\nfrom config import FILE_NAME\nfrom random import randint\n\nif __name__ == '__main__':\n \"\"\"\n Main module that runs the program.\n \"\"\"\n def working_with_us...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class State: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class State: def __init__(self, id): self.id = id <|reserved_special_token_0|> <|reserved_special_token_1|> class State: def __...
flexible
{ "blob_id": "200deda300e39b07e0e558277a340b7ad01c7dee", "index": 2216, "step-1": "<mask token>\n", "step-2": "class State:\n <mask token>\n\n\n<mask token>\n", "step-3": "class State:\n\n def __init__(self, id):\n self.id = id\n\n\n<mask token>\n", "step-4": "class State:\n\n def __init__(s...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ChatService: @staticmethod def is_room_exists(room_id: int) ->bool: return RoomGroup.objects.filter(id=room_id).exists() @staticmethod def create_users_room(**data) ->RoomGroup: room = RoomGroup.objects.create(room_id=data.get('room_id')) ro...
flexible
{ "blob_id": "d71ffd022d87aa547b2a379f4c92d767b91212fd", "index": 3827, "step-1": "<mask token>\n\n\nclass ChatService:\n\n @staticmethod\n def is_room_exists(room_id: int) ->bool:\n return RoomGroup.objects.filter(id=room_id).exists()\n\n @staticmethod\n def create_users_room(**data) ->RoomGro...
[ 6, 9, 11, 12, 13 ]
import torch,cv2,os,time import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # GPU kullanımı device=torch.device(0) class NET(nn.Module): def __init__(self): super(). __init__() ...
normal
{ "blob_id": "ad63beedc460b3d64a51d0b1f81f8e44cb559749", "index": 1655, "step-1": "<mask token>\n\n\nclass NET(nn.Module):\n <mask token>\n\n def uzunluk(self, x):\n x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))\n x = F.max_pool2d(F.relu(self.conv2(x)), (2, 2))\n x = F.max_pool2d(F.re...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for myfile in files: if myfile[-4:] != 'xlsx': continue tg_xlsx = load_workbook(os.path.join(path, myfile), read_only=True) tg_sheet = tg_xlsx.active for row in tg_sheet.iter_rows(): row_data = [] ...
flexible
{ "blob_id": "d23700f03e8498a5ff3d1d03d8808048ba79a56b", "index": 9381, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor myfile in files:\n if myfile[-4:] != 'xlsx':\n continue\n tg_xlsx = load_workbook(os.path.join(path, myfile), read_only=True)\n tg_sheet = tg_xlsx.active\n for row ...
[ 0, 1, 2, 3, 4 ]
from django import forms from django.contrib.auth.models import User from ServicePad.apps.account.models import UserProfile import hashlib, random, datetime from ServicePad.apps.registration.models import ActivationKey MIN_PASSWORD_LENGTH=8 MAX_PASSWORD_LENGTH=30 class UserRegistrationForm(forms.Form): first_name...
normal
{ "blob_id": "5f680fb21fe1090dfb58f5b9260739b91ae04d99", "index": 9922, "step-1": "<mask token>\n\n\nclass UserRegistrationForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def save(self):\n new_user = User...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class StepUtilTest(wf_testcase.WaterfallTestCase): def testGetLowerBoundBuildNumber(self): self.assertEqual(5, step_util._GetLowerBoundBuildNumber(5, 100)) self.assertEqual(50, step_util._GetLowerBoundBuildNumber(None, 100, 200)) self.assertEqual(1...
flexible
{ "blob_id": "325efe65030ad3488a7fc45c0d4a289eb0b17196", "index": 1311, "step-1": "<mask token>\n\n\nclass StepUtilTest(wf_testcase.WaterfallTestCase):\n\n def testGetLowerBoundBuildNumber(self):\n self.assertEqual(5, step_util._GetLowerBoundBuildNumber(5, 100))\n self.assertEqual(50, step_util._...
[ 26, 32, 43, 49, 55 ]
<|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": "7f63097265b1058785e90441f85b7f0088946717", "index": 7785, "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 = [('guac_auth',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ContentKind(models.Model): <|reserved_special_token_0|> def __str__(self): return self.kind class FileFormat(models.Model): extension = models.CharField(primary_key=True, max_length=40, choices= file_formats.choices) mimetype = models.CharField(max...
flexible
{ "blob_id": "32e904a39d03d3166369420b49db0b9b118110a3", "index": 4179, "step-1": "<mask token>\n\n\nclass ContentKind(models.Model):\n <mask token>\n\n def __str__(self):\n return self.kind\n\n\nclass FileFormat(models.Model):\n extension = models.CharField(primary_key=True, max_length=40, choice...
[ 65, 102, 158, 169, 216 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def lis(n1, n2): """ Generate and print last 5 element in list. param:n1,n2 """ i = 0 if n1 and n2 <= 20: for x in range(n1, n2 + 1): lis1.append(x * x) lis1.reverse() for y in ...
flexible
{ "blob_id": "24c1f5195bad17f995fb97a03218fc9bbe5ce4cd", "index": 2476, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lis(n1, n2):\n \"\"\"\n\tGenerate and print last 5 element in list.\n\tparam:n1,n2\n\t\"\"\"\n i = 0\n if n1 and n2 <= 20:\n for x in range(n1, n2 + 1):\n ...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python import pyglet from pyglet.gl import * win = pyglet.window.Window() @win.event def on_draw(): # Clear buffers glClear(GL_COLOR_BUFFER_BIT) # Draw outlines only glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) # Draw some stuff glBegin(GL_TRIANGLES) glVertex3i(0, 0, 0) glVertex3i(300, 0, 0) glVe...
normal
{ "blob_id": "86c4193ec0fee8a0c06858913ec8153fcf0df6d9", "index": 4114, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@win.event\ndef on_draw():\n glClear(GL_COLOR_BUFFER_BIT)\n glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)\n glBegin(GL_TRIANGLES)\n glVertex3i(0, 0, 0)\n glVertex3i(300, 0,...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def is_prime(x): if x < 2: return False for i in range(2, int(sqrt(x)) + 1): if x % i == 0: return False return True def primes(x): return islice((p for p in count() if is_prime(p)), x) <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "0f1bad350faaff6aab339944b4d24c4801fa8c64", "index": 4965, "step-1": "<mask token>\n\n\ndef is_prime(x):\n if x < 2:\n return False\n for i in range(2, int(sqrt(x)) + 1):\n if x % i == 0:\n return False\n return True\n\n\ndef primes(x):\n return islice((p for p in...
[ 2, 3, 4, 5, 6 ]
import os.path from flask import url_for from sqlalchemy import Column, Integer, String, Sequence, ForeignKey from sqlalchemy.orm import relationship from tuneful import app from .database import Base, engine, session class Song(Base): __tablename__ = 'songs' id = Column(Integer, primary_key=True) file_i...
normal
{ "blob_id": "d5c2b73c202c9944cd64798ef5ddc08ce68a4a9a", "index": 3446, "step-1": "<mask token>\n\n\nclass Song(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass File(Base):\n __tablename__ = 'files'\n id = Column(Integer, primary_key=True)\n filename = Column(Stri...
[ 4, 5, 6, 7, 8 ]
##### # Created on Oct 15 13:13:11 2019 # # @author: inesverissimo # # Do pRF fit on median run, make iterative fit and save outputs #### import os # issue with tensorflow, try this suggestion #NUM_PARALLEL_EXEC_UNITS = 16 #os.environ['OMP_NUM_THREADS'] = str(NUM_PARALLEL_EXEC_UNITS) #os.environ["KMP_AFFINI...
normal
{ "blob_id": "d9156e240d49e0a6570a5bc2315f95a7a670fd4f", "index": 6327, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) < 2:\n raise NameError(\n 'Please add subject number (ex:1) as 1st argument in the command line!'\n )\nelif len(sys.argv) < 3:\n raise NameError(\n ...
[ 0, 1, 2, 3, 4 ]
import cv2 cam = cv2.VideoCapture("./bebop.sdp") while True: ret, frame = cam.read() cv2.imshow("frame", frame) cv2.waitKey(1)
normal
{ "blob_id": "d13b402b90bb948e5722f45096a8c0a33e4cac67", "index": 6968, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, frame = cam.read()\n cv2.imshow('frame', frame)\n cv2.waitKey(1)\n", "step-3": "<mask token>\ncam = cv2.VideoCapture('./bebop.sdp')\nwhile True:\n ret, fr...
[ 0, 1, 2, 3, 4 ]
<|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": "8dff22249abbae9e30ba1ad423457270e0cd9b20", "index": 7027, "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 = [('backend', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def ping_calculate_pong(expression, operator_index): """The function takes two arguments. Argument 1: an expression from which we will extract one subexpression. Argument 2: the index of the mathematical operator around which function takes the subexpression to extract. Th...
flexible
{ "blob_id": "c336bb6cdadfb836ab68ebd5bbb210f63af3d084", "index": 2287, "step-1": "<mask token>\n\n\ndef ping_calculate_pong(expression, operator_index):\n \"\"\"The function takes two arguments.\n Argument 1: an expression from which we will extract one subexpression.\n Argument 2: the index of the math...
[ 2, 3, 4, 5, 6 ]
import numpy as np from numpy import random from sklearn.preprocessing import StandardScaler from sklearn.cross_validation import train_test_split from numpy.random import shuffle import matplotlib.pyplot as plt import numpy.linalg as la import sklearn.preprocessing as proc import csv def get_accuracy(a, b, X_test, y_...
normal
{ "blob_id": "f5c4057babc873099ae2a4d8c1aca960ab9fa30a", "index": 9692, "step-1": "<mask token>\n\n\ndef get_accuracy(a, b, X_test, y_test):\n size = len(y_test)\n count = 0\n for i in range(size):\n x = X_test[i]\n real = y_test[i]\n x = np.array(x)\n x = x.reshape(1, 6)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_first_timestamp(log_file): with open(log_file) as f: for line in f: line_json = json.loads(line) return line_json['timestamp'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> send_socket.connect(connec...
flexible
{ "blob_id": "49679782ac696b3dc4f5038565f88304a44098e1", "index": 6188, "step-1": "<mask token>\n\n\ndef get_first_timestamp(log_file):\n with open(log_file) as f:\n for line in f:\n line_json = json.loads(line)\n return line_json['timestamp']\n\n\n<mask token>\n", "step-2": "<ma...
[ 1, 2, 3, 4, 5 ]
Desafios: 1: Crie um script python que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas de acordo com o valor digitado. Script: Desafio 01: 1: Crie um script python que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas de acordo com o valor digitado.""" nome=input('Qual é o seu nome?') print...
normal
{ "blob_id": "80454a3935f0d42b5535440fc316af1b5598d8a1", "index": 7090, "step-1": "Desafios:\n1: Crie um script python que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas de acordo com o valor digitado.\n\nScript:\nDesafio 01:\n1: Crie um script python que leia o nome de uma pessoa\ne mostre uma me...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if DEBUG: p = process('binary_100') else: p = remote('bamboofox.cs.nctu.edu.tw', 22001) <|reserved_special_token_0|> p.send(payload) p.interactive() p.close() <|reserved_special_token_1|> <|reserved_special_token_0|> DE...
flexible
{ "blob_id": "fab75c5b55d85cef245fa6d7e04f4bf3a35e492c", "index": 7068, "step-1": "<mask token>\n", "step-2": "<mask token>\nif DEBUG:\n p = process('binary_100')\nelse:\n p = remote('bamboofox.cs.nctu.edu.tw', 22001)\n<mask token>\np.send(payload)\np.interactive()\np.close()\n", "step-3": "<mask token>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestFrame: <|reserved_special_token_0|> def teardown(self): self.driver.quit() def test_frame(self): self.driver.switch_to.frame('iframeResult') action = ActionChains(self.driver) drag = self.driver.find_element_by_id('draggable') ...
flexible
{ "blob_id": "74843dea00a88513c3a9237eb024e1e14e8b1ff8", "index": 3088, "step-1": "<mask token>\n\n\nclass TestFrame:\n <mask token>\n\n def teardown(self):\n self.driver.quit()\n\n def test_frame(self):\n self.driver.switch_to.frame('iframeResult')\n action = ActionChains(self.drive...
[ 3, 4, 5, 6, 7 ]
from .models import RecommendedArtifact from .serializers import RecommendedArtifactSerialize from rest_framework.decorators import api_view from rest_framework.response import Response from datetime import datetime import requests, bs4 # constant value service_key = "{jo's museum key}" @api_view(['GET']) def artifa...
normal
{ "blob_id": "707e3e60d6d9a3db5b9bc733e912b34e2cec5974", "index": 8585, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET'])\ndef artifact_save_recommend(request, pageNo):\n artifact_url = (\n f'http://www.emuseum.go.kr/openapi/relic/list?serviceKey={service_key}&numOfRows=100&p...
[ 0, 2, 3, 4, 5 ]
import tensorflow as tf from util.helper import focal_loss from util.helper import conv_elu_bn from util.helper import deconv_elu_bn from util.helper import residual_block_elu from util.helper import conv_elu from util.helper import conv from util.helper import reg_l1_loss from util.helper import conv_bn from util.hel...
normal
{ "blob_id": "e24a62f2a3ff0122922f472a7b37f1773dfe9c11", "index": 7605, "step-1": "<mask token>\n\n\nclass model_objectdetection_ppm_centernet_v1:\n <mask token>\n\n def _build_net(self):\n self.learning_rate_tensor = tf.compat.v1.placeholder(tf.float32,\n shape=[], name='learning_rate')\n...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class TestMaxInteger(unittest.TestCase): <|reserved_special_token_0|> def test_max(self): """Tests max_integer""" self.assertEqual(max_integer([1, 2, 3]), 3) self.assertEqual(max_integer([6, 2, 6]), 6) self.assertEqual(max_integer([0, 0, 0]), 0) ...
flexible
{ "blob_id": "f799fdfde537bbe8f6c49a5e1a15cf6f910a0d45", "index": 889, "step-1": "<mask token>\n\n\nclass TestMaxInteger(unittest.TestCase):\n <mask token>\n\n def test_max(self):\n \"\"\"Tests max_integer\"\"\"\n self.assertEqual(max_integer([1, 2, 3]), 3)\n self.assertEqual(max_intege...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> class Vts: def __init__(self): self.last_comment_id = 0 self.vk = None def update_vk(self): if self.vk is not None: return vk_session = vk_api.VkApi(VK_LOGIN, VK_PASSWORD) try: vk_session.authorization() exc...
flexible
{ "blob_id": "885e02cbf78412d77bd17eba64a8a1a52aaed0df", "index": 5837, "step-1": "<mask token>\n\n\nclass Vts:\n\n def __init__(self):\n self.last_comment_id = 0\n self.vk = None\n\n def update_vk(self):\n if self.vk is not None:\n return\n vk_session = vk_api.VkApi(V...
[ 7, 8, 9, 10, 11 ]
from django.shortcuts import render from django.http import HttpResponse # from appTwo.models import User from appTwo.forms import NewUserForm # Create your views here. # def index(request): # return HttpResponse("<em>My Second Project</em>") def welcome(request): # welcomedict={'welcome_insert':'Go to /user...
normal
{ "blob_id": "d5f66d92371838c703abbf80e2b78717cdd4a4fb", "index": 7140, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef welcome(request):\n return render(request, 'welcome.html')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef welcome(request):\n return render(request, 'welcome.html'...
[ 0, 1, 2, 3, 4 ]
from newspaper import Article import random import string from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity import nltk import numpy as np import warnings import speech_recognition as sr warnings.filterwarnings('ignore') nltk.download('pun...
normal
{ "blob_id": "53b56cf9265a658d999388f0a1e03d7ceb186213", "index": 2836, "step-1": "<mask token>\n\n\ndef LemNormalize(text):\n return nltk.word_tokenize(text.lower().translate(remove_punct_dict))\n\n\n<mask token>\n\n\ndef greeting(sentence):\n for word in sentence.split():\n if word.lower() in GREET...
[ 3, 4, 5, 6, 7 ]
__all__ = ''' calc_common_prefix_length '''.split() import operator import itertools def calc_common_prefix_length(lhs_iterable, rhs_iterable, /, *, __eq__=None): if __eq__ is None: __eq__ = operator.__eq__ idx = -1 for a, b, idx in zip(lhs_iterable, rhs_iterable, itertools.count(0)): ...
normal
{ "blob_id": "2b73c4e07bba7ed5c89a31ebd45655eaa85dcdcc", "index": 2689, "step-1": "<mask token>\n\n\ndef calc_common_prefix_length(lhs_iterable, rhs_iterable, /, *, __eq__=None):\n if __eq__ is None:\n __eq__ = operator.__eq__\n idx = -1\n for a, b, idx in zip(lhs_iterable, rhs_iterable, itertools...
[ 1, 2, 3, 4, 5 ]
from fastapi import APIRouter, Depends from fastapi.responses import RedirectResponse import app.setting as setting from app.dependencies import get_project_by_prefix from app.entities.project import Project router = APIRouter( prefix="/go", ) @router.get("/{prefix_id}") def redirect_to_board(project: Project ...
normal
{ "blob_id": "49b295c3e323695779eb32181193ef88b678b34d", "index": 6340, "step-1": "<mask token>\n\n\n@router.get('/{prefix_id}')\ndef redirect_to_board(project: Project=Depends(get_project_by_prefix)):\n return RedirectResponse(url=project.notion_board_url)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n...
[ 1, 2, 3, 4, 5 ]
''' vetor = ["pares de pregos ligados por uma linha"] indice do vetor representa os pregos na vertical, e o inteiro em cada pos, os pregos na horizontal. i(vertical) e j(horizontal) entao: vetor[i] = j pregos a(vertical) e pregos b(horizontal) se a>i and b<j or a<i and b>j a e i(são indices) b e j(são os elemnt...
normal
{ "blob_id": "fe081a422db6b7f10c89179beab852c6b74ec687", "index": 2795, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef merge(p, n):\n global vet\n global aux\n if n <= 1:\n return 0\n c = merge(p, n // 2) + merge(p + n // 2, n - n // 2)\n d, a, b = 0, 0, n // 2\n while d <...
[ 0, 1, 2, 3, 4 ]