code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|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": "b0064a5cd494d5ad232f27c63a4df2c56a4c6a66", "index": 5241, "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|> def main(): x = int(input('INGRESA VALOR PARA X: \n')) y = int(input('INGRESA VALOR PARA Y: \n')) x1 = int(input('INGRESA VALOR PARA X1: \n')) y1 = int(input('INGRESA VALOR PARA Y1: \n')) Bresenhams(x, y, x1,...
flexible
{ "blob_id": "e75bee4e014aa369131c3e200ce874a8840b5690", "index": 3573, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n x = int(input('INGRESA VALOR PARA X: \\n'))\n y = int(input('INGRESA VALOR PARA Y: \\n'))\n x1 = int(input('INGRESA VALOR PARA X1: \\n'))\n y1 = int(input('I...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- import unittest from selenium import webdriver from appium import webdriver from time import sleep import os from PublicResour import Desired_Capabilities """ 登录状态下检查“我的”界面的所有的功能模块 大部分执行用例时在“我的”界面 """ #Return ads path relative to this file not cwd PATH = lambda p: ...
normal
{ "blob_id": "883a50cf380b08c479c30edad3a2b61a6f3075cc", "index": 4030, "step-1": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\nimport unittest\nfrom selenium import webdriver\nfrom appium import webdriver\nfrom time import sleep\nimport os\nfrom PublicResour import Desired_Capabilities\n\n\"\"\"\n 登录状态下检查“我...
[ 0 ]
<|reserved_special_token_0|> class IntCodeComputer: def __init__(self, code): self.defaultCode = code self.runningCode = self.defaultCode.copy() self.instructionPointer = 0 self.outputQueue = queue.Queue() self.relativeBase = 0 def AccessLocation(self, index): ...
flexible
{ "blob_id": "6eac04bc10ef712ab4e2cde4730950ddcbe42585", "index": 8983, "step-1": "<mask token>\n\n\nclass IntCodeComputer:\n\n def __init__(self, code):\n self.defaultCode = code\n self.runningCode = self.defaultCode.copy()\n self.instructionPointer = 0\n self.outputQueue = queue.Q...
[ 5, 8, 9, 10, 12 ]
<|reserved_special_token_0|> class Comment(objstore.Item): <|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|> def __init__(self, *a, ...
flexible
{ "blob_id": "e398908ba74306c5a746d7643b38f08651cf92ec", "index": 4205, "step-1": "<mask token>\n\n\nclass Comment(objstore.Item):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, *a, **k):\n relatesTo = ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python import sys f = open('/etc/passwd','r') users_and_ids = [] for line in f: u,_,id,_ = line.split(':',3) users_and_ids.append((u,int(id))) users_and_ids.sort(key = lambda pair:pair[1]) for id,usr in users_and_ids: print id,usr
normal
{ "blob_id": "52426ec670dd5ca522c7fb0b659e3a42b16ff326", "index": 8851, "step-1": "#!/usr/bin/python\nimport sys\nf = open('/etc/passwd','r')\nusers_and_ids = []\nfor line in f:\n u,_,id,_ = line.split(':',3)\n users_and_ids.append((u,int(id)))\nusers_and_ids.sort(key = lambda pair:pair[1])\nfor id,usr in users...
[ 0 ]
# Name: CreateDatabase.py # Description: Connects to a point in time in the geodatabase in # PostgreSQL using database authentication. # Import system modules import arcpy import os arcpy.env.workspace="Database Connections" if arcpy.Exists ("Prueba6.sde")==False: arcpy.CreateDatabaseConnection_m...
normal
{ "blob_id": "6e98dfd758700c57ddbb17624472ce2c23cbee6a", "index": 2036, "step-1": "# Name: CreateDatabase.py\n# Description: Connects to a point in time in the geodatabase in\n# PostgreSQL using database authentication.\n\n# Import system modules\nimport arcpy\nimport os\n\n\n\n\narcpy.env.workspace=...
[ 0 ]
# Copyright 2019-2020 the ProGraML authors. # # Contact Chris Cummins <chrisc.101@gmail.com>. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
normal
{ "blob_id": "09788cf04ab5190a33b43e3756f4dbd7d78977a5", "index": 581, "step-1": "<mask token>\n\n\nclass GraphTupleData(Base, sqlutil.PluralTablenameFromCamelCapsClassNameMixin):\n <mask token>\n id: int = sql.Column(sql.Integer, sql.ForeignKey('graph_tuples.id',\n onupdate='CASCADE', ondelete='CASC...
[ 40, 44, 48, 54, 63 ]
#!/usr/bin/env python3 """Shannon entropy and P affinities""" import numpy as np def HP(Di, beta): """ Function that calculates shannon entropy """ P = np.exp(-Di * beta) sumP = np.sum(P) Pi = P / sumP Hi = -np.sum(Pi * np.log2(Pi)) return (Hi, Pi)
normal
{ "blob_id": "0b05b027e3c3147aa2b9c35a0bdc33633ba6e658", "index": 7129, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef HP(Di, beta):\n \"\"\"\n Function that calculates shannon entropy\n \"\"\"\n P = np.exp(-Di * beta)\n sumP = np.sum(P)\n Pi = P / sumP\n Hi = -np.sum(Pi * np....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CampaignNegativeKeywords(Client): <|reserved_special_token_0|> @sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='DELETE') def delete_campaign_negative_keyword(self, keywordId, **kwargs ) ->ApiResponse: """ delete_campaign_negative_keywo...
flexible
{ "blob_id": "f6e0215f9992ceab51887aab6a19f58a5d013eb4", "index": 7829, "step-1": "<mask token>\n\n\nclass CampaignNegativeKeywords(Client):\n <mask token>\n\n @sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='DELETE')\n def delete_campaign_negative_keyword(self, keywordId, **kwargs\n ) -...
[ 5, 6, 8, 9, 10 ]
import sys import os sys.path.append(os.pardir) from ch03.softmax import softmax from ch04.cross_entropy_error_batch import cross_entropy_error import numpy as np class SoftmaxWithLossLayer: """ x -> [Softmax] -> y -> [CrossEntropyError with t] -> out In the textbook, this class has `loss` field. """...
normal
{ "blob_id": "8ae64c65d6d5dc9f2a99aeceff31657deff06c15", "index": 5236, "step-1": "<mask token>\n\n\nclass SoftmaxWithLossLayer:\n <mask token>\n\n def __init__(self):\n self.y = None\n self.t = None\n\n def forward(self, x, t):\n \"\"\"\n x: input to softmax\n t: teach...
[ 4, 5, 6, 7, 8 ]
# Imports import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils import data from torch.utils.data import DataLoader import torchvision.datasets as datasets import torchvision.transforms as transforms # Create Fully Connected Network class NN(nn.Module): def...
normal
{ "blob_id": "1edb92a4905048f3961e3067c67ef892d7b8a034", "index": 9154, "step-1": "<mask token>\n\n\nclass NN(nn.Module):\n\n def __init__(self, input_size, num_classes):\n super(NN, self).__init__()\n self.fc1 = nn.Linear(input_size, 50)\n self.fc2 = nn.Linear(50, num_classes)\n\n def ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(Profile) admin.site.register(Address) <|reserved_special_token_1|> from django.contrib import admin from .models import Profile, Address admin.site.register(Profile) admin.site.register(Address)
flexible
{ "blob_id": "4cc6a9c48e174b33ed93d7bda159fcc3a7b59d4c", "index": 6727, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Profile)\nadmin.site.register(Address)\n", "step-3": "from django.contrib import admin\nfrom .models import Profile, Address\nadmin.site.register(Profile)\nadmin.sit...
[ 0, 1, 2 ]
<|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": "e7bb5e9a91ec6a1644ddecd52a676c8136087941", "index": 4719, "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 = [('printer', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __author__ = 'zhouhenglc' TIME_FORMAT = '%Y-%m-%d %H:%M:%S' ENCODING = 'utf-8' G_MULTI_MODE = [6] STATUS_ONLINE = 64 STATUS_OFFLINE = 128 TOKEN_BAD_FORMAT = 'token_bad_format' TOKEN_EXPIRED = 'token_expired' TOKEN_NOT_STORAGE = 'token_not_storage' TOKEN_REQUI...
flexible
{ "blob_id": "4605a3f88c73b43fa7611a10a400ad2d4d7c6dfc", "index": 2273, "step-1": "<mask token>\n", "step-2": "__author__ = 'zhouhenglc'\nTIME_FORMAT = '%Y-%m-%d %H:%M:%S'\nENCODING = 'utf-8'\nG_MULTI_MODE = [6]\nSTATUS_ONLINE = 64\nSTATUS_OFFLINE = 128\nTOKEN_BAD_FORMAT = 'token_bad_format'\nTOKEN_EXPIRED = 't...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ServiceProviderForm(forms.ModelForm): <|reserved_special_token_0|> class Meta: model = models.ServiceProvider fields = 'xml', <|reserved_special_token_1|> <|reserved_special_token_0|> class S...
flexible
{ "blob_id": "e018d28cbacb568596eb9a5134581db960111e14", "index": 9835, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ServiceProviderForm(forms.ModelForm):\n <mask token>\n\n\n class Meta:\n model = models.ServiceProvider\n fields = 'xml',\n", "step-3": "<mask token>\n\n\n...
[ 0, 1, 2, 3, 4 ]
x = int(input('masukkan')) y = int(input('masukkan')) def jumlah(x, y): hasil = x + y return hasil print('hasil dari', x, '+', y, '=', jumlah(x, y)) k = jumlah(2, 4) + 1 print(k)
normal
{ "blob_id": "d8482da6b9983d990da980c3a5edab0c49a28229", "index": 2219, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef jumlah(x, y):\n hasil = x + y\n return hasil\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef jumlah(x, y):\n hasil = x + y\n return hasil\n\n\nprint('hasil da...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Sharem8Config(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Sharem8Config(AppConfig): name = 'ShareM8' <|reserved_special_token_1|> from django.app...
flexible
{ "blob_id": "fd4d785d933c3a200f4aba094ecfe1e1c76737a5", "index": 7629, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Sharem8Config(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Sharem8Config(AppConfig):\n name = 'ShareM8'\n", "step-4": "from django.apps import App...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(rootPath) <|reserved_special_token_0|> manager.add_command('db', MigrateCommand) if __name__ == '__main__': manager.run() <|reserved_special_token_1|> <|reserved_special_token_0|> curPath = os.path.abspath(o...
flexible
{ "blob_id": "69ebdab4cd1f0b5154305410381db252205ff97d", "index": 9768, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append(rootPath)\n<mask token>\nmanager.add_command('db', MigrateCommand)\nif __name__ == '__main__':\n manager.run()\n", "step-3": "<mask token>\ncurPath = os.path.abspath(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for tr in infoBox.find_all('tr'): if len(tr.findChildren('th', recursive=False)) > 0 and len(tr. findChildren('td', recursive=False)) > 0: header = tr.findChildren('th', recursive=False)[0] data = tr.fi...
flexible
{ "blob_id": "f45ca4e75de7df542fbc65253bb9cc44a868522a", "index": 6398, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor tr in infoBox.find_all('tr'):\n if len(tr.findChildren('th', recursive=False)) > 0 and len(tr.\n findChildren('td', recursive=False)) > 0:\n header = tr.findChildren(...
[ 0, 1, 2, 3, 4 ]
#! python3 import os import shutil import re import argparse def create_test_file(filename): with open(filename, "w") as f: f.write("foobar") def create_test_files(test_dir, file_prefix): if os.path.exists(test_dir): shutil.rmtree(test_dir) os.mkdir(test_dir) for i in range(1, 10): ...
normal
{ "blob_id": "db684185c2b0a26cb101dc40090c84b64c554eeb", "index": 2595, "step-1": "<mask token>\n\n\ndef create_test_file(filename):\n with open(filename, 'w') as f:\n f.write('foobar')\n\n\n<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(description='Filling In The Gaps program')\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def registerModelStorage(dict): global sharedDict sharedDict = dict def updateModel(): lastLevels, validTime = download(NOWCAST_DATA_URL) sharedDict['lastLevels'] = lastLevels sharedDict['validTime'] = validTime <|reserved_special_token_0|> def getTimestamp(datet...
flexible
{ "blob_id": "e8f090a02bfd5ee8a6832351357594af2d6692f9", "index": 8702, "step-1": "<mask token>\n\n\ndef registerModelStorage(dict):\n global sharedDict\n sharedDict = dict\n\n\ndef updateModel():\n lastLevels, validTime = download(NOWCAST_DATA_URL)\n sharedDict['lastLevels'] = lastLevels\n sharedD...
[ 3, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @raise_on_failure @pytest.mark.parametrize('channels_per_node', [CHAIN]) @pytest.mark.parametrize('number_of_nodes', [3]) def test_leave_token_network(raiden_network: List[RaidenService], token_addresses): registry_addre...
flexible
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): text = 'This is some text -- with punctuation.' print(text) print() patterns = ['^(?P<first_word>\\w+)', '(?P<last_word>\\w+)\\S*$', '(?P<t_word>\\bt\\w+)\\W+(?P<other_word>\\w+)', '(?...
flexible
{ "blob_id": "be6a2e45f735fe578392b03c3030890b6cd5b4bc", "index": 2865, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n text = 'This is some text -- with punctuation.'\n print(text)\n print()\n patterns = ['^(?P<first_word>\\\\w+)', '(?P<last_word>\\\\w+)\\\\S*$',\n '(?...
[ 0, 1, 2, 3, 4 ]
from django.conf.urls import patterns, include, url from views.index import Index from views.configuracoes import Configuracoes from views.parametros import * urlpatterns = patterns('', url(r'^$', Index.as_view(), name='core_index'), url(r'^configuracoes/', Configuracoes.as_view(), name='core.core_c...
normal
{ "blob_id": "74c60c9e37e4e13ed4c61f631c3426b685b5d38f", "index": 8875, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^$', Index.as_view(), name='core_index'),\n url('^configuracoes/', Configuracoes.as_view(), name=\n 'core.core_configurations'), url('^parametros/dat...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def path_to_string(s): res = '' for i in range(len(s) - 1): res += str(s[i][0]) res += ', ' res += str(s[i][1]) res += ' > ' res += str(s[i][0]) res += ', ' res += str(s[i][1])...
flexible
{ "blob_id": "a4d47b9a28ec66f6a0473498674ebc538d909519", "index": 5111, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef path_to_string(s):\n res = ''\n for i in range(len(s) - 1):\n res += str(s[i][0])\n res += ', '\n res += str(s[i][1])\n res += ' > '\n res += ...
[ 0, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # File: software/jetson/fastmot/utils/sot.py # By: Samuel Duclos # For: Myself # Description: This file returns detection results from an image. from cvlib.object_detection import draw_bbox class ObjectCenter(object): def __init__(self, args)...
normal
{ "blob_id": "8f14bbab8b2a4bc0758c6b48feb20f8b0e3e348b", "index": 5460, "step-1": "<mask token>\n\n\nclass ObjectCenter(object):\n\n def __init__(self, args):\n \"\"\"Initialize variables.\"\"\"\n self.args = args\n\n def load_classes(self, path):\n with open(path, 'r') as names_file:\n...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> def run_query(query, args=None): conn = get_connection() cur = conn.cursor() cur.execute(query, args) rs = cur.fetchall() if len(rs) != 0: return rs conn.commit() cur.close() conn.close() def insert_address(address_obj): run_query( 'in...
flexible
{ "blob_id": "62bad8eeb3b51a5012dad761a60639d36429d8e8", "index": 7660, "step-1": "<mask token>\n\n\ndef run_query(query, args=None):\n conn = get_connection()\n cur = conn.cursor()\n cur.execute(query, args)\n rs = cur.fetchall()\n if len(rs) != 0:\n return rs\n conn.commit()\n cur.cl...
[ 25, 27, 37, 40, 41 ]
<|reserved_special_token_0|> def test_predict(): pass <|reserved_special_token_1|> <|reserved_special_token_0|> def test_init(): mm = ModelManager(config_file, model_dir) def test_predict(): pass <|reserved_special_token_1|> <|reserved_special_token_0|> dir_path = os.path.dirname(os.path.realpat...
flexible
{ "blob_id": "5da61b4cd8e4faf135b49396d3b346a219bf73f6", "index": 3851, "step-1": "<mask token>\n\n\ndef test_predict():\n pass\n", "step-2": "<mask token>\n\n\ndef test_init():\n mm = ModelManager(config_file, model_dir)\n\n\ndef test_predict():\n pass\n", "step-3": "<mask token>\ndir_path = os.path...
[ 1, 2, 3, 4 ]
from barista.sensor import CarafeLevel, CarafeTemp class Carafe(object): def __init__(self): self.level = CarafeLevel() self.temp = CarafeTemp() # TODO add callback for when the temperature or level are too low.
normal
{ "blob_id": "a0cce8d48f929dd63ba809a1e9bf02b172e8bc1b", "index": 2192, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Carafe(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Carafe(object):\n\n def __init__(self):\n self.level = CarafeLevel()\n self.temp = Ca...
[ 0, 1, 2, 3, 4 ]
# pylint: skip-file from sorter.lib.request_data import read_url from urllib2 import HTTPError class fake_urllib(object): def __init__(self, should_fail=False): self.should_fail = should_fail def urlopen(self, uri): if self.should_fail == True: raise HTTPError('FAKER.GTLD', 404, 'F...
normal
{ "blob_id": "2bbfbc597a4e1f8b46f58a4c6002a9943eff557a", "index": 5644, "step-1": "<mask token>\n\n\nclass fake_logger(object):\n\n def __init__(self):\n self.msg = None\n\n def info(self, msg, *args):\n pass\n\n def warn(self, msg, *args):\n self.msg = msg.reason\n\n\nclass TestRequ...
[ 7, 9, 10, 12, 14 ]
class Solution(object): def countSmaller(self, nums): """ :type nums: List[int] :rtype: List[int] naive -- o(n^2) """ <|reserved_special_token_0|> def mergesort(x): if len(x) == 0: return x, [] if len(x) == 1: return x, [0] mid = len(x) / 2 ...
flexible
{ "blob_id": "42021b762737a2eb21866ba029ece4ac120152cd", "index": 5902, "step-1": "class Solution(object):\n\n def countSmaller(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: List[int]\n naive -- o(n^2)\n \"\"\"\n\n\n<mask token>\n\n\ndef mergesort(x):\n if len(x)...
[ 6, 7, 8, 9, 10 ]
#Horror_Novel_Generator.py import markovify as mk import random as rng from fpdf import FPDF def makePDF(filename): #Get text, separating title and paragraphs #Assumes first line is title file= open(filename, "r") title= file.readline() pars= [] for line in file: pars.append...
normal
{ "blob_id": "58fb2676b599b5f7fb9041cfae113a9d428d8ef8", "index": 4503, "step-1": "<mask token>\n\n\ndef makePDF(filename):\n file = open(filename, 'r')\n title = file.readline()\n pars = []\n for line in file:\n pars.append(line)\n file.close()\n pdf = FPDF(unit='pt')\n pdf.add_page()...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class SubsPcLrThumb(Opcode): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SubsPcLrThumb(Opcode): def __init__(self, instruction, imm32, n): super().__init__(instruction) self.imm...
flexible
{ "blob_id": "89376b2464dfb724197a1c1e164af8277e03ad59", "index": 2507, "step-1": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SubsPcLrThumb(Opcode):\n\n def __init__(self, instruction, imm32, n):\n super().__init__(instruct...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Command(BaseCommand): <|reserved_special_token_0|> def handle(self, *args, **options): task_scheduler.start() <|reserved_special_token_1|> <|reserved_special_token_0|> class Command(BaseCommand): ...
flexible
{ "blob_id": "e9c81be79d9107433e00182c27488e64f1ca779f", "index": 1458, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Command(BaseCommand):\n <mask token>\n\n def handle(self, *args, **options):\n task_scheduler.start()\n", "step-3": "<mask token>\n\n\nclass Command(BaseCommand):...
[ 0, 2, 3, 4, 5 ]
# Copyright 2020 Google LLC. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, softw...
normal
{ "blob_id": "d66945add0726c85b8ac29056269ed55c6eb9369", "index": 3442, "step-1": "<mask token>\n\n\ndef _MinutesToMicroseconds(minutes):\n return minutes * 60 * 1000000\n\n\n<mask token>\n\n\nclass _PickMaxRecord(beam.DoFn):\n\n def process(self, data):\n _, streams = data\n time_dicts = []\n...
[ 4, 5, 6, 7, 8 ]
import logging def log_func(handler): if handler.get_status() < 400: log_method = logging.info elif handler.get_status() < 500: log_method = logging.warning else: log_method = logging.error request_time = 1000.0 * handler.request.request_time() log_method("%d %s %s (%s) %s ...
normal
{ "blob_id": "e403be68894ba283d71a0b71bb0bfd0adfab8c41", "index": 8684, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef log_func(handler):\n if handler.get_status() < 400:\n log_method = logging.info\n elif handler.get_status() < 500:\n log_method = logging.warning\n else:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class button: def __init__(self, colour, x, y, width, height, text=''): self.colour = colour self.x = x self.y = y self.width = width self.height = height self.text = text def draw(self, win, outline=None): if outline: ...
flexible
{ "blob_id": "2a8032c23e3c7aa3a7b0593c79db7adbc0353f93", "index": 2125, "step-1": "<mask token>\n\n\nclass button:\n\n def __init__(self, colour, x, y, width, height, text=''):\n self.colour = colour\n self.x = x\n self.y = y\n self.width = width\n self.height = height\n ...
[ 11, 12, 15, 22, 23 ]
class Type(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __str__(self): return self.jtype.toPrettyString(False, False) <|reserved_special_token_1|> class Type(object): <|reserved_special_token_0|> def __init__(self, jtype): ...
flexible
{ "blob_id": "851162e6c40a9f4f82a983a84fd0b4d6a6a57412", "index": 3675, "step-1": "class Type(object):\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.jtype.toPrettyString(False, False)\n", "step-2": "class Type(object):\n <mask token>\n\n def __init__(...
[ 2, 3, 4, 5 ]
#adapted from https://github.com/DeepLearningSandbox/DeepLearningSandbox/tree/master/transfer_learning import os import sys import glob import argparse import matplotlib.pyplot as plt from keras.applications.imagenet_utils import preprocess_input from keras.models import Model from keras.layers import GlobalAveragePo...
normal
{ "blob_id": "39b9106a3b0305db8cc7316be3b76e58e5577b92", "index": 4980, "step-1": "<mask token>\n\n\ndef setup_to_transfer_learn(model):\n \"\"\"Freeze all layers and compile the model\"\"\"\n for layer in model.layers:\n layer.trainable = False\n\n\ndef add_new_last_layer(base_model, nb_classes):\n ...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class AttentionGatedUnet3D(nn.Module): <|reserved_special_token_0|> def __init__(self, config): super(AttentionGatedUnet3D, self).__init__() assert hasattr(config, 'num_classes') assert hasattr(c...
flexible
{ "blob_id": "55a392d63838cbef027f9cf525999c41416e3575", "index": 3875, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AttentionGatedUnet3D(nn.Module):\n <mask token>\n\n def __init__(self, config):\n super(AttentionGatedUnet3D, self).__init__()\n assert hasattr(config, 'num_...
[ 0, 3, 4, 5, 6 ]
import sys sys.path.insert(0, ".")
normal
{ "blob_id": "b95eadd60093d5235dc0989205edff54ef611215", "index": 2399, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, '.')\n", "step-3": "import sys\nsys.path.insert(0, '.')\n", "step-4": "\nimport sys\n\nsys.path.insert(0, \".\")", "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2, 3 ]
from selenium import webdriver from selenium.webdriver.chrome.options import Options import sublime import sublime_plugin """ Copy and Paste selinium module and urllib3 module of Python in "sublime-text-3/Lib/Python3.3" folder of sublime-text3 """ def process(string): # Get active file name filename = subl...
normal
{ "blob_id": "9767014992981001bd2e8dece67525650c05a2a8", "index": 4018, "step-1": "<mask token>\n\n\nclass SolveItCommand(sublime_plugin.TextCommand):\n <mask token>\n\n def run(self, _):\n window = self.view.window()\n window.show_input_panel('Enter ContestID & ProblemID : ', '', self.\n ...
[ 4, 6, 7, 8, 9 ]
import csv with open('healthviolations.csv', 'w') as fp: with open('Restaurant_Inspections.csv', 'rb') as csvfile: reader = csv.reader(csvfile) header = next(reader, None) writer = csv.writer(fp, delimiter=',') writer.writerow([header[0], "violation"]) for row in reader: if (row[20] != '')...
normal
{ "blob_id": "1825b365032a224ed56a1814d7f6457e2add8fdd", "index": 8008, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('healthviolations.csv', 'w') as fp:\n with open('Restaurant_Inspections.csv', 'rb') as csvfile:\n reader = csv.reader(csvfile)\n header = next(reader, None)\n ...
[ 0, 1, 2, 3 ]
import socket import json import numpy as np """TCP client used to communicate with the Unity Application""" class TCP: def __init__(self, sock = None): # Create a TCP socket if sock is None: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) else: self.s...
normal
{ "blob_id": "cc66dcd34115e72479953ca24f4b2eaeb52cf313", "index": 7747, "step-1": "<mask token>\n\n\nclass TCP:\n <mask token>\n\n def connect(self, host, port):\n server_address = host, port\n print('connecting to {} port {}'.format(*server_address))\n self.sock.connect(server_address)...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class MyApp(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) star_list = ['1 Star and above', '2 Stars and above', '3 Stars and above', '4 stars and abov...
flexible
{ "blob_id": "f5e57c95e2c86aeb83872b29324b0b73a41caa47", "index": 9001, "step-1": "<mask token>\n\n\nclass MyApp(QtGui.QMainWindow, Ui_MainWindow):\n\n def __init__(self):\n QtGui.QMainWindow.__init__(self)\n Ui_MainWindow.__init__(self)\n self.setupUi(self)\n star_list = ['1 Star a...
[ 6, 7, 9, 11, 12 ]
number = int(input("entrez un entier:")) exposant = int(input("entrez un exposant:")) def puissance(x, n): if n == 0: return 1 else: return x * puissance(x, n-1) print(puissance(number, exposant))
normal
{ "blob_id": "beccae96b3b2c9dcd61bb538d07b85441a73662e", "index": 9968, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef puissance(x, n):\n if n == 0:\n return 1\n else:\n return x * puissance(x, n - 1)\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef puissance(x, n):\n ...
[ 0, 1, 2, 3, 4 ]
# ======= # Imports # ======= import os import sympy import numpy from distutils.spawn import find_executable import matplotlib import matplotlib.pyplot as plt from .Declarations import n,t # ============= # Plot Settings # ============= def PlotSettings(): """ General settings for the plot. """ # C...
normal
{ "blob_id": "81da2aab9ca11e63dafdd4eefc340d37b326fc6f", "index": 1846, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef PlotFunctions(phi_orthonormalized_list, StartFunctionIndex, Interval):\n PlotSettings()\n t_array = numpy.logspace(-7, numpy.log10(Interval[1]), 1000)\n NumFunctions = le...
[ 0, 1, 2, 3, 4 ]
from scrapy.selector import HtmlXPathSelector from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors.sgml import SgmlLinkExtractor from scrapy.item import Item, Field import scrapy import config from scrapy.linkextractors import LinkExtractor from scrapy.http import Request class BrokenItem(Item): ...
normal
{ "blob_id": "d827c59871d58e098009c22320af73f8f40169bb", "index": 5622, "step-1": "from scrapy.selector import HtmlXPathSelector\nfrom scrapy.spiders import CrawlSpider, Rule\nfrom scrapy.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.item import Item, Field\nimport scrapy\nimport config\nfrom scrapy.l...
[ 0 ]
#!/usr/bin/python import argparse import os import subprocess import batch vmc_dir = os.environ['VMCWORKDIR'] macro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/export_ems.C') exec_bin = os.path.join(vmc_dir,'build/bin/koa_execute') # arguments definitions parser = argparse.ArgumentParser() parser.add_argument("in...
normal
{ "blob_id": "58c7b405096a5fdc5eeacb5e5f314f2d1bb85af6", "index": 6229, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('infile', help='the file list to be processed')\nparser.add_argument('-d', '--directory', default='./', help=\n 'directory where files are located')\nparser.add_arg...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DatapackageModelForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.fields['status'].queryset = self.fields['status...
flexible
{ "blob_id": "5a59108084d943f6faa07ffea1467dc19c3dd790", "index": 1101, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DatapackageModelForm(forms.ModelForm):\n\n def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.helper = FormHelper(self)\n se...
[ 0, 2, 3, 5, 6 ]
from alive_progress import alive_bar from time import sleep with alive_bar(100) as bar: # default setting for i in range(100): sleep(0.03) bar() # call after consuming one item # using bubble bar and notes spinner with alive_bar(200, bar='bubbles', spinner=...
normal
{ "blob_id": "06f961c07695d1c312cb943afbfa64508a709c7e", "index": 1076, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith alive_bar(100) as bar:\n for i in range(100):\n sleep(0.03)\n bar()\n with alive_bar(200, bar='bubbles', spinner='notes2') as bar:\n for i in range...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class PotentialTests(BaseOutputTest): def __init__(self, model, param, disc, solution, operating_condition): super().__init__(model, param, disc, solution, operating_condition) self.phi_s_n = solution['Negative electrode potential [V]'] self.phi_s_p = solution...
flexible
{ "blob_id": "e81373c7b9c43b178f0f12382501be8899189660", "index": 6700, "step-1": "<mask token>\n\n\nclass PotentialTests(BaseOutputTest):\n\n def __init__(self, model, param, disc, solution, operating_condition):\n super().__init__(model, param, disc, solution, operating_condition)\n self.phi_s_...
[ 19, 32, 43, 44, 55 ]
from tree import Tree, createIntTree t = createIntTree() print('show', t.root.show()) print('sum', t.root.sum()) print('find 3', t.root.find(3) != False) print('evens', t.root.evens()) print('min depth', t.root.min_depth())
normal
{ "blob_id": "21a7fd5148f73ac47adafc9d5c2361ebe318ae59", "index": 2842, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('show', t.root.show())\nprint('sum', t.root.sum())\nprint('find 3', t.root.find(3) != False)\nprint('evens', t.root.evens())\nprint('min depth', t.root.min_depth())\n", "step-3": ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(os.getcwd()) print(os.listdir(path)) print(os.path.abspath(path)) print(os.path.basename(path)) print(os.path.isfile(path2)) print(os.path.isdir(path1)) <|reserved_special_token_1|> <|reserved_special_token_0|> path = 'D:...
flexible
{ "blob_id": "c01ea897cd64b3910531babe9fce8c61b750185d", "index": 7912, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(os.getcwd())\nprint(os.listdir(path))\nprint(os.path.abspath(path))\nprint(os.path.basename(path))\nprint(os.path.isfile(path2))\nprint(os.path.isdir(path1))\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
""" corner cases like: word[!?',;.] word[!?',;.]word[!?',;.]word so don't consider the punctuation will only exist after one word, and followed by a whitespace use re for regular expression match, replace or punctuations, and split words """ class Solution: def mostCommonWord(self, paragraph, banned): ...
normal
{ "blob_id": "3bb50b61c7a3e98ede0a31e574f39b4ea7f22de5", "index": 9197, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def mostCommonWord(self, paragraph, banned):\n \"\"\"\n :ty...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def create(k, v, t='0'): if k in name: print('ERROR:The data already exists') elif k.isalpha(): if v.isnumeric() and t.isnumeric(): v = int(v) t = int(t) if len(name) < 1024 * 1020 * 1024 and v <= 16 * 1024 * 1024: ...
flexible
{ "blob_id": "430dff54da986df4e3a68018d930735c757d49d0", "index": 6794, "step-1": "<mask token>\n\n\ndef create(k, v, t='0'):\n if k in name:\n print('ERROR:The data already exists')\n elif k.isalpha():\n if v.isnumeric() and t.isnumeric():\n v = int(v)\n t = int(t)\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(todayFormatted) <|reserved_special_token_0|> os.chdir(basepath) if not os.path.isfile(filename): print('File does not exist.') else: with open(filename) as f: content = f.read().splitlines() def parse(): ...
flexible
{ "blob_id": "07a546928df1acfedf7a7735dc813de9da8373e0", "index": 1275, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(todayFormatted)\n<mask token>\nos.chdir(basepath)\nif not os.path.isfile(filename):\n print('File does not exist.')\nelse:\n with open(filename) as f:\n content = f.rea...
[ 0, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- print ("—— 七、Python爬虫实战演练:爬取百度百科1000个页面的数据 ——"); print ("—— 7.2、调度程序 ——"); print ("————— Python爬虫:1、总教程程序 ———————————————"); from Reptilian.baike_spider import url_manager, html_downloader, html_parser, html_outputer class SpiderMain(object): # 构造函数初始化各个对象 def __init__(self): ...
normal
{ "blob_id": "e99a81a5600aad6111bb2694cbda02021ccfd71c", "index": 2817, "step-1": "<mask token>\n\n\nclass SpiderMain(object):\n <mask token>\n\n def craw(self, root_url):\n count = 1\n self.urls.add_new_url(root_url)\n while self.urls.has_new_url():\n try:\n n...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python import os # http://stackoverflow.com/questions/4500564/directory-listing-based-on-time def sorted_ls(path): mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime return list(sorted(os.listdir(path), key=mtime)) def main(): print "Content-type: text/html\n\n" print "<html><head><t...
normal
{ "blob_id": "f4715a1f59ceba85d95223ef59003410e35bfb7f", "index": 4037, "step-1": "#!/usr/bin/python\nimport os\n\n# http://stackoverflow.com/questions/4500564/directory-listing-based-on-time\ndef sorted_ls(path):\n mtime = lambda f: os.stat(os.path.join(path, f)).st_mtime\n return list(sorted(os.listdir(pa...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> parser.add_argument('--IK', default=False, action='store_true', help= 'switch to IK-control') <|reserved_special_token_0|> blue.calibrate_gripper() <|reserved_special_token_0|> while True: hands_data = listener.get_hand(co...
flexible
{ "blob_id": "b34e293b509328c728909262594bdf3d3ecf5360", "index": 4364, "step-1": "<mask token>\n", "step-2": "<mask token>\nparser.add_argument('--IK', default=False, action='store_true', help=\n 'switch to IK-control')\n<mask token>\nblue.calibrate_gripper()\n<mask token>\nwhile True:\n hands_data = lis...
[ 0, 1, 2, 3, 4 ]
import time import math from wpilib import SmartDashboard from wpilib.command import Command import robotmap import subsystems class TankDriveResetEncoders(Command): def __init__(self): super().__init__('TankDriveTurnToHeading') self.requires(subsystems.driveline) self.setInterruptible(...
normal
{ "blob_id": "f73faabe955e3ae05039e58ebabe5c012e080f38", "index": 9906, "step-1": "<mask token>\n\n\nclass TankDriveResetEncoders(Command):\n <mask token>\n\n def execute(self):\n subsystems.driveline.resetEncoders()\n print('CMD TankDriveResetEncoders: Reset Completed')\n <mask token>\n", ...
[ 2, 3, 4, 5, 6 ]
from pathlib import Path from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session # SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" SQLALCHEMY_DATABASE_URL = f"sqlite:///{Path(__name__).parent.absolute()}/sql_...
normal
{ "blob_id": "0656c3e1d8f84cfb33c4531e41efb4a349d08aac", "index": 6747, "step-1": "<mask token>\n", "step-2": "<mask token>\nBase.metadata.create_all(bind=engine)\n", "step-3": "<mask token>\nSQLALCHEMY_DATABASE_URL = (\n f'sqlite:///{Path(__name__).parent.absolute()}/sql_app.db')\nengine = create_engine(S...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def divide(self, dividend, divisor): """ :type dividend: int :type divisor: int :rtype: int ...
flexible
{ "blob_id": "4a0213351f8e9dcb2c6e71317a5ff1064974652e", "index": 3418, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def divide(self, dividend, divisor):\n \"\"\"\n :type dividend: int\n :type divisor: int...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import numpy dato=pd.read_csv('medallero_Panamericanos_Lima2019.csv') print(dato) def calculo_suma(): print("---Funcion con Python---") print("la sumatoria de los valores: ", dato['Bronce'].sum()) print("---Funcion con Numpy---") print("la sumatoria de los valores: ", numpy.sum(dat...
normal
{ "blob_id": "f5542cfe6827c352cc6e6da1147e727f2b2d8247", "index": 9586, "step-1": "<mask token>\n\n\ndef calculo_suma():\n print('---Funcion con Python---')\n print('la sumatoria de los valores: ', dato['Bronce'].sum())\n print('---Funcion con Numpy---')\n print('la sumatoria de los valores: ', numpy....
[ 9, 10, 11, 12, 13 ]
<|reserved_special_token_0|> class Critic: def __init__(self, obs_dim, action_dim, learning_rate=0.001): self.obs_dim = obs_dim self.action_dim = action_dim self.model = self.make_network() self.optimizer = keras.optimizers.Adam(learning_rate) def make_network(self): ...
flexible
{ "blob_id": "535fdee8f74b1984c5d1a5ec929310473b01239d", "index": 1617, "step-1": "<mask token>\n\n\nclass Critic:\n\n def __init__(self, obs_dim, action_dim, learning_rate=0.001):\n self.obs_dim = obs_dim\n self.action_dim = action_dim\n self.model = self.make_network()\n self.opti...
[ 7, 8, 9, 10, 11 ]
# SPDX-FileCopyrightText: 2013 The glucometerutils Authors # # SPDX-License-Identifier: Unlicense
normal
{ "blob_id": "39ffb85fb10882041c2c9a81d796e7ff9df7d930", "index": 8551, "step-1": "# SPDX-FileCopyrightText: 2013 The glucometerutils Authors\n#\n# SPDX-License-Identifier: Unlicense\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
# Generated by Django 3.0.3 on 2020-04-27 07:06 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('account', '0002_profile_favorites'), ] operations = [ migrations.RemoveField( model_name='profile', name='favorites', ...
normal
{ "blob_id": "1e83fedb8a5ed51704e991aeaa4bde20d5316d11", "index": 2351, "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 = [('account', '...
[ 0, 1, 2, 3, 4 ]
import os import time try: import cPickle as pickle except: import pickle #-------------# # Cache utils # #-------------# cachedir = os.path.expanduser('~/.cache/sherlock/') _cachedict = {} def get_cachefile(filename): """ Return full path to filename within cache dir. """ if not os.path.e...
normal
{ "blob_id": "05cfd9d239b63c9b1e0c93a09e89cceb8d8e99e4", "index": 2462, "step-1": "<mask token>\n\n\ndef get_cachefile(filename):\n \"\"\"\n Return full path to filename within cache dir.\n \"\"\"\n if not os.path.exists(cachedir):\n os.makedirs(cachedir)\n return os.path.join(cachedir, file...
[ 7, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print("yig'indisi ", a + b) print('ayirmasi ', a - b) print("bo'linmasi ", a / b) print("ko'paytmasi ", a * b) <|reserved_special_token_1|> <|reserved_special_token_0|> a = int(input('Birinchi sonni kiriting: ')) b = int(input(...
flexible
{ "blob_id": "0d32fe36f71ffb3df56738664c5dbd0b8ae585e3", "index": 3303, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\"yig'indisi \", a + b)\nprint('ayirmasi ', a - b)\nprint(\"bo'linmasi \", a / b)\nprint(\"ko'paytmasi \", a * b)\n", "step-3": "<mask token>\na = int(input('Birinchi sonni kiriti...
[ 0, 1, 2, 3 ]
'''4. Write a Python program to filter the positive numbers from a list.''' lst = [1, -3, 4, -56, 7, 3, -8, -5, 2, 4, 9] New_list = list(filter(lambda x: x > 0, lst)) print(New_list)
normal
{ "blob_id": "d61151859390ab1c907ac3753143312da434981e", "index": 2624, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(New_list)\n", "step-3": "<mask token>\nlst = [1, -3, 4, -56, 7, 3, -8, -5, 2, 4, 9]\nNew_list = list(filter(lambda x: x > 0, lst))\nprint(New_list)\n", "step-4": "'''4. Write a ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def analyser_commande(): """Analyseur de ligne de commande.""" parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3') parser.add_argument('idul', help='IDUL du joueur.') parser.add_argument('-l', ...
flexible
{ "blob_id": "f69544a9123f1738cd7d21c1b4fc02dd73fb9d1b", "index": 6008, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef analyser_commande():\n \"\"\"Analyseur de ligne de commande.\"\"\"\n parser = argparse.ArgumentParser(description='Jeu Quoridor - phase 3')\n parser.add_argument('idul', ...
[ 0, 1, 2, 3, 4 ]
from setuptools import setup, find_packages setup(name="sk_processor", packages=find_packages())
normal
{ "blob_id": "de884413dcbd0e89e8bfcf5657fe189156d9a661", "index": 1837, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='sk_processor', packages=find_packages())\n", "step-3": "from setuptools import setup, find_packages\nsetup(name='sk_processor', packages=find_packages())\n", "step-4": "fr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class SurroundByCommand(sublime_plugin.TextCommand): def run(self, edit, tag): for region in self.view.sel(): text = self.view.substr(region) self.view.replace(edit, region, '<' + tag + '>' + text + '</' + tag.split()[0] + '>') <|rese...
flexible
{ "blob_id": "bcc4276ea240247519cabbf5fc5646a9147ee3be", "index": 545, "step-1": "<mask token>\n\n\nclass SurroundByCommand(sublime_plugin.TextCommand):\n\n def run(self, edit, tag):\n for region in self.view.sel():\n text = self.view.substr(region)\n self.view.replace(edit, region...
[ 2, 3, 5, 6, 7 ]
<|reserved_special_token_0|> class SerializerTest(unittest.TestCase): class TestObject(object): def __init__(self, **kwargs): for name, value in kwargs.items(): self.__setattr__(name, value) <|reserved_special_token_0|> def test_serialize_string(self): """En...
flexible
{ "blob_id": "4e4d6a9ed07aa03c79dade05e01f226017b13de5", "index": 9250, "step-1": "<mask token>\n\n\nclass SerializerTest(unittest.TestCase):\n\n\n class TestObject(object):\n\n def __init__(self, **kwargs):\n for name, value in kwargs.items():\n self.__setattr__(name, value)\n...
[ 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def lookup(obj): """ function that returns attributes and methods of an object """ return dir(obj) <|reserved_special_token_1|> #!/usr/bin/python3 """ module that has fucntions that shows attributes """ def ...
flexible
{ "blob_id": "67380fb8b1557b0ed6779009e5f9ae93fd81aedd", "index": 8753, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lookup(obj):\n \"\"\"\n function that returns attributes and methods of an object\n \"\"\"\n return dir(obj)\n", "step-3": "#!/usr/bin/python3\n\"\"\"\nmodule that h...
[ 0, 1, 2 ]
import numpy as np import pandas as pd INPUT_FILE = 'data_full.csv' data = pd.read_csv(INPUT_FILE) data['date'] = pd.to_datetime(data['date'], format='%d-%m-%Y %H:%M:%S') # Wyodrębnienie użytkowników i stron na jakie wchodzili do postaci <USER> [<SITES>] data = data[['ip', 'address']] data['sites'] = data.groupby(['i...
normal
{ "blob_id": "3b61d389eda85ddb4c96f93c977a33b91da579ce", "index": 7900, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata.drop_duplicates(subset='ip', inplace=True, keep='first')\ndata.reset_index(drop=True, inplace=True)\n<mask token>\ncols.extend(sites)\n<mask token>\nattributes.set_index('userID', in...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def decToBinList(decNumber): if decNumber < 0 or decNumber > 255: raise ValueError return [((int(decNumber) & 1 << i) >> i) for i in range(7, -1, -1)] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def decToBinList(decNumber):...
flexible
{ "blob_id": "675d564ad60870f49b88dece480d5a50a30491df", "index": 4907, "step-1": "<mask token>\n\n\ndef decToBinList(decNumber):\n if decNumber < 0 or decNumber > 255:\n raise ValueError\n return [((int(decNumber) & 1 << i) >> i) for i in range(7, -1, -1)]\n\n\n<mask token>\n", "step-2": "<mask to...
[ 1, 2, 3, 4, 5 ]
class Balloon(object): def __init__(self, color, size, shape): self.color = color self.size = size self.shape = shape self.inflated = False self.working = True def inflate(self): if self.working: self.inflated = True else: print "Y...
normal
{ "blob_id": "2747b2563c83e11261a7113d69921c1affb20ac8", "index": 4675, "step-1": "class Balloon(object):\n def __init__(self, color, size, shape):\n self.color = color\n self.size = size\n self.shape = shape\n self.inflated = False\n self.working = True\n\n def inflate(se...
[ 0 ]
""" This module provides functions to make WCSAxes work in SunPy. """ import matplotlib.pyplot as plt from packaging.version import Version import astropy.units as u from astropy import __version__ as astropy_version from astropy.visualization import wcsaxes from sunpy.coordinates import HeliographicCarrington, Helio...
normal
{ "blob_id": "be1ef0aa3868985bf198781ee827bd447588df15", "index": 606, "step-1": "<mask token>\n\n\ndef is_wcsaxes(axes):\n \"\"\"\n Tests a `matplotlib.axes.Axes` object to see if it is an instance of\n `~astropy.visualization.wcsaxes.WCSAxes`.\n\n Parameters\n ----------\n axes : `matplotlib.a...
[ 4, 5, 6, 7, 8 ]
def main(): #entrada N = int(input()) num = 1 #processamento for i in range (N+1): if i > 0: #saida print("%d %d %d" %(i, i**2, i**3)) num +=1 if __name__ == '__main__': main()
normal
{ "blob_id": "b55984da73d3cfb3109a52990a0d4d05a27d51a5", "index": 1794, "step-1": "<mask token>\n", "step-2": "def main():\n N = int(input())\n num = 1\n for i in range(N + 1):\n if i > 0:\n print('%d %d %d' % (i, i ** 2, i ** 3))\n num += 1\n\n\n<mask token>\n", "step-3"...
[ 0, 1, 2, 3 ]
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import pandas as pd df = pd.read_csv('games_data.csv') names = df['game'] driver = webdriver.Chrome('D:/chromedriver.exe') driver.get('https://www.google.ca/imghp?hl=en&tab=ri&authuser=0&ogbl') k = 0 for name in names: box = ...
normal
{ "blob_id": "6375ac80b081b7eafbc5c3fc7e84c4eff2604848", "index": 4041, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.get('https://www.google.ca/imghp?hl=en&tab=ri&authuser=0&ogbl')\n<mask token>\nfor name in names:\n box = driver.find_element_by_xpath('//*[@id=\"sbtc\"]/div/div[2]/input')\n ...
[ 0, 1, 2, 3 ]
def calc(*numbers): sum = 0 for n in numbers: sum = sum + n * n return sum print(calc(*[1, 2, 3]))
normal
{ "blob_id": "a9ea3db019435733b5782d69450942373bb828e5", "index": 9304, "step-1": "<mask token>\n", "step-2": "def calc(*numbers):\n sum = 0\n for n in numbers:\n sum = sum + n * n\n return sum\n\n\n<mask token>\n", "step-3": "def calc(*numbers):\n sum = 0\n for n in numbers:\n su...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def mean_absolute_percentage_error(y_true, y_pred): y_true, y_pred = np.array(y_true), np.array(y_pred) return np.mean(np.abs((y_true - y_pred) / y_true)) * 100 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def mean_absolute_percenta...
flexible
{ "blob_id": "25dd7ea4a154e5693c65f8c42107224efee42516", "index": 4533, "step-1": "<mask token>\n\n\ndef mean_absolute_percentage_error(y_true, y_pred):\n y_true, y_pred = np.array(y_true), np.array(y_pred)\n return np.mean(np.abs((y_true - y_pred) / y_true)) * 100\n\n\n<mask token>\n", "step-2": "<mask t...
[ 1, 2, 3, 4, 5 ]
import io import os from flask import Flask from werkzeug.datastructures import FileStorage import pytest PNG_FILE = os.path.join(os.path.dirname(__file__), 'flask.png') JPG_FILE = os.path.join(os.path.dirname(__file__), 'flask.jpg') class TestConfig: TESTING = True MONGODB_DB = 'flask-fs-test' MONGODB...
normal
{ "blob_id": "dfc412acc9b69f50396680db1b9f6feafe162996", "index": 5571, "step-1": "<mask token>\n\n\nclass TestConfig:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TestFlask(Flask):\n\n def configure(self, *storages, **configs):\n import flask_file_system as fs\n ...
[ 6, 10, 11, 13, 16 ]
# -*- coding: utf-8 -*- import scrapy import re import time import random import hashlib from quotetutorial.items import ScrapyItem import requests import os import io import sys # 科学技术部 class MostSpider(scrapy.Spider): index = 12 name = 'most' allowed_domains = ['www.most.gov.cn'] start_urls = [ ...
normal
{ "blob_id": "3583ce664bc9f42ef8f751de8642997819e08e31", "index": 7793, "step-1": "<mask token>\n\n\nclass MostSpider(scrapy.Spider):\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\n def downloa...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def gauss(left, right, prec=3): arr = np.concatenate((np.array(left), np.array([right]).T), axis=1) print('\nИсходная матрица:') print(arr) if np.linalg.matrix_rank(left) != np.linalg.matrix_rank(arr): return 'Решений нет!' for j in range(len(arr)): lea...
flexible
{ "blob_id": "bd0530b6f3f7b1a5d72a5b11803d5bb82f85105d", "index": 6587, "step-1": "<mask token>\n\n\ndef gauss(left, right, prec=3):\n arr = np.concatenate((np.array(left), np.array([right]).T), axis=1)\n print('\\nИсходная матрица:')\n print(arr)\n if np.linalg.matrix_rank(left) != np.linalg.matrix_r...
[ 4, 6, 7, 9, 10 ]
<|reserved_special_token_0|> class BaseAI: _board: Board = None <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BaseAI: _board: Board = None <|reserved_special_token_0|> <|reserved_s...
flexible
{ "blob_id": "b794a4cca3303ac7440e9aad7bc210df62648b51", "index": 5476, "step-1": "<mask token>\n\n\nclass BaseAI:\n _board: Board = None\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass BaseAI:\n _board: Board = None\n <mask token>\n <mask token>\n\n d...
[ 1, 2, 3, 4, 5 ]
from unittest import TestCase, main as unittest_main, mock from app import app from bson.objectid import ObjectId ''' dummy data to use in testing create, update, and delete routes (U and D not yet made) Inspiration taken from Playlister tutorial. ''' sample_offer_id = ObjectId('5349b4ddd2781d08c09890f4') sample_offer...
normal
{ "blob_id": "cef6b5ef2082dc5910806550d9a9c96357752baf", "index": 3541, "step-1": "<mask token>\n\n\nclass HomelyTests(TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"Get Flask test client.\"\"\"\n self.client = app.test_client()\n app.config['TESTING'] = True\n\n def test_pro...
[ 7, 10, 11, 14, 15 ]
import math import backtrader as bt from datetime import datetime from bots.TelegramBot import TelegramBot import logging class Volume(bt.Strategy): params = (('avg_volume_period', 10), ('ticker', 'hpg'), ('ratio', 1.25)) def __init__(self): self.mysignal = (self.data.volume / bt.ind.Average(self.data...
normal
{ "blob_id": "acbe9a9501c6a8532249496f327c2470c1d2f8e0", "index": 898, "step-1": "<mask token>\n\n\nclass Volume(bt.Strategy):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Volume(bt.Strategy):\n <mask token>\n\n def __init__(self):\n self.mysignal = s...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(led_mode, 'wb') as f: f.write('out') with open(led_pin, 'wb') as f: f.write(__import__('sys').argv[1]) <|reserved_special_token_0|> <|reserved_special_token_1|> led_dir = '/sys/class/gpio/gpio40/' led_pin = le...
flexible
{ "blob_id": "1a9cad6e49e5ed2bb7781f9fec930d48ec048b3b", "index": 5061, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(led_mode, 'wb') as f:\n f.write('out')\nwith open(led_pin, 'wb') as f:\n f.write(__import__('sys').argv[1])\n<mask token>\n", "step-3": "led_dir = '/sys/class/gpio/gpio4...
[ 0, 1, 2, 3 ]
########################################################################### # This file provides maintenance on the various language files # 1. Create new "xx/cards_xx.json" files that have entries ordered as: # a. the card_tag entries in "cards_db.json" # b. the group_tag entries as found in "cards_db.json" # ...
normal
{ "blob_id": "cc1b3c3c65e8832316f72cbf48737b21ee4a7799", "index": 3887, "step-1": "<mask token>\n\n\ndef get_lang_dirs(path):\n languages = []\n for name in os.listdir(path):\n dir_path = os.path.join(path, name)\n if os.path.isdir(dir_path):\n cards_file = os.path.join(dir_path, 'c...
[ 5, 6, 7, 8, 9 ]
""" OBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm Quicksort first divides a large array into two smaller sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the sub-arrays. The steps are: 1. Pick an element, called a pivot, from the array. 2. Par...
normal
{ "blob_id": "04099c46c029af37a08b3861809da13b3cc3153b", "index": 997, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef quick_sort(array: list) ->list:\n return []\n", "step-3": "\"\"\"\nOBJECTIVE: Given a list, sort it from low to high using the QUICK SORT algorithm\n\nQuicksort first divides ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from .base import Credentials from .amazon_auth import AmazonCredentials from .google_auth import GoogleCredentials from .microsoft_auth import MicrosoftCredentials <|reserved_special_token_1|> ''' Handprint module for handling...
flexible
{ "blob_id": "7e29220752b4a52be34cdf0c734695d1052d0414", "index": 9309, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .base import Credentials\nfrom .amazon_auth import AmazonCredentials\nfrom .google_auth import GoogleCredentials\nfrom .microsoft_auth import MicrosoftCredentials\n", "step-3": "''...
[ 0, 1, 2 ]
# player input is: Word made, starting tile position of the word made, horizontal or vertical # example: playerinput = ['STRING', (0, 1), 'v'] import numpy as np import string def boundarytester(playerinput): # to check whether the player is placing the tiles within the confines of the board if playerinput[1][0]...
normal
{ "blob_id": "2cb0f2fbf3ceddb2f1ee65614506dbfb3b5c8089", "index": 4736, "step-1": "<mask token>\n\n\ndef boundarytester(playerinput):\n if playerinput[1][0] > 14 or playerinput[1][0] < 0 or playerinput[1][1\n ] > 14 or playerinput[1][1] < 0:\n return False\n if playerinput[2] == 'h':\n ...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def send(): global last_index_sent global last_sent DIR = './videos' videosToSend = len([name for name in os.listdir(DIR) if os.path.isfile( os.path.join(DIR, name))]) for i in range(last_index_sent, videosToSend + 1): last_index_sent = i last_s...
flexible
{ "blob_id": "a21ac29911931bb71460175cba584e0011fa2ece", "index": 1055, "step-1": "<mask token>\n\n\ndef send():\n global last_index_sent\n global last_sent\n DIR = './videos'\n videosToSend = len([name for name in os.listdir(DIR) if os.path.isfile(\n os.path.join(DIR, name))])\n for i in ra...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class IRegexItem(interfaces.IConditionItem): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class IRegexItem(interfaces.IConditionItem): <|reserved_special_token_0|> ...
flexible
{ "blob_id": "fe83b45bdc5970d63deab66b26b16752cd8ad8ef", "index": 7241, "step-1": "<mask token>\n\n\nclass IRegexItem(interfaces.IConditionItem):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IRegexItem(interfaces.IConditionItem):\n <mask token>\n regex = sch...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SENDMAIL(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SENDMAIL(object): def __init__(self): self.smtpserver = 'smtp.qq.com' self.u...
flexible
{ "blob_id": "bcab83e0ae6ee4925393b50bdefdfeb85c42ad2c", "index": 1914, "step-1": "<mask token>\n\n\nclass SENDMAIL(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass SENDMAIL(object):\n\n def __init__(self):\n self.smtpserver = 'smtp.qq.com'\n ...
[ 1, 3, 4, 5, 6 ]
import logging import os.path from day03.code.main import traverse_map, get_map_cell, traverse_map_multiple_slopes logger = logging.getLogger(__name__) local_path = os.path.abspath(os.path.dirname(__file__)) def test_get_map_cell(): map_template = """..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ....
normal
{ "blob_id": "7599f13d1cabe73d876ff97722962f2fcf9a9940", "index": 2269, "step-1": "<mask token>\n\n\ndef test_sample_input():\n map_template = \"\"\"..##.......\n#...#...#..\n.#....#..#.\n..#.#...#.#\n.#...##..#.\n..#.##.....\n.#.#.#....#\n.#........#\n#.##...#...\n#...##....#\n.#..#...#.#\"\"\"\n logger.in...
[ 5, 6, 7, 8, 9 ]
from django.db import models from django.utils import timezone # Create your models here. class URL(models.Model): label = models.CharField(null=True, blank=True, max_length=30) address = models.URLField() slug = models.SlugField(unique=True, max_length=8) created = models.DateTimeField(auto_now_add=T...
normal
{ "blob_id": "2dcb02ea2f36dd31eda13c1d666201f861c117e7", "index": 4027, "step-1": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass URL(models.Model):\n <mask token>\n <mask token>\n ...
[ 1, 2, 3, 4, 5 ]