code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from app import create_app, db import unittest import json class Test(unittest.TestCase): def setUp(self): """Before each test, set up a blank database""" self.app = create_app("configmodule.TestingConfig") self.app.testing = True self.client = self.app.test_client() with...
normal
{ "blob_id": "56b4262e88793be366d8ffe0fe4427fdb2a99bd7", "index": 7447, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n\n def setUp(self):\n \"\"\"Before each test, set up a blank database\"\"\"\n self.app = create_app('configmodule.TestingConfig')\n self.app.testing = True\n...
[ 4, 5, 6, 7, 8 ]
# Generated by Django 2.2.4 on 2019-08-19 19:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('application', '0003_auto_20190818_1623'), ] operations = [ migrations.AlterField( model_name='user', name='visited',...
normal
{ "blob_id": "913e1f5a0af436ef081ab567c44b4149299d0ec6", "index": 3154, "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 = [('application...
[ 0, 1, 2, 3, 4 ]
from typing import Tuple, Union from webdnn.graph.graph import Graph from webdnn.graph.operators.zero_padding_2d import ZeroPadding2D from webdnn.graph.operators.convolution2d import Convolution2D from webdnn.graph.operators.max_pooling_2d import MaxPooling2D from webdnn.graph.operators.average_pooling_2d import Avera...
normal
{ "blob_id": "687f7f4908e8a5448335f636edf74a627f03c306", "index": 9110, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ConcatZeroPadding(OptimizeRule):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ConcatZeroPadding(OptimizeRule):\n\n def optimize(self, graph: Graph) ->Tuple[Grap...
[ 0, 1, 2, 3, 4 ]
"""Sherlock Tests This package contains various submodules used to run tests. """ import sys import os import subprocess as sp from time import sleep # uncomment this if using nose sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../sherlock'))) # import sherlock
normal
{ "blob_id": "8f7b1313ba31d761edcadac7b0d04b62f7af8dff", "index": 4759, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),\n '../sherlock')))\n", "step-3": "<mask token>\nimport sys\nimport os\nimport subprocess as sp\nfrom time i...
[ 0, 1, 2, 3 ]
# We don't need no stinking models but django likes this file to be there if you are an app
normal
{ "blob_id": "a1304f290e0346e7aa2e22d9c2d3e7f735b1e8e7", "index": 96, "step-1": "\n# We don't need no stinking models but django likes this file to be there if you are an app\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 1 ] }
[ 1 ]
import json from django import template from django.core.serializers.json import DjangoJSONEncoder from django.utils.safestring import mark_safe register = template.Library() @register.filter def jsonify(object): return mark_safe(json.dumps(object, cls=DjangoJSONEncoder)) @register.simple_tag def get_crop_url(c...
normal
{ "blob_id": "987579da6b7ae208a66e375e0c9eca32b97199c5", "index": 4704, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@register.filter\ndef jsonify(object):\n return mark_safe(json.dumps(object, cls=DjangoJSONEncoder))\n\n\n@register.simple_tag\ndef get_crop_url(crop, width=None, scale=1):\n if...
[ 0, 3, 4, 5 ]
""" Constants to be used throughout this program stored here. """ ROOT_URL = "https://api.twitter.com" UPLOAD_URL = "https://upload.twitter.com" REQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token' AUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate' ACCESS_TOKEN_URL = f'{ROOT_URL}/oauth/access_token' VERSION = '1.1'...
normal
{ "blob_id": "c907f6b954aa3eae21a54eba9d54c116576bd40a", "index": 5848, "step-1": "<mask token>\n", "step-2": "<mask token>\nROOT_URL = 'https://api.twitter.com'\nUPLOAD_URL = 'https://upload.twitter.com'\nREQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token'\nAUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate'...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def gen_diffusion_flux_pyst_mpi_kernel_2d(real_t, mpi_construct, ghost_exchange_communicator): diffusion_flux_pyst_kernel = gen_diffusion_flux_pyst_kernel_2d(real_t= real_t, reset_ghost_zone=False) kernel_sup...
flexible
{ "blob_id": "ba8cb18544e4ded8b229bfb9cc4b28599119414f", "index": 854, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef gen_diffusion_flux_pyst_mpi_kernel_2d(real_t, mpi_construct,\n ghost_exchange_communicator):\n diffusion_flux_pyst_kernel = gen_diffusion_flux_pyst_kernel_2d(real_t=\n ...
[ 0, 1, 2, 3 ]
TheBeatles = ['John', 'Paul', 'George', 'Ringo'] Wings = ['Paul'] for Beatle in TheBeatles: if Beatle in Wings: continue print Beatle
normal
{ "blob_id": "9a54ff8e7e8d6d46860cb6173f03c52655b30f43", "index": 6449, "step-1": "TheBeatles = ['John', 'Paul', 'George', 'Ringo']\nWings = ['Paul']\n\nfor Beatle in TheBeatles:\n\t\tif Beatle in Wings:\n\t\t\t\tcontinue\n\t\tprint Beatle\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": nu...
[ 0 ]
# Write a Python program to print alphabet pattern 'G'. result = '' for row in range(0,7): for col in range(0,7): if ((col ==0) and (row !=0 and row !=6) or ((row ==0 or row == 6) and (col>0 and col<6))or ((row ==1 or row == 5 or row == 4)and (col ==6))or ((row ==3)and ((col!=2)and col!=1))): r...
normal
{ "blob_id": "e598091fc6c05b1d7f9f35f2ae58494fed53f9af", "index": 5392, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor row in range(0, 7):\n for col in range(0, 7):\n if col == 0 and (row != 0 and row != 6) or (row == 0 or row == 6) and (\n col > 0 and col < 6) or (row == 1 or row...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MysqlBaseModel(BaseModel): def __init__(self, db_name=None, table_name=None, table_alias=None, primary_key='id'): super(MysqlBaseModel, self).__init__(db_name, table_name, table_alias, primary_key) <|reserved_special_token_0|> def get_execut...
flexible
{ "blob_id": "a68de7555fdab06014fd562e7db29ca2da03f443", "index": 8240, "step-1": "<mask token>\n\n\nclass MysqlBaseModel(BaseModel):\n\n def __init__(self, db_name=None, table_name=None, table_alias=None,\n primary_key='id'):\n super(MysqlBaseModel, self).__init__(db_name, table_name,\n ...
[ 7, 12, 13, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii') headers = {'Authorization': 'Token {}'.format(sys.argv[1])} for x in targets['targetname']: obs = requests.get( ...
flexible
{ "blob_id": "705bc651e7d12769bcf5994168fe6685a6bae05d", "index": 5983, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n targets = at.Table.read('targets_LCO2018A_002.txt', format='ascii')\n headers = {'Authorization': 'Token {}'.format(sys.argv[1])}\n for x in targets[...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('/Users/danluu/dev/dump/terra/filtered_events.json', 'r') as f: parsed = json.load(f) print(json.dumps(parsed['4pLeague_S1_D1L1_G4']['events']['faction'], indent=2)) <|reserved_special_token_1|> <|reserved_special...
flexible
{ "blob_id": "886024a528112520948f1fb976aa7cb187a1da46", "index": 6767, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('/Users/danluu/dev/dump/terra/filtered_events.json', 'r') as f:\n parsed = json.load(f)\nprint(json.dumps(parsed['4pLeague_S1_D1L1_G4']['events']['faction'], indent=2))\n", ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def rot(*symbols): def _rot(n): encoded = ''.join(sy[n:] + sy[:n] for sy in symbols) lookup = str.maketrans(''.join(symbols), encoded) return lambda s: s.translate(lookup) return _rot <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "b7a60322b4a0fcb6de16cd12be33db265a2b8746", "index": 2735, "step-1": "<mask token>\n\n\ndef rot(*symbols):\n\n def _rot(n):\n encoded = ''.join(sy[n:] + sy[:n] for sy in symbols)\n lookup = str.maketrans(''.join(symbols), encoded)\n return lambda s: s.translate(lookup)\n re...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, 50) self.fc2 = nn.Linear(50, num_classes) def forward(self, x): x = F.relu(self.fc1(x)) x = self.fc2(x) r...
flexible
{ "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|> @pytest.fixture def cvrp_problem(): max_num_vehicles = 1 coords = [[-15.6570138544452, -47.802664728268745], [-15.65879313293694, -47.7496622016347], [-15.651440380492554, -47.75887552060412], [- 15.65120...
flexible
{ "blob_id": "f61e9e8069a0e90506c2f03a0cc4a25a16d71b85", "index": 3732, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture\ndef cvrp_problem():\n max_num_vehicles = 1\n coords = [[-15.6570138544452, -47.802664728268745], [-15.65879313293694,\n -47.7496622016347], [-15.65144038...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Location(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token...
flexible
{ "blob_id": "94e9e7c4c09c8c4de4c8f2649707a949d5f5f856", "index": 7836, "step-1": "<mask token>\n\n\nclass Location(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n...
[ 38, 40, 46, 50, 55 ]
# -*- coding: utf-8 -*- """ helpers ~~~~~~~ Implements various helper functions. :copyright: (c) 2016 by Patrick Spencer. :license: Apache 2.0, see LICENSE for more details. """ from datetime import datetime, timedelta import calendar def month_bounds(year, month): """ Returns a tuple of ...
normal
{ "blob_id": "4c5416582afb3cfeb56259954cda2701ea26f8cd", "index": 7780, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef month_bounds(year, month):\n \"\"\"\n Returns a tuple of datetime objects (month_start,month_end) given a year and month.\n Both params are strings because we want month ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class EventSerializer(ModelSerializer): class Meta: model = Event fields = '__all__' class HolidaySerializerRead(ModelSerializer): country = CountrySerializer() class Meta: model = Holiday fields = '__all__' class HolidaySerializerWrite(...
flexible
{ "blob_id": "5b366b0f6813f686600df9da4a17f190f034a10c", "index": 2046, "step-1": "<mask token>\n\n\nclass EventSerializer(ModelSerializer):\n\n\n class Meta:\n model = Event\n fields = '__all__'\n\n\nclass HolidaySerializerRead(ModelSerializer):\n country = CountrySerializer()\n\n\n class ...
[ 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('2 + 3 * 4 =') print(2 + 3 * 4) print('2 + (3 * 4) = ') print(2 + 3 * 4) <|reserved_special_token_1|> print("2 + 3 * 4 =") print(2 + 3 * 4) print("2 + (3 * 4) = ") print(2 + (3 * 4))
flexible
{ "blob_id": "58d137d614a0d5c11bf4325c1ade13f4f4f89f52", "index": 3184, "step-1": "<mask token>\n", "step-2": "print('2 + 3 * 4 =')\nprint(2 + 3 * 4)\nprint('2 + (3 * 4) = ')\nprint(2 + 3 * 4)\n", "step-3": "print(\"2 + 3 * 4 =\")\nprint(2 + 3 * 4)\n\nprint(\"2 + (3 * 4) = \")\nprint(2 + (3 * 4))\n", "step-...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_api_router(): api_router = APIRouter() api_router.include_router(submissions.router, prefix='/submissions', tags=['submissions']) return api_router <|reserved_special_token_1|> from fastapi import ...
flexible
{ "blob_id": "844c9af4f0d4ca33e7c69b72f9886f58ceebefdb", "index": 2719, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_api_router():\n api_router = APIRouter()\n api_router.include_router(submissions.router, prefix='/submissions',\n tags=['submissions'])\n return api_router\n",...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> __title__ = 'FUCKTHEINTRUDERS' __description__ = 'Checking for Intruders in my locality' __version__ = '0.0.1' __author__ = 'Shivam Jalotra' __email__ = 'shivam_11710495@nitkkr.ac.in' __license__ = 'MIT 1.0'
flexible
{ "blob_id": "ba94a69ac356969ab593afc922a2517f4713771f", "index": 5536, "step-1": "<mask token>\n", "step-2": "__title__ = 'FUCKTHEINTRUDERS'\n__description__ = 'Checking for Intruders in my locality'\n__version__ = '0.0.1'\n__author__ = 'Shivam Jalotra'\n__email__ = 'shivam_11710495@nitkkr.ac.in'\n__license__ ...
[ 0, 1 ]
## # hunt_and_kill.py # 05 Oct 2021 # Generates a maze using the hunt and kill algorithm # S from sys import argv from enum import Enum import random # Cardinal directions, can be OR'd and AND'd DIRS = { 'N': 1 << 0, 'E': 1 << 1, 'S': 1 << 2, 'W': 1 << 3 } O_DIRS = { 'N': 'S', ...
normal
{ "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 ]
class Player: def __init__(self, hp=100, atk=100): self.hp = hp self.atk = atk <|reserved_special_token_0|> <|reserved_special_token_0|> class Enemy: def __init__(self, hp=100, atk=99): self.hp = hp self.atk = atk def damage(self, value): print('敌人:啊') ...
flexible
{ "blob_id": "3065c87f79433e9fbbd2ff45c2915dfd5b1fa7cc", "index": 8427, "step-1": "class Player:\n\n def __init__(self, hp=100, atk=100):\n self.hp = hp\n self.atk = atk\n <mask token>\n <mask token>\n\n\nclass Enemy:\n\n def __init__(self, hp=100, atk=99):\n self.hp = hp\n ...
[ 6, 7, 8, 9, 11 ]
#coding=utf-8 ######################################### # dbscan: # 用法说明:读取文件 # 生成路径文件及簇文件,输出分类准确率 ######################################### from matplotlib.pyplot import * import matplotlib.pyplot as plt from collections import defaultdict import random from math import * import numpy import datetime ...
normal
{ "blob_id": "99c839eddcbe985c81e709878d03c59e3be3c909", "index": 293, "step-1": "#coding=utf-8\n######################################### \n# dbscan: \n# 用法说明:读取文件\n# 生成路径文件及簇文件,输出分类准确率 \n######################################### \n\n\nfrom matplotlib.pyplot import *\nimport matplotlib.pyplot as plt\nfr...
[ 0 ]
""" Simple python script to help learn basic socket API """ import sys, socket HOSTNAME = sys.argv[-2] PORT = sys.argv[-1] options = ( HOSTNAME, int(PORT) ) print options print 'creating socket...' sock = socket.socket() print 'socket created' print 'connecting...' sock.connect(options) print 'connected' print 's...
normal
{ "blob_id": "e41b5ee0dff30cca51593e737420889bce8f419f", "index": 8563, "step-1": "\"\"\"\nSimple python script to help learn basic socket API\n\"\"\"\n\nimport sys, socket\n\nHOSTNAME = sys.argv[-2]\nPORT = sys.argv[-1]\n\noptions = ( HOSTNAME, int(PORT) )\nprint options\n\nprint 'creating socket...'\nsock = soc...
[ 0 ]
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView from .serializers import ConcertSerializer from .models import Concert from .permissions import IsOwnerOrReadOnly class ConcertList(ListCreateAPIView): queryset = Concert.objects.all() serializer_class = ConcertSerializer cla...
normal
{ "blob_id": "74ad2ec2cd7cd683a773b0affde4ab0b150d74c5", "index": 4780, "step-1": "<mask token>\n\n\nclass ConcertDetail(RetrieveUpdateDestroyAPIView):\n permission_classes = IsOwnerOrReadOnly,\n queryset = Concert.objects.all()\n serializer_class = ConcertSerializer\n", "step-2": "<mask token>\n\n\ncl...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Plotter: def __init__(self): self.red_hex_code = '#ff0000' def AlkDMIonStatsSplitPlot(self, df): PV1_DataSets_lst = df[df['inst'] == 'PV1']['DataSet'].unique() PV2_DataSets_lst = df[df['inst'] == 'PV2']['DataSet'].unique() inst_sets = [PV1_D...
flexible
{ "blob_id": "81b920ab5417937dc0fc1c9675d393efc6a4d58d", "index": 5453, "step-1": "<mask token>\n\n\nclass Plotter:\n\n def __init__(self):\n self.red_hex_code = '#ff0000'\n\n def AlkDMIonStatsSplitPlot(self, df):\n PV1_DataSets_lst = df[df['inst'] == 'PV1']['DataSet'].unique()\n PV2_Da...
[ 5, 6, 8, 9, 10 ]
from django.db import models from home.models import MainUser from product.models import Product # Create your models here. class Cart(models.Model): user = models.ForeignKey(MainUser,on_delete=models.CASCADE) item = models.ForeignKey(Product, on_delete=models.CASCADE) quantity = models.PositiveIntegerFiel...
normal
{ "blob_id": "454d210c1b1a41e4a645ef7ccb24f80ee20a451c", "index": 2224, "step-1": "<mask token>\n\n\nclass Cart(models.Model):\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_total(self):\n total = self.item.price ...
[ 4, 5, 6, 7, 8 ]
# # PySNMP MIB module ADTRAN-ATLAS-HSSI-V35-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADTRAN-ATLAS-HSSI-V35-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:59:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
normal
{ "blob_id": "309807e04bfbf6c32b7105fe87d6ad1247ae411a", "index": 3192, "step-1": "<mask token>\n", "step-2": "<mask token>\nmibBuilder.exportSymbols('ADTRAN-ATLAS-HSSI-V35-MIB', adtran=adtran, adMgmt\n =adMgmt, adATLASHSSIV35IfceReact=adATLASHSSIV35IfceReact, adGenATLASmg=\n adGenATLASmg, adATLASmg=adATL...
[ 0, 1, 2, 3 ]
import sys from PySide6.QtCore import * from PySide6.QtWidgets import * from PySide6.QtGui import * from simple_drawing_window import * class simple_drawing_window1( simple_drawing_window): def __init__(self): super().__init__() def paintEvent(self, e): p = QPainter() p.begin(self) """ p.setPen(Q...
normal
{ "blob_id": "6fc43919f521234d0dc9e167bb72f014e9c0bf17", "index": 2102, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass simple_drawing_window1(simple_drawing_window):\n <mask token>\n\n def paintEvent(self, e):\n p = QPainter()\n p.begin(self)\n \"\"\"\n\t\tp.setPen(QCo...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getHashcode(string): for i in range(10000000000): hash_md5 = hashlib.md5(str(i).encode('utf-8')) res = hash_md5.hexdigest() if res[0:len(string)] == string: print(i) exit()...
flexible
{ "blob_id": "4c8e3c21dd478606cf09f2e97dc9deed6597dae5", "index": 4375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getHashcode(string):\n for i in range(10000000000):\n hash_md5 = hashlib.md5(str(i).encode('utf-8'))\n res = hash_md5.hexdigest()\n if res[0:len(string)] =...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if operacion == 'SUMA': resultado = numero1 + numero2 elif operacion == 'RESTA': resultado = numero1 - numero2 elif operacion == 'DIVISION': resultado = numero1 / numero2 elif operacion == 'MULTIPLICACION': resulta...
flexible
{ "blob_id": "5d618acc0962447554807cbb9d3546cd4e0b3572", "index": 3005, "step-1": "<mask token>\n", "step-2": "<mask token>\nif operacion == 'SUMA':\n resultado = numero1 + numero2\nelif operacion == 'RESTA':\n resultado = numero1 - numero2\nelif operacion == 'DIVISION':\n resultado = numero1 / numero2...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ScrapySpiderPipeline(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ScrapySpiderPipeline(object): def __init__(self): engine = db_connect() create_table(engine) ...
flexible
{ "blob_id": "16074fc1824a99b6fd1c4bf113d5b752308e8803", "index": 5198, "step-1": "<mask token>\n\n\nclass ScrapySpiderPipeline(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ScrapySpiderPipeline(object):\n\n def __init__(self):\n engine = db_connect()\n cre...
[ 1, 2, 3, 4, 5 ]
def strictly_greater_than(value): if value : # Change this line return "Greater than 100" elif value : # Change this line return "Greater than 10" else: return "10 or less" # Change the value 1 below to experiment with different values print(strictly_greater_than(1))
normal
{ "blob_id": "7620d76afc65ceb3b478f0b05339ace1f1531f7d", "index": 6708, "step-1": "<mask token>\n", "step-2": "def strictly_greater_than(value):\n if value:\n return 'Greater than 100'\n elif value:\n return 'Greater than 10'\n else:\n return '10 or less'\n\n\n<mask token>\n", "s...
[ 0, 1, 2, 3 ]
#!/usr/bin/python2 import requests ,optparse def get_link(): parser=optparse.OptionParser() parser.add_option("-l","--link",dest="url",help="direct link of file to download .pdf") (url,argument)=parser.parse_args() return url def download(url): try: get_request=requests.get(url) ...
normal
{ "blob_id": "22ddae977afd2a1b0a729cf0d56783eaaca3b0a0", "index": 9813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_link():\n parser = optparse.OptionParser()\n parser.add_option('-l', '--link', dest='url', help=\n 'direct link of file to download .pdf')\n url, argument = pa...
[ 0, 2, 3, 4, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for n in primos: quadrado = n ** 2 if quadrado in intervalo: is_magic.append(quadrado) print(len(is_magic)) <|reserved_special_token_1|> primos = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] intervalo = list(ran...
flexible
{ "blob_id": "b7f443521e165f327aae9ff5d7bbb7b8462abeb5", "index": 2890, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in primos:\n quadrado = n ** 2\n if quadrado in intervalo:\n is_magic.append(quadrado)\nprint(len(is_magic))\n", "step-3": "primos = [2, 3, 5, 7, 11, 13, 17, 19, 23, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def gen_ft_parser(): ft_parser = argparse.ArgumentParser(description= 'Generate a Character-Feature Translation Table') ft_parser.add_argument('alphabet_file', metavar='alphabet_file', type= str, help= 'A file contianing all the characters that will appear ...
flexible
{ "blob_id": "f4d4be174bed2704c0ad12eea2f0cd64eaaa0aaa", "index": 1973, "step-1": "<mask token>\n\n\ndef gen_ft_parser():\n ft_parser = argparse.ArgumentParser(description=\n 'Generate a Character-Feature Translation Table')\n ft_parser.add_argument('alphabet_file', metavar='alphabet_file', type=\n ...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> install_requires.append('tensorflow-gpu==1.13.1' if has_cuda else 'tensorflow==1.13.1') <|reserved_special_token_0|> setup(name='easybert', version=version, url= 'https://github.com/robrua/easy-bert', author='Rob Rua', aut...
flexible
{ "blob_id": "a1141e6aae6992a5037d53093378f0d346f2ca29", "index": 7666, "step-1": "<mask token>\n", "step-2": "<mask token>\ninstall_requires.append('tensorflow-gpu==1.13.1' if has_cuda else\n 'tensorflow==1.13.1')\n<mask token>\nsetup(name='easybert', version=version, url=\n 'https://github.com/robrua/ea...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(filelist) for infile in filelist: outfile = os.path.splitext(infile)[0] + '.jpg' if infile != outfile: try: Image.open(infile).save(outfile) except IOError: print('cannot conve...
flexible
{ "blob_id": "31416f1ba9f3c44a7aa740365e05b5db49e70444", "index": 9106, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(filelist)\nfor infile in filelist:\n outfile = os.path.splitext(infile)[0] + '.jpg'\n if infile != outfile:\n try:\n Image.open(infile).save(outfile)\n ...
[ 0, 1, 2, 3, 4 ]
class Solution: def evalRPN(self, tokens: List[str]) -> int: def operation(op1,op2,op): if op == "+": return op1 + op2 if op == "-": return op1 - op2 if op == "*": return op1 * op2 if op == "/": ...
normal
{ "blob_id": "6b597f1570c022d17e4476e2ab8817e724a166a7", "index": 1096, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def evalRPN(self, tokens: List[str]) ->int:\n\n def operation(op1, op2, op):\n if op == '+':\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(random.randint(1, 100)) <|reserved_special_token_1|> <|reserved_special_token_0|> import random print(random.randint(1, 100)) <|reserved_special_token_1|> """ CP1404 - Practical Code that produces a random number betwe...
flexible
{ "blob_id": "46696ee9576d74c087ae435bfd304c8346530ab2", "index": 9804, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(random.randint(1, 100))\n", "step-3": "<mask token>\nimport random\nprint(random.randint(1, 100))\n", "step-4": "\"\"\"\nCP1404 - Practical\nCode that produces a random number b...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Config(object): def __init__(self, name=None): """ Load config for colin. :param name: str (name of the config file (without .json), default is "default" """ self.name = name or 'default' config_path = os.path.join(get_config_dir...
flexible
{ "blob_id": "7bb9455e6f0c15ab0be6963cff06ff41df73e6e0", "index": 2583, "step-1": "<mask token>\n\n\nclass Config(object):\n\n def __init__(self, name=None):\n \"\"\"\n Load config for colin.\n\n :param name: str (name of the config file (without .json), default is \"default\"\n \"\...
[ 6, 7, 8, 9, 11 ]
import os import pandas as pd import numpy as np from dataloader import * from keras.optimizers import Adam, SGD from mylib.models.misc import set_gpu_usage set_gpu_usage() from mylib.models import densesharp, metrics, losses from keras.callbacks import ModelCheckpoint, CSVLogger, TensorBoard, EarlyStopping, ReduceL...
normal
{ "blob_id": "94b3fa700d7da0ca913adeb0ad5324d1fec0be50", "index": 7104, "step-1": "<mask token>\n\n\ndef main(batch_size, crop_size, learning_rate, segmentation_task_ratio,\n weight_decay, save_folder, epochs, alpha):\n print(learning_rate)\n print(alpha)\n print(weight_decay)\n train_dataset = Clf...
[ 1, 2, 3, 4, 5 ]
import unittest """ Find the largest 0 to 9 pandigital that can be formed by concatenating products Take the number 6 and multiply it by each of 1273 and 9854: 6 × 1273 = 7638 6 × 9854 = 59124 By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of ...
normal
{ "blob_id": "cb08b95e3b9c80fb74d4415b3798ddbb36cd76e7", "index": 419, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test(unittest.TestCase):\n\n def test(self):\n pass\n", "step-4": "import unittest...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestNurse(unittest.TestCase): <|reserved_special_token_0|> def setUp(self): self.n1 = n.Nurse('Tess', 18, '5436890982', 3200, 25) self.n2 = n.Nurse('Melissa', 40, '8920953924', 9000, 5) <|reserved_special_token_0|> def test_display(self): se...
flexible
{ "blob_id": "f24075ea70851ce95bb6b3cd87b6417f8141d546", "index": 9112, "step-1": "<mask token>\n\n\nclass TestNurse(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n self.n1 = n.Nurse('Tess', 18, '5436890982', 3200, 25)\n self.n2 = n.Nurse('Melissa', 40, '8920953924', 9000, 5)\n <m...
[ 7, 8, 9, 11, 13 ]
import sys import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from uraeus.nmbd.python import simulation from uraeus.nmbd.python.engine.numerics.math_funcs import A, B database_directory = os.path.abspath('../../') sys.path.append(database_directory) from uraeus_fsae.simenv.assemblies i...
normal
{ "blob_id": "e0541c377eb6631e4ef5eb79b1204612ce8af48c", "index": 6107, "step-1": "<mask token>\n\n\ndef generate_circular_path(radius, offset):\n theta = np.deg2rad(np.linspace(0, 360, 360))\n x_data = radius * np.sin(theta) + offset[0]\n y_data = radius * np.cos(theta) + offset[1]\n radii = radius *...
[ 3, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in d: packs[i % k] += 1 <|reserved_special_token_0|> if k % 2 == 0: counter += packs[k // 2] // 2 for i in range(1, ceil(k / 2)): counter += min(packs[i], packs[k - i]) print(counter * 2) <|reserved_special_tok...
flexible
{ "blob_id": "2226382c494af33957a44d9f1682f7deacf574a2", "index": 2075, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in d:\n packs[i % k] += 1\n<mask token>\nif k % 2 == 0:\n counter += packs[k // 2] // 2\nfor i in range(1, ceil(k / 2)):\n counter += min(packs[i], packs[k - i])\nprint(cou...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pygame.display.set_caption('Space Force Prime') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> img_dir = path.join(path.dirname(__file__), 'img') WIDTH = 720 HEIGHT = 720 FPS = 30 RED = 2...
flexible
{ "blob_id": "88dfb422b1c9f9a9a8f497e1dbba5598c2710e9b", "index": 5718, "step-1": "<mask token>\n", "step-2": "<mask token>\npygame.display.set_caption('Space Force Prime')\n<mask token>\n", "step-3": "<mask token>\nimg_dir = path.join(path.dirname(__file__), 'img')\nWIDTH = 720\nHEIGHT = 720\nFPS = 30\nRED =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> STATUS_CHOICES = (-1, 'Eliminado'), (0, 'Inactivo'), (1, 'Activo') USERTYPES_CHOICES = () ACTIVATION_CHOICES = (1, 'Activacion'), (2, 'Solicitud Password'), (3, 'Invitacion') ACTIVATIONSTATUS_CHOICES = (-1, 'Expirado'), (0, 'Enviado'), (1, 'Activado') <...
flexible
{ "blob_id": "200552b638d6b1a6879b455837677b82689e0069", "index": 5479, "step-1": "<mask token>\n", "step-2": "STATUS_CHOICES = (-1, 'Eliminado'), (0, 'Inactivo'), (1, 'Activo')\nUSERTYPES_CHOICES = ()\nACTIVATION_CHOICES = (1, 'Activacion'), (2, 'Solicitud Password'), (3,\n 'Invitacion')\nACTIVATIONSTATUS_C...
[ 0, 1, 2 ]
# use local image import io import os from google.cloud import vision from google.oauth2 import service_account creds = service_account.Credentials.from_service_account_file('./key.json') client = vision.ImageAnnotatorClient( credentials=creds, ) # The name of the image file to annotate file_name = os.path.joi...
normal
{ "blob_id": "800573786913ff2fc37845193b5584a0a815533f", "index": 8340, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith io.open(file_name, 'rb') as image_file:\n content = image_file.read()\n<mask token>\nprint(response)\nprint(response.safe_search_annotation.adult)\nfor label in response.label_ann...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> json_data.close() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> json_data = open('eventnotipy/config.json') data = json.load(json_data) json_data.close() username = data['dbuser'] passwo...
flexible
{ "blob_id": "1f0680c45afb36439c56a1d202537261df5f9afc", "index": 5895, "step-1": "<mask token>\n", "step-2": "<mask token>\njson_data.close()\n<mask token>\n", "step-3": "<mask token>\njson_data = open('eventnotipy/config.json')\ndata = json.load(json_data)\njson_data.close()\nusername = data['dbuser']\npass...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> gmap.heatmap(latitude, longitude) gmap.scatter(latitude, longitude, c='r', marker=True) <|reserved_special_token_0|> gmap.draw('c:\\users\\jackc\\desktop\\country_heatmap.html') <|reserved_special_token_0|> <|reserved_special_to...
flexible
{ "blob_id": "1cc77ed1c5da025d1b539df202bbd3310a174eac", "index": 3902, "step-1": "<mask token>\n", "step-2": "<mask token>\ngmap.heatmap(latitude, longitude)\ngmap.scatter(latitude, longitude, c='r', marker=True)\n<mask token>\ngmap.draw('c:\\\\users\\\\jackc\\\\desktop\\\\country_heatmap.html')\n<mask token>\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IndexedDBTimelineMetric(timeline_based_metric.TimelineBasedMetric): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class IndexedDBTimelineMetric(timeline_based_metric.T...
flexible
{ "blob_id": "47f88bc3836490e08f464f71351096b54118420e", "index": 5297, "step-1": "<mask token>\n\n\nclass IndexedDBTimelineMetric(timeline_based_metric.TimelineBasedMetric):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass IndexedDBTimelineMetric(timeline_based_metri...
[ 1, 3, 4, 5, 6 ]
from pyparsing import ParseException from pytest import raises from easymql.expressions import Expression as exp class TestComparisonExpression: def test_cmp(self): assert exp.parse('CMP(1, 2)') == {'$cmp': [1, 2]} with raises(ParseException): exp.parse('CMP(1)') with raises(P...
normal
{ "blob_id": "91959f6621f05b1b814a025f0b95c55cf683ded3", "index": 5856, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestComparisonExpression:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass TestComparisonExpression:\n\n def test_cmp(self):\n assert exp.parse('CMP(1, 2)') ...
[ 0, 1, 2, 3 ]
# VGGNet import numpy as np np.random.seed(317) from glob import glob from itertools import cycle from keras.applications.vgg19 import VGG19 from keras.optimizers import Adam from keras.models import Model from keras.layers import Input, BatchNormalization, Flatten, Dropout, Dense from keras.utils import plot_model fr...
normal
{ "blob_id": "c6a4d566460a06504abf7e2c54be4f2ea36e01fb", "index": 7735, "step-1": "<mask token>\n\n\nclass VGGNet(object):\n\n def __init__(self, checkpoint_name='VGGNet'):\n self.config = {'image_shape': [256, 256, 3], 'input_shape': [224, \n 224, 3], 'output_shape': [17], 'batch_size': 60, ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class PageOne(tk.Frame): def __init__(self, master): tk.Frame.__init__(self, master) frame_left = Frame(self) self.frame_left = frame_left frame_left.pack(fill=BOTH, side=LEFT) self.label = tk.Label(frame_left, text='', font=('Helvetica', 10), ...
flexible
{ "blob_id": "4e6401672d4762b444bb679e4cc39ada04193a26", "index": 1882, "step-1": "<mask token>\n\n\nclass PageOne(tk.Frame):\n\n def __init__(self, master):\n tk.Frame.__init__(self, master)\n frame_left = Frame(self)\n self.frame_left = frame_left\n frame_left.pack(fill=BOTH, side...
[ 11, 12, 15, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': n.notify('READY=1') time.sleep(2) <|reserved_special_token_1|> <|reserved_special_token_0|> n = sdnotify.SystemdNotifier() if __name__ == '__main__': n.notify('READY=1') time.sleep(2) ...
flexible
{ "blob_id": "78dc2193c05ddb4cd4c80b1c0322890eca7fcf19", "index": 789, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n n.notify('READY=1')\n time.sleep(2)\n", "step-3": "<mask token>\nn = sdnotify.SystemdNotifier()\nif __name__ == '__main__':\n n.notify('READY=1')\n ...
[ 0, 1, 2, 3, 4 ]
# 在写Python爬虫的时候,最麻烦的不是那些海量的静态网站,而是那些通过JavaScript获取数据的站点。Python本身对js的支持就不好,所以就有良心的开发者来做贡献了,这就是Selenium,他本身可以模拟真实的浏览器,浏览器所具有的功能他一个都不拉下,加载js更是小菜了 # https://zhuanlan.zhihu.com/p/27115580 # C:\Users\hedy\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\hedy\AppData\Local\Programs\Python\Python36\ # pip 换源 # http://...
normal
{ "blob_id": "e2948c0ad78ce210b08d65b3e0f75d757e286ad9", "index": 3883, "step-1": "# 在写Python爬虫的时候,最麻烦的不是那些海量的静态网站,而是那些通过JavaScript获取数据的站点。Python本身对js的支持就不好,所以就有良心的开发者来做贡献了,这就是Selenium,他本身可以模拟真实的浏览器,浏览器所具有的功能他一个都不拉下,加载js更是小菜了\n# https://zhuanlan.zhihu.com/p/27115580\n# C:\\Users\\hedy\\AppData\\Local\\Programs\\P...
[ 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='RedHatSecurityAdvisory', version='0.1', description= 'Script that automatically checks the RedHat security advisories to see if a CVE applies' , author='Pieter-Jan Moreels', url= 'https://github.com/PidgeyL...
flexible
{ "blob_id": "3f8c13be547099aa6612365452926db95828b9a0", "index": 554, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='RedHatSecurityAdvisory', version='0.1', description=\n 'Script that automatically checks the RedHat security advisories to see if a CVE applies'\n , author='Pieter-Jan Mo...
[ 0, 1, 2, 3 ]
#Uses python3 import sys def lcs2(a, b): dp_result = [[0 for j in range(b+1)] for i in range(a+1)] for x in range(1, a+1): for y in range(1, b+1): if a[x-1] == b[y-1] and b[y-1] == c[z-1]: dp_result[x][y] = dp_result[x-1][y-1] + 1 else: dp_re...
normal
{ "blob_id": "d20b336c6588c3cfc4393256b660d6e4ff56b84e", "index": 1543, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef lcs2(a, b):\n dp_result = [[(0) for j in range(b + 1)] for i in range(a + 1)]\n for x in range(1, a + 1):\n for y in range(1, b + 1):\n if a[x - 1] == b[y ...
[ 0, 1, 2, 3, 4 ]
""" Array.diff Our goal in this kata is to implement a difference function, which subtracts one list from another and returns the result. It should remove all values from list a, which are present in list b keeping their order. """ from unittest import TestCase def list_diff(a, b): return [x for x in a if x n...
normal
{ "blob_id": "76526bdff7418997ac90f761936abccbb3468499", "index": 6513, "step-1": "<mask token>\n\n\nclass TestListDiff(TestCase):\n <mask token>\n\n def test_two(self):\n assert list_diff([1, 2, 2, 2, 3], [2]) == [1, 3]\n <mask token>\n\n\n<mask token>\n\n\nclass TestDiffLR(TestCase):\n\n def ...
[ 6, 8, 9, 10, 12 ]
# Multiple Linear Regression # To set the working directory save this .py file where we have the Data.csv file # and then press the Run button. This will automatically set the working directory. # Importing the data from preprocessing data import numpy as np import matplotlib.pyplot as plt import pandas as pd d...
normal
{ "blob_id": "4d722975b4ffc1bbfe7591e6ceccc758f67a5599", "index": 6920, "step-1": "<mask token>\n", "step-2": "<mask token>\nregressor.fit(X_train, y_train)\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()\n<mask token>\nregressor_OLS.summary()...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def mini200(videopath, minipath, mod='train'): with open(videopath, 'r') as video_f: all_videos = video_f.readlines() count = [(0) for _ in range(0, 200)] with open(minipath, 'w') as f: for video in all_videos: path, label = video.sp...
flexible
{ "blob_id": "f6d4208afee7aacd96ea5ae6c9e38d2876466703", "index": 7417, "step-1": "<mask token>\n\n\ndef mini200(videopath, minipath, mod='train'):\n with open(videopath, 'r') as video_f:\n all_videos = video_f.readlines()\n count = [(0) for _ in range(0, 200)]\n with open(minipath, 'w') a...
[ 2, 3, 4, 5, 6 ]
"""Module for the bot""" from copy import deepcopy from time import sleep import mcpi.minecraft as minecraft from mcpi.vec3 import Vec3 import mcpi.block as block from search import SearchProblem, astar, bfs from singleton import singleton _AIR = block.AIR.id _WATER = block.WATER.id _LAVA = block.LAVA.id _BEDROCK =...
normal
{ "blob_id": "54f0ed5f705d5ada28721301f297b2b0058773ad", "index": 2, "step-1": "<mask token>\n\n\nclass _GenericBot:\n <mask token>\n\n def __init__(self, pos, inventory=None):\n \"\"\"Initialize with an empty inventory.\n\n inventory is a dictionary. If None, an empty one will be used.\"\"\"\...
[ 52, 53, 58, 60, 79 ]
import urllib.request import json def kind(): data={} with open("dataset.json", "r") as read_file: data = json.load(read_file) return data["kind"] def items(): data={} with open("dataset.json", "r") as read_file: data = json.load(read_file) return data["items"] #Can add a bunc...
normal
{ "blob_id": "630480e9458491a26ea9060bd36541a0d5805a11", "index": 647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef kind():\n data = {}\n with open('dataset.json', 'r') as read_file:\n data = json.load(read_file)\n return data['kind']\n\n\n<mask token>\n", "step-3": "<mask toke...
[ 0, 1, 2, 3, 4 ]
class Thing3: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Thing3: def __init__(self): self.letters = 'xyz' <|reserved_special_token_0|> <|reserved_special_token_1|> class Thing3: def __init__(self): self.letters = 'xyz' <|reserve...
flexible
{ "blob_id": "22bf65a20f7398b82f528112d2ba50f1dccd465c", "index": 6487, "step-1": "class Thing3:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Thing3:\n\n def __init__(self):\n self.letters = 'xyz'\n\n\n<mask token>\n", "step-3": "class Thing3:\n\n def __init__(self):\n self.let...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # coding: utf-8 # In[1]: #multi layer perceptron with back propogation import numpy as np import theano import matplotlib.pyplot as plt # In[2]: inputs=[[0,0], [1,0], [0,1], [1,1]] outputs=[1,0,0,1] # In[3]: x=theano.tensor.matrix(name='x') # In[4]: #Hidden laye...
normal
{ "blob_id": "adec7efceb038c0ecb23c256c23c2ea212752d64", "index": 4010, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(25000):\n pval, costval = train(inputs, outputs)\n print(costval)\n val1.append(pval)\n cost1.append(costval)\nprint('the final outputs are:')\nfor i in range(l...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class LoginView(Resource): def __init__(self): self.db = UsersModel() self.user_db = IncidentsModel() def post(self): data = request.get_json() username = data['username'] password = data['password'] auth = self.db.authenticate(use...
flexible
{ "blob_id": "0188355f84054143bd4ff9da63f1128e9eb5b23b", "index": 2244, "step-1": "<mask token>\n\n\nclass LoginView(Resource):\n\n def __init__(self):\n self.db = UsersModel()\n self.user_db = IncidentsModel()\n\n def post(self):\n data = request.get_json()\n username = data['us...
[ 8, 10, 11, 12, 14 ]
# Generated by Django 2.1 on 2018-12-05 00:02 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('PleniApp', '0006_auto_20181203_1144'), ] operations = [ migrations.CreateModel( name='Comment', ...
normal
{ "blob_id": "ccb6973910dba5897f6a12be23c74a35e848313b", "index": 4005, "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 = [('PleniApp', ...
[ 0, 1, 2, 3, 4 ]
import sys import HTSeq import re import string import glob import os import time import difflib import argparse def parse_input(): parser = argparse.ArgumentParser(description=""" USAGE: python make_figs.py -f data_file """) # If the -b option is used, tRNAs with no tails are not counted. # This...
normal
{ "blob_id": "05f5931a53c9916f151f42910575f9c5533bfceb", "index": 9921, "step-1": "import sys\nimport HTSeq\nimport re\nimport string\nimport glob\nimport os\nimport time\nimport difflib\nimport argparse\n\n\ndef parse_input():\n parser = argparse.ArgumentParser(description=\"\"\"\n USAGE: python make_figs....
[ 0 ]
""" """ import os import json import csv cutoff = float(input("Tolerance (decimal)? ")) docpath = "C:/Users/RackS/Documents/" out = open("isosegmenter_scoring_error"+str(cutoff*100)+".csv", 'w', encoding='UTF-8') summary = open("isosegmenter_score_summary_error"+str(cutoff*100)+".txt", 'w', encoding='UTF-8') out.write...
normal
{ "blob_id": "af2aa236f6bfc582093faf868a374be1ebdfabf2", "index": 1235, "step-1": "<mask token>\n", "step-2": "<mask token>\nout.write('SEQUENCE_ID,TYPE,DOMAINS,TP,FP,FN,Sens,PPV,Jaccard\\n')\n<mask token>\nfor file in os.listdir(docpath + 'isoSegmenter100'):\n if file.endswith('.csv') and 'E' in file:\n ...
[ 0, 1, 2, 3, 4 ]
from robocorp_ls_core.python_ls import PythonLanguageServer from robocorp_ls_core.basic import overrides from robocorp_ls_core.robotframework_log import get_logger from typing import Optional, List, Dict from robocorp_ls_core.protocols import IConfig, IMonitor, ITestInfoTypedDict, IWorkspace from functools import parti...
normal
{ "blob_id": "18b43ea8696e2e54f4c1cbbece4cde1fd3130145", "index": 194, "step-1": "<mask token>\n\n\nclass RobotFrameworkServerApi(PythonLanguageServer):\n <mask token>\n\n def __init__(self, read_from, write_to, libspec_manager=None, observer:\n Optional[IFSObserver]=None):\n from robotframewo...
[ 19, 33, 35, 44, 51 ]
<|reserved_special_token_0|> class DataTypesTestCase(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_is_rain_a_float(self): rain = dfClean.iloc[4908, 2] self.assertTrue(isinstance(rain, float)) <|reserved_special_token_0|> <|reserved_special_...
flexible
{ "blob_id": "9d0727970c760a9a8123c5c07359ba5c538cea3c", "index": 5926, "step-1": "<mask token>\n\n\nclass DataTypesTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n\n def test_is_rain_a_float(self):\n rain = dfClean.iloc[4908, 2]\n self.assertTrue(isinstance(rain, float))\n <...
[ 18, 19, 29, 31, 33 ]
# 가위, 바위, 보 게임 # 컴퓨터 가위, 바위, 보 리스트에서 랜덤하게 뽑기 위해 random 함수 호출 import random # 컴퓨터 가위, 바위, 보 리스트 list_b = ["가위", "바위", "보"] # 이긴횟수, 진 횟수 카운팅 하기 위한 변수 person_win_count = 0 person_lose_count = 0 while person_win_count < 4 or person_lose_count < 4: # 가위, 바위, 보 입력 받기 player = input("가위, 바위, 보 중 어떤 것을 낼래요? ") ...
normal
{ "blob_id": "93d4c6b6aef827d6746afc684c32a9cf1d0229e4", "index": 717, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile person_win_count < 4 or person_lose_count < 4:\n player = input('가위, 바위, 보 중 어떤 것을 낼래요? ')\n if player != '가위' and player != '바위' and player != '보':\n player = input('다시...
[ 0, 1, 2, 3, 4 ]
""" This is the interface that allows for creating nested lists. You should not implement it, or speculate about its implementation class NestedInteger(object): def isInteger(self): # @return {boolean} True if this NestedInteger holds a single integer, # rather than a nested list. def getInteg...
normal
{ "blob_id": "bb81027ed5311e625591d98193997e5c7b533b70", "index": 4945, "step-1": "<mask token>\n\n\nclass Solution(object):\n\n def depthSum(self, nestedList):\n if len(nestedList) == 0:\n return 0\n from queue import Queue\n q = Queue()\n sum = 0\n depth = 1\n ...
[ 2, 3, 4, 5, 6 ]
import pytest from homeworks.homework6.oop_2 import ( DeadLineError, Homework, HomeworkResult, Student, Teacher, ) def test_creating_objects(): teacher = Teacher("Daniil", "Shadrin") student = Student("Roman", "Petrov") homework = teacher.create_homework("Learn OOP", 1) homework_r...
normal
{ "blob_id": "8f971ee3b98691a887ee0632afd613bbf4f19aa0", "index": 3505, "step-1": "<mask token>\n\n\ndef test_creating_objects():\n teacher = Teacher('Daniil', 'Shadrin')\n student = Student('Roman', 'Petrov')\n homework = teacher.create_homework('Learn OOP', 1)\n homework_result = student.do_homework...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def kombinacije_trgovin_f(mnozica_izdelkov_v_kosarici, seznam_trgovin, trgovine_z_izdelki): generator_kombinacij = (set(itertools.compress(seznam_trgovin, el)) for el in itertools.product(*([[0, 1]] * len(seznam_trgovin)))) kombinacije = [] for mnozica_trgovin in g...
flexible
{ "blob_id": "5a0702dd869862ebc27c83d10e0b1f0575de68a7", "index": 2944, "step-1": "<mask token>\n\n\ndef kombinacije_trgovin_f(mnozica_izdelkov_v_kosarici, seznam_trgovin,\n trgovine_z_izdelki):\n generator_kombinacij = (set(itertools.compress(seznam_trgovin, el)) for\n el in itertools.product(*([[0,...
[ 4, 5, 6, 8, 9 ]
#!/bin/python3 # Implement a stack with push, pop, inc(e, k) operations # inc (e,k) - Add k to each of bottom e elements import sys class Stack(object): def __init__(self): self.arr = [] def push(self, val): self.arr.append(val) def pop(self): if len(self.arr): return...
normal
{ "blob_id": "5ed439a2a7cfb9c941c40ea0c5eba2851a0f2855", "index": 24, "step-1": "<mask token>\n\n\nclass Stack(object):\n\n def __init__(self):\n self.arr = []\n\n def push(self, val):\n self.arr.append(val)\n\n def pop(self):\n if len(self.arr):\n return self.arr.pop()\n\...
[ 5, 6, 7, 8, 10 ]
c = "こ に ち わ " print (len(c))
normal
{ "blob_id": "26f466a6a2fd09bb108ca89e4537192c070ff83b", "index": 1335, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(c))\n", "step-3": "c = 'こ に ち わ '\nprint(len(c))\n", "step-4": "c = \"こ に ち わ \"\nprint (len(c))\n", "step-5": null, "step-ids": [ 0, 1, 2, 3 ] }
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def rinex_merge(output_fname, rinex_fnames, _err=sys.stderr): """ Using teqc, merge *rinex_fnames* and store to the file *output_fname*. Returns *output_fname*. Redirect error output to *_err*. """ args = ['-pch'] + rinex_fnames sh.teqc(*args, _out=output_fname...
flexible
{ "blob_id": "ec19567b49f686f613308d79e439f6ff9053fa40", "index": 5064, "step-1": "<mask token>\n\n\ndef rinex_merge(output_fname, rinex_fnames, _err=sys.stderr):\n \"\"\"\n Using teqc, merge *rinex_fnames* and store to the file\n *output_fname*. Returns *output_fname*. Redirect error output to\n *_er...
[ 1, 3, 4, 5, 6 ]
import wx import os # os.environ["HTTPS_PROXY"] = "http://user:pass@192.168.1.107:3128" import wikipedia import wolframalpha import pyttsx3 import webbrowser import winshell import json import requests import ctypes import random from urllib.request import urlopen import speech_recognition as sr import ssl import urlli...
normal
{ "blob_id": "8f1e6ea93b2dd7add256cb31d2c621aa69721609", "index": 8834, "step-1": "<mask token>\n\n\nclass MyFrame(wx.Frame):\n\n def __init__(self):\n wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(\n 450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |\n ...
[ 3, 4, 5, 6, 7 ]
class NumMatrix(object): def __init__(self, matrix): if matrix: self.dp = [[0] * (len(matrix[0]) + 1) for i in range(len(matrix)+1)] for i in xrange(1,len(matrix)+1): for j in xrange(1,len(matrix[0])+1): self.dp[i][j] = self.dp[i-1][j] + self....
normal
{ "blob_id": "443ce5c2ec86b9f89ad39ef2ac6772fa002e7e16", "index": 8377, "step-1": "class NumMatrix(object):\n\n def __init__(self, matrix):\n if matrix:\n self.dp = [[0] * (len(matrix[0]) + 1) for i in range(len(matrix)+1)]\n for i in xrange(1,len(matrix)+1):\n for j...
[ 0 ]
<|reserved_special_token_0|> class ArbertmoPreprocessor: <|reserved_special_token_0|> def __init__(self, model_name, keep_emojis=False, remove_html_markup= True, replace_urls_emails_mentions=True, strip_tashkeel=True, strip_tatweel=True, insert_white_spaces=True, remove_elongation=True): ...
flexible
{ "blob_id": "6c3f60f05adbebe521ba08d7a7e9fc10b1cc914f", "index": 2907, "step-1": "<mask token>\n\n\nclass ArbertmoPreprocessor:\n <mask token>\n\n def __init__(self, model_name, keep_emojis=False, remove_html_markup=\n True, replace_urls_emails_mentions=True, strip_tashkeel=True,\n strip_tatw...
[ 12, 13, 14, 15, 16 ]
import operator import theano.tensor as T from collections import OrderedDict from lasagne.layers import get_output from stanza.research import config from neural import SimpleLasagneModel, NeuralLearner from vectorizers import SequenceVectorizer, BucketsVectorizer from neural import OPTIMIZERS, get_named_layers from ...
normal
{ "blob_id": "3496216de9f6b7d9d3db69eb4d8f8c0fdcd5123c", "index": 1358, "step-1": "<mask token>\n\n\nclass RSAGraphModel(SimpleLasagneModel):\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\nclass...
[ 15, 21, 23, 36, 38 ]
# -*- coding: utf-8 -*- import json import argparse def parse_args(): """ Parse input arguments. :return: """ parser = argparse.ArgumentParser(description='以图搜图API测试') parser.add_argument('--ak', dest='access_key', help='access_key for qiniu account', type=str) pars...
normal
{ "blob_id": "c7147741784b37b42200869002d4df5ddc900675", "index": 2001, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_args():\n \"\"\"\n Parse input arguments.\n :return:\n \"\"\"\n parser = argparse.ArgumentParser(description='以图搜图API测试')\n parser.add_argument('--ak', des...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .submit import * from .fck import *
flexible
{ "blob_id": "9a5ba88a61f5c27c0bc7b980fa9d865b52cbbb20", "index": 7266, "step-1": "<mask token>\n", "step-2": "from .submit import *\nfrom .fck import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class BasicTestSuite(unittest.TestCase): <|reserved_special_token_0|> def test_hello_world(self): self.assertEqual(hello_world(), 'hello world') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class BasicTestSuite(unittest.Tes...
flexible
{ "blob_id": "6420d1b9da7ff205e1e138f72b194f63d1011012", "index": 4554, "step-1": "<mask token>\n\n\nclass BasicTestSuite(unittest.TestCase):\n <mask token>\n\n def test_hello_world(self):\n self.assertEqual(hello_world(), 'hello world')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Basi...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestRailAPI(Session): <|reserved_special_token_0|> @property def attachments(self) ->_category.Attachments: """ https://www.gurock.com/testrail/docs/api/reference/attachments Use the following API methods to upload, retrieve and delete attachment...
flexible
{ "blob_id": "c2467e94a2ad474f0413e7ee3863aa134bf9c51f", "index": 3399, "step-1": "<mask token>\n\n\nclass TestRailAPI(Session):\n <mask token>\n\n @property\n def attachments(self) ->_category.Attachments:\n \"\"\"\n https://www.gurock.com/testrail/docs/api/reference/attachments\n U...
[ 17, 20, 21, 22, 24 ]
import org.cogroo.gc.cmdline import typing class __module_protocol__(typing.Protocol): # A module protocol which reflects the result of ``jp.JPackage("org.cogroo.gc")``. cmdline: org.cogroo.gc.cmdline.__module_protocol__
normal
{ "blob_id": "f615e7bbfa9179d0bfb321242cd8df4ae7b48993", "index": 3181, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass __module_protocol__(typing.Protocol):\n cmdline: org.cogroo.gc.cmdline.__module_protocol__\n", "step-3": "import org.cogroo.gc.cmdline\nimport typing\n\n\nclass __module_pr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Odbserver(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_toke...
flexible
{ "blob_id": "c2490c3aacfa3ce22c3f47a69dbc44b695c2a2e5", "index": 9509, "step-1": "<mask token>\n\n\nclass Odbserver(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ...
[ 13, 14, 16, 17, 19 ]
<|reserved_special_token_0|> def read_file(string_object): """ Opens and reads through a file, returning none if it isnt found """ try: return open(string_object, 'r') except FileNotFoundError: return None <|reserved_special_token_0|> def populate_weight_tuple_list(list_object): ""...
flexible
{ "blob_id": "d8af8e36bd00fbfc966ef1c4dd0c6385cbb019ee", "index": 2064, "step-1": "<mask token>\n\n\ndef read_file(string_object):\n \"\"\" Opens and reads through a file, returning none if it isnt found \"\"\"\n try:\n return open(string_object, 'r')\n except FileNotFoundError:\n return No...
[ 4, 5, 6, 8, 10 ]
from scrapera.image.duckduckgo import DuckDuckGoScraper scraper = DuckDuckGoScraper() scraper.scrape('spongebob squarepants', 1, r'path/to/output/directory')
normal
{ "blob_id": "d234034f7f232e842d0b4e465ea6ec314af6964d", "index": 4209, "step-1": "<mask token>\n", "step-2": "<mask token>\nscraper.scrape('spongebob squarepants', 1, 'path/to/output/directory')\n", "step-3": "<mask token>\nscraper = DuckDuckGoScraper()\nscraper.scrape('spongebob squarepants', 1, 'path/to/ou...
[ 0, 1, 2, 3, 4 ]
"""For logging training information to files.""" import os def delete_log(file_path): """Delete a log file. Args: file_path: String, the full path to the log file. Raises: ValueError: if file not found. """ if os.path.exists(file_path): print('Deleting log %s...' % file_path)...
normal
{ "blob_id": "1355c3abfd2683f6dc869703fdb79a04e264099c", "index": 3421, "step-1": "<mask token>\n\n\nclass Logger:\n <mask token>\n\n def __init__(self, file_path, print_too=True, override=False):\n \"\"\"Create a new Logger.\n\n Args:\n file_path: String, the full path to the target ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Gobang: <|reserved_special_token_0|> <|reserved_special_token_0|> def new(self): """新局""" self.__init__() def printcb(self): """打印棋盘""" print('\x1b[7;32;40m+ ', end='') for c in range(65, 80): print(chr(c), end=...
flexible
{ "blob_id": "e0394bfed51cd0af9bca06867e9b556b226f37d1", "index": 1720, "step-1": "<mask token>\n\n\nclass Gobang:\n <mask token>\n <mask token>\n\n def new(self):\n \"\"\"新局\"\"\"\n self.__init__()\n\n def printcb(self):\n \"\"\"打印棋盘\"\"\"\n print('\\x1b[7;32;40m+ ', end...
[ 8, 11, 14, 15, 16 ]
Xeval[[1,2],:] # *** Spyder Python Console History Log *** Xeval[:,:] optfunc.P(Xeval[:,:]) optfunc.P(Xeval) optfunc.P(Xeval[[0,1,2,3,4],:]) optfunc.P(Xeval[[0,1,],:]) optfunc.P(Xeval[[0,1],:]) optfunc.P(Xeval[[0,1,2,3],:]) optfunc.P(Xeval[[0,1,2,3,4],:]) optfunc.P(Xeval[[0,1,2],:]) Xeval[[0,1,2,3,4],:] Xev...
normal
{ "blob_id": "02b20c3f5941873dfd22a7fbedb825e66c613ace", "index": 2278, "step-1": "Xeval[[1,2],:]\r\n# *** Spyder Python Console History Log ***\r\nXeval[:,:]\r\noptfunc.P(Xeval[:,:])\r\noptfunc.P(Xeval)\r\noptfunc.P(Xeval[[0,1,2,3,4],:])\r\noptfunc.P(Xeval[[0,1,],:])\r\noptfunc.P(Xeval[[0,1],:])\r\noptfunc.P(Xev...
[ 0 ]
class Persona: <|reserved_special_token_0|> <|reserved_special_token_0|> def hola(self): print('Hola Mundo') class Empleado(Persona): def __init__(self, salario, antiguedad, nombre_empleado, edad_empleado, residencia_empleado): super().__init__(nombre_empleado, edad_empleado,...
flexible
{ "blob_id": "92a50bcdbb4c03d1a4813a93c2e0986250516f14", "index": 1117, "step-1": "class Persona:\n <mask token>\n <mask token>\n\n def hola(self):\n print('Hola Mundo')\n\n\nclass Empleado(Persona):\n\n def __init__(self, salario, antiguedad, nombre_empleado, edad_empleado,\n residencia...
[ 5, 6, 8, 9, 10 ]
n = eval(input("Entrez valeur: ")) res = 0 while n > 0: res += n%10 n //= 10 print(res, n) print(res)
normal
{ "blob_id": "391ecb2f23cc0ce59bd9fac6f97bd4c1788444b9", "index": 4416, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile n > 0:\n res += n % 10\n n //= 10\n print(res, n)\nprint(res)\n", "step-3": "n = eval(input('Entrez valeur: '))\nres = 0\nwhile n > 0:\n res += n % 10\n n //= 10\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def CreateCGCS2000prj(shpPath): body = ( 'GEOGCS["CGCS_2000",DATUM["D_2000",SPHEROID["S_2000",6378137.0,298.2572221010041]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]' ) writePrj(shpPath, body) <|reserved_special_token_0|> <|reserved_special_tok...
flexible
{ "blob_id": "eab2cdd92d3be5760f13e747b05ca902eaf9aca8", "index": 8287, "step-1": "<mask token>\n\n\ndef CreateCGCS2000prj(shpPath):\n body = (\n 'GEOGCS[\"CGCS_2000\",DATUM[\"D_2000\",SPHEROID[\"S_2000\",6378137.0,298.2572221010041]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]'\n ...
[ 1, 3, 6, 9, 10 ]
# -*- coding: utf-8 -*- from __future__ import absolute_import import sh import reqwire.helpers.cli log_methods = ( 'echo', 'error', 'fatal', 'info', 'warn', 'warning', ) def test_emojize_win32(mocker): mocker.patch('sys.platform', 'win32') assert reqwire.helpers.cli.emojize( ...
normal
{ "blob_id": "1a7a2c2cfb2aa94401defd7a7a500f7dd2e7e0aa", "index": 9680, "step-1": "<mask token>\n\n\ndef test_emojize_win32(mocker):\n mocker.patch('sys.platform', 'win32')\n assert reqwire.helpers.cli.emojize(':thumbs_up_sign: foo').encode('utf-8'\n ) == b'foo'\n\n\ndef test_emojize_linux(mocker):\n...
[ 7, 8, 9, 10, 11 ]