code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import datetime # weightloss script currentWeight = 73 goalWeight = 67 avgKgPerWeek = 0.45 startDate = datetime.date.today() endDate = startDate while currentWeight > goalWeight: # adding 7 days to simulate a week passing endDate += datetime.timedelta(days=7) currentWeight -= avgKgPerWeek print...
normal
{ "blob_id": "7fb568880c40895870a0c541d9a88a8070a79e5b", "index": 5762, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile currentWeight > goalWeight:\n endDate += datetime.timedelta(days=7)\n currentWeight -= avgKgPerWeek\n print(endDate, round(currentWeight, 2))\nprint(f'Start date: {startDat...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import hashlib import re from datetime import datetime import gevent import requests import scrapy from gevent.pool import Pool from lxml import etree from scrapy.http import HtmlResponse from sqlalchemy import create_engine, func from sqlalchemy.orm import sessionmaker ...
normal
{ "blob_id": "eb853e430b996a81dc2ef20c320979a3e04d956a", "index": 237, "step-1": "<mask token>\n\n\nclass Beautyleg7Spider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def parse(self, response):\n if self.db_session is No...
[ 3, 6, 8, 9, 13 ]
Album,artist,year,songs="More Mayhem","Imelda May",2001,((1,"pulling the rug"),(2,"psycho"),(3,"mayhem"),(4,"kentisch town waltz")) for song in songs: track,title=song print(" track number {}\t, title {}".format(track,title))
normal
{ "blob_id": "30f02b956af68960804f0cb57695bdbf8510bc43", "index": 7290, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor song in songs:\n track, title = song\n print(' track number {}\\t, title {}'.format(track, title))\n", "step-3": "Album, artist, year, songs = 'More Mayhem', 'Imelda May', 200...
[ 0, 1, 2, 3 ]
from base_plugin import * from plugin_utils import * from datetime import datetime import time class LogPlugin(Plugin): def initialize(self): self.add_trigger(on_message) self.add_command("!chatsearch", self.search) self.add_command("!chatreplay", self.replay) def run(self, message): append_to_file(str(...
normal
{ "blob_id": "d932ab84848c9a8ca8bb23a57424b8f6190b6260", "index": 2563, "step-1": "<mask token>\n\n\nclass LogPlugin(Plugin):\n <mask token>\n <mask token>\n\n def search(self, message, query, *additional_queries):\n chat_history = read_lines_from_file('chatlog.log')\n chat_history.reverse(...
[ 3, 4, 5, 6, 7 ]
""" 100 4 200 1 3 2 100 4 200 1 3 2 6:35 """ class Solution: def longestConsecutive(self, nums: List[int]) -> int: numset = set(nums) ans = 0 # visited = set(nums) maxnum = float('-inf') if not nums: return 0 for n in numset: ...
normal
{ "blob_id": "50c7ce95f17cbd40a753d16d9f9fab349ad4f4ce", "index": 3801, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def longestConsecutive(self, nums: List[int]) ->int:\n numset = set(nums)\n a...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def create_app(config_name): app = Flask(__name__) app.config.from_object(Config) app.config.from_object(config_options[config_name]) app.config['SECRET_KEY'] = 'd686414d5eeb7d38df7e8c385b2c2c47' bootstrap.in...
flexible
{ "blob_id": "2eecc852a6438db19e0ed55ba6cc6610d76c6ed0", "index": 2207, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef create_app(config_name):\n app = Flask(__name__)\n app.config.from_object(Config)\n app.config.from_object(config_options[config_name])\n app.config['SECRET_KEY'] = 'd...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def parse_page(page): if 'redirect' in page.keys(): return page_text = page['revision']['text']['#text'] page_text = remove_xml_comments(page_text) title = page['title'] categories = extract_categorie...
flexible
{ "blob_id": "0ad2e6d7e3fd61943fc1dfe6662110a6f48c1bd5", "index": 5347, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_page(page):\n if 'redirect' in page.keys():\n return\n page_text = page['revision']['text']['#text']\n page_text = remove_xml_comments(page_text)\n title ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def select_sort(input): print('\nSelect Sort') input_len = len(input) for i in range(0, input_len): min_index = i for j in range(i + 1, input_len): if input[j] < input[min_index]: min_index = j tmp = input[i] input[i]...
flexible
{ "blob_id": "c967aa647a97b17c9a7493559b9a1577dd95263a", "index": 7806, "step-1": "<mask token>\n\n\ndef select_sort(input):\n print('\\nSelect Sort')\n input_len = len(input)\n for i in range(0, input_len):\n min_index = i\n for j in range(i + 1, input_len):\n if input[j] < inpu...
[ 1, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def eval_loop(): line = input('Please enter a sting') while True: if line == 'done': break else: output = eval(line) print(output) line = input('Please enter a ...
flexible
{ "blob_id": "b0062dde448c450131f578a2afe130ca663f0902", "index": 2041, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef eval_loop():\n line = input('Please enter a sting')\n while True:\n if line == 'done':\n break\n else:\n output = eval(line)\n ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015-2016 Applatix, Inc. All rights reserved. # ''' cAdvisor CLI. Used by axstats temporarily before moving to Heapster ''' import requests import logging import time logger = logging.getLogger(__name__) CHECK_LIVELINESS_INTERVAL = 5 CONNECTION_TIMEOUT = 5 ...
normal
{ "blob_id": "87f672919f6019e549508b239c798301d5f549bd", "index": 7667, "step-1": "<mask token>\n\n\nclass AXCadvisorClient(object):\n\n def __init__(self, ip):\n self._wait_interval = 60\n self._url_prefix = 'http://{ip}:{port}/api/v2.0/'.format(ip=ip,\n port=4194)\n self.wait_...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> class SeriesListSerializer(serializers.ModelSerializer): class Meta: model = Serie fields = 'name', class CatalogCoinListSerializer(serializers.ModelSerializer): class Meta: model = CatalogCoin fields = ('id', 'face_value', 'currency', 'countr...
flexible
{ "blob_id": "b77da75b01e96ff89f873f4c5764a62cf68cd576", "index": 217, "step-1": "<mask token>\n\n\nclass SeriesListSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Serie\n fields = 'name',\n\n\nclass CatalogCoinListSerializer(serializers.ModelSerializer):\n\n\n class Meta:...
[ 7, 8, 9, 10, 11 ]
#Program to convert temp in degree Celsius to temp in degree Fahrenheit celsius=input("Enter temperature in Celsius") celsius=int(celsius) fah=(celsius*9/5)+32 print("Temp in ",celsius,"celsius=",fah," Fahrenheit")
normal
{ "blob_id": "e1172cadeb8b2ce036d8431cef78cfe19bda0cb8", "index": 2161, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Temp in ', celsius, 'celsius=', fah, ' Fahrenheit')\n", "step-3": "celsius = input('Enter temperature in Celsius')\ncelsius = int(celsius)\nfah = celsius * 9 / 5 + 32\nprint('Tem...
[ 0, 1, 2, 3 ]
ulang = 'y' while True : a = int(input ("masukkan nilai = ")) if a > 60 : status = "LULUS" elif a <= 60 : status = "TIDAK LULUS" print(status) ulang = input("apakah anda ingin mengulang? y/n = ")
normal
{ "blob_id": "759b440bf436afbfb081cf55eeb4a0f075ed3e6d", "index": 9577, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n a = int(input('masukkan nilai = '))\n if a > 60:\n status = 'LULUS'\n elif a <= 60:\n status = 'TIDAK LULUS'\n print(status)\n ulang = input('ap...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def create_events_calendar(): """ Create an events calendar if none already exists. This function mostly exists for creating calendars for dev environments, not used in prod. """ service = get_calendar_service() if not service: return calendar = {'summary':...
flexible
{ "blob_id": "36fb0d936be5c5d305c4076fd1c497664c9b770a", "index": 8374, "step-1": "<mask token>\n\n\ndef create_events_calendar():\n \"\"\" Create an events calendar if none already exists. This function mostly exists for\n creating calendars for dev environments, not used in prod.\n \"\"\"\n service ...
[ 4, 6, 7, 8, 9 ]
# -*- coding: utf-8 -*- import os import re import datetime import sys import codecs import logging import logging.handlers import fnmatch import time import argparse from antlr4 import * from antlr4.tree.Trees import Trees from lxml import etree from AknJudgementClass import AknJudgementXML from AknLega...
normal
{ "blob_id": "190f0bcbac946c410d964860fd5be8718011caa8", "index": 2862, "step-1": "# -*- coding: utf-8 -*-\r\nimport os\r\nimport re\r\nimport datetime\r\nimport sys\r\nimport codecs\r\nimport logging\r\nimport logging.handlers\r\nimport fnmatch\r\nimport time\r\nimport argparse\r\nfrom antlr4 import *\r\nfrom an...
[ 0 ]
import mosquitto import json import time device_id = "868850013067326" # The callback for when the client receives a CONNACK response from the server. def on_connect(mosq, userdata, rc): print("Connected with result code "+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # r...
normal
{ "blob_id": "673d6bb02ec666dbdbecb5fd7fd5041da1941cf8", "index": 2251, "step-1": "import mosquitto\nimport json\nimport time\ndevice_id = \"868850013067326\"\n\n# The callback for when the client receives a CONNACK response from the server.\ndef on_connect(mosq, userdata, rc):\n print(\"Connected with result ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> include('RecExRecoTest/RecExRecoTest_RTT_common.py') <|reserved_special_token_0|> include('RecExCommon/rdotoesdnotrigger.py') include('RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py') <|reserved_special_token_1|> include('RecExRecoTest/RecExRecoTest...
flexible
{ "blob_id": "34c91d273648ae72731fba7f5519a4920d77c0c3", "index": 7192, "step-1": "<mask token>\n", "step-2": "include('RecExRecoTest/RecExRecoTest_RTT_common.py')\n<mask token>\ninclude('RecExCommon/rdotoesdnotrigger.py')\ninclude('RecExRecoTest/RecExRecoTest_RTT_common_postOptions.py')\n", "step-3": "includ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', url(regex='new_subscriber/$', view= add_new_subscriber, name='support.new_subscriber'), url(regex= 'update_subscriber/(?P<pk>\\d+)/$', view=update_existing_subscriber, name='support.update_su...
flexible
{ "blob_id": "fb4818e742ed3c7d131c426811f839dbe70f03de", "index": 2650, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url(regex='new_subscriber/$', view=\n add_new_subscriber, name='support.new_subscriber'), url(regex=\n 'update_subscriber/(?P<pk>\\\\d+)/$', view=update_e...
[ 0, 1, 2, 3 ]
from end import Client c = Client()
normal
{ "blob_id": "1be510e6715d21e814c48fe05496704e9a65d554", "index": 308, "step-1": "<mask token>\n", "step-2": "<mask token>\nc = Client()\n", "step-3": "from end import Client\nc = Client()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import pandas as pd df = pd.DataFrame({'col1':[1,2,3,4],'col2':[444,555,666,444],'col3':['abc','def','ghi','xyz']}) print(df.head()) #print(df['col2'].unique()) #print(df['col1'] > 2) newdf = df[(df['col1']>0) & (df['col2'] == 444)] print("========================") print(newdf) def times2(x): return x*2 print("=...
normal
{ "blob_id": "422a4945ebf453d3e09e9e7e76dd32b30488680e", "index": 3011, "step-1": "<mask token>\n\n\ndef times2(x):\n return x * 2\n\n\n<mask token>\n", "step-2": "<mask token>\nprint(df.head())\n<mask token>\nprint('========================')\nprint(newdf)\n\n\ndef times2(x):\n return x * 2\n\n\nprint('=...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def solve(): valid_passes = 0 with open('.\\day4.txt') as fp: for line in fp.read().strip().splitlines(): list_of_words = set() add = 1 for word in line.split(): modified_word = ''.join(sorte...
flexible
{ "blob_id": "870d260b58c10e0379d66c3b44bc45594ff7d666", "index": 4396, "step-1": "<mask token>\n", "step-2": "def solve():\n valid_passes = 0\n with open('.\\\\day4.txt') as fp:\n for line in fp.read().strip().splitlines():\n list_of_words = set()\n add = 1\n for w...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TypeFrame(wx.Frame): <|reserved_special_token_0|> def createCogButtons(self, row): cogButtons = self.domButtons if row == 0 else self.auxButtons labels = ['N', 'S', 'T', 'F'] for i in range(4): cogButtons.append(wx.Button(self.panel, labe...
flexible
{ "blob_id": "519dbe97ce9de30e616d660ef168e686c52b01b5", "index": 5452, "step-1": "<mask token>\n\n\nclass TypeFrame(wx.Frame):\n <mask token>\n\n def createCogButtons(self, row):\n cogButtons = self.domButtons if row == 0 else self.auxButtons\n labels = ['N', 'S', 'T', 'F']\n for i in ...
[ 4, 5, 6, 7, 8 ]
#This is a module which implements Naive Set Theory in Python. #It will be useful for Unions, Intersections, Mutual Exclusion, and more. #ideas: print(sum([[[1],[2]], [[3],[4]], [[5],[6]]], [])) Monoid - abstraction on + trial = [1, 2, 3] trial2 = [3, 4, 5] def recursiveUnioniser(set): if isinstance(set[0], int)...
normal
{ "blob_id": "c632c50028fee2f19fb65458f0b55ec228b8006f", "index": 2137, "step-1": "<mask token>\n\n\ndef intersection(set_a, set_b):\n res = [i for i in set_a if i in set_b]\n return res\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef recursiveUnioniser(set):\n if isinstance(set[0], int):\n ...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from ccapi.interfaces.bitfinex import Bitfinex from ccapi.interfaces.bittrex import Bittrex from ccapi.interfaces.poloniex import Poloniex from ccapi.interfaces.bithumb import Bithumb from ccapi.interfaces.coinone import Coinone from ccapi.interfaces.korbit i...
flexible
{ "blob_id": "098c91f4aa367cb389e542c0199b633e7ecd4003", "index": 4369, "step-1": "<mask token>\n", "step-2": "from ccapi.interfaces.bitfinex import Bitfinex\nfrom ccapi.interfaces.bittrex import Bittrex\nfrom ccapi.interfaces.poloniex import Poloniex\nfrom ccapi.interfaces.bithumb import Bithumb\nfrom ccapi.in...
[ 0, 1, 2 ]
import logging from logging import INFO from typing import Dict, List from .constants import Relations, POS from .evaluator import * from .general import DPHelper from .general import * from .utils import * # ========================================= DRIVER ================================================= def genera...
normal
{ "blob_id": "5923a12378225fb6389e7e0275af6d4aa476fe87", "index": 1635, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate(root: Dict):\n relations: List[Dict] = []\n subj = DPHelper.get_subject(root)\n obj = DPHelper.get_object(root)\n if subj is not None and DPHelper.is_proper_n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LoginViewWebApp(FlaskView): <|reserved_special_token_0|> def __init__(self): self.user_controller = UserController() @route('/register', methods=['GET', 'POST']) def register_user(self): if request.method == 'GET': return render_template...
flexible
{ "blob_id": "a2e77298059104b403555af95430d7995f8a697b", "index": 1379, "step-1": "<mask token>\n\n\nclass LoginViewWebApp(FlaskView):\n <mask token>\n\n def __init__(self):\n self.user_controller = UserController()\n\n @route('/register', methods=['GET', 'POST'])\n def register_user(self):\n ...
[ 4, 5, 6, 7, 8 ]
<|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": "3f9be81c86852a758440c6a144b8caba736b3868", "index": 972, "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 = [('usuarios', '...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Mon Jan 7 15:26:08 2019 @author: Qlala """ import numpy as np; import random as rand; import os; #os.system("del test_frame2.txt") #frame=open("test_frame2.txt","w"); #ba=bytearray(rand.getrandbits(8) for _ in range(400000)) #frame.write("0"*1000000) #frame.close() #ba.decode('...
normal
{ "blob_id": "281f2f47f9d7f0d87a354d37f9ff2c14a5598068", "index": 2893, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir('test')\nfor i in range(1000):\n t_frame = open('test_f' + str(i), 'w')\n t_frame.write('0' * 1000000)\n t_frame.close()\nos.chdir('..')\n", "step-3": "<mask token>\ni...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.1 on 2020-12-02 19:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('element', '0011_suggestion_suggestion_type'), ('bot', '0001_initial'), ] operations = [ migrations.AddField( model_name=...
normal
{ "blob_id": "43ae01ffe35c6c4491f3f7e480dd6f5c1be86eb2", "index": 2475, "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 = [('element', '...
[ 0, 1, 2, 3, 4 ]
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers, Sequential, optimizers import numpy as np from tensorflow.compat.v1.keras.backend import set_session config = tf.compat.v1.ConfigProto() config.gpu_optio...
normal
{ "blob_id": "e626a7f3f9241db8684c3b8c1bd79ea49e03490d", "index": 8141, "step-1": "<mask token>\n\n\nclass BasicBlock(layers.Layer):\n <mask token>\n\n def call(self, inputs, training=None):\n out = self.conv1(inputs)\n out = self.bn1(out)\n out = self.relu1(out)\n out = self.con...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> class Eye11(Page): form_model = models.Player form_fields = ['option_11'] timeout_seconds = 10 class Eye12(Page): form_model = models.Player form_fields = ['option_12'] timeout_seconds = 10 class Eye13(Page): form_model = models.Player form_fields = ['o...
flexible
{ "blob_id": "8fecfdf4b3772e5304f0b146317f94cdbd7fbd53", "index": 5791, "step-1": "<mask token>\n\n\nclass Eye11(Page):\n form_model = models.Player\n form_fields = ['option_11']\n timeout_seconds = 10\n\n\nclass Eye12(Page):\n form_model = models.Player\n form_fields = ['option_12']\n timeout_s...
[ 76, 81, 85, 100, 105 ]
import os import factorStatFileCreator dirName = 'NoPerms/' dirName2 = 'AllPerms/' freqAgentDic = dict() lenAgentDic = dict() contAgentDic = dict() def freqModAvgFunc(dirName): fullList = factorStatFileCreator.directoryFreq(dirName) UA = dirName.split("/")[1] avgList = [] sum = 0 i = 0 while ...
normal
{ "blob_id": "8ac84aa29e9e4f3b85f1b3c27819feb5f41e8d8e", "index": 598, "step-1": "<mask token>\n\n\ndef freqModAvgFunc(dirName):\n fullList = factorStatFileCreator.directoryFreq(dirName)\n UA = dirName.split('/')[1]\n avgList = []\n sum = 0\n i = 0\n while i <= len(fullList) - 2:\n diff =...
[ 7, 8, 9, 10, 12 ]
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = 'raek' web = '910d59f0-30bd-495b-a54c-bf5addc81a8a' app = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'
normal
{ "blob_id": "cce645073ba117b9e297dfccf5a39710b0c6cd14", "index": 8479, "step-1": "<mask token>\n", "step-2": "__author__ = 'raek'\nweb = '910d59f0-30bd-495b-a54c-bf5addc81a8a'\napp = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'\n", "step-3": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n__author__ = 'raek'\n\nweb ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> warnings.filterwarnings(action='ignore', module='scipy', message= '^internal gelsd') <|reserved_special_token_0|> model.intercept_ print(model.intercept_) model.coef_ print(model.coef_) <|reserved_special_token_1|> <|reserv...
flexible
{ "blob_id": "0f257d199ad0285d8619647434451841144af66d", "index": 9379, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings(action='ignore', module='scipy', message=\n '^internal gelsd')\n<mask token>\nmodel.intercept_\nprint(model.intercept_)\nmodel.coef_\nprint(model.coef_)\n", "...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 2.2.4 on 2019-09-09 11:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_ordered'), ] operations = [ migrations.AlterField( model_name='generalinfo', name='amount_available', ...
normal
{ "blob_id": "8af9cc32b445402fa790b29382a802bd8afc1100", "index": 5655, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
import pandas as pd import matplotlib.pyplot as plt import math import seaborn as sns import numpy as np suv_data=pd.read_csv("F:/Development/Machine Learning/suv-data/suv_data.csv") print(suv_data.head(10)) print("the no of passengers in the list is"+str(len(suv_data.index))) sns.countplot(x="Purchased",data=suv_data...
normal
{ "blob_id": "c955057d7f8d5289898ecb96a290f5a7d241b787", "index": 6440, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(suv_data.head(10))\nprint('the no of passengers in the list is' + str(len(suv_data.index)))\nsns.countplot(x='Purchased', data=suv_data)\nsns.countplot(x='Purchased', hue='Gender', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): errors = [] for arg in sys.argv[1:]: try: validate_fragment('envoy.config.bootstrap.v3.Bootstrap', yaml. safe_load(pathlib.Path(arg).read_text())) except (ParseErro...
flexible
{ "blob_id": "04097e63de5cd94ca8921be5cb6c2155c1e7bc20", "index": 7534, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n errors = []\n for arg in sys.argv[1:]:\n try:\n validate_fragment('envoy.config.bootstrap.v3.Bootstrap', yaml.\n safe_load(pathlib...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def loop(run_state): error = 1 simulations = 1 while run: error_margin = str(error / simulations * 100) + '%' prediction = get_prediction() print('Prediction: %s' % prediction) print('Error Margin: %s' % error_margin) print('Flip the coi...
flexible
{ "blob_id": "25ff54a969651d365de33f2420c662518dd63738", "index": 864, "step-1": "<mask token>\n\n\ndef loop(run_state):\n error = 1\n simulations = 1\n while run:\n error_margin = str(error / simulations * 100) + '%'\n prediction = get_prediction()\n print('Prediction: %s' % predict...
[ 5, 6, 7, 8, 9 ]
a=range(1,11) #1~10숫자를 에이에 저장 b=1 for i in a: #a에있는 원소를 b에 곱하고 비에 저장 b*=i print(b)
normal
{ "blob_id": "8cb7290792f9390dd350e0c79711e0dd72d6063b", "index": 9508, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in a:\n b *= i\nprint(b)\n", "step-3": "a = range(1, 11)\nb = 1\nfor i in a:\n b *= i\nprint(b)\n", "step-4": "a=range(1,11) #1~10숫자를 에이에 저장\nb=1\nfor i in a: #a에있는 원소를 ...
[ 0, 1, 2, 3 ]
import sys import numpy as np sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, M = map(int, input().split()) def cumprod(arr, MOD): L = len(arr) Lsq = int(L ** 0.5 + 1) arr = np.resize(arr, Lsq ** 2).reshape(Lsq, ...
normal
{ "blob_id": "43d5bf79f16e8530797cdd13cdfcc91f0d3aef5e", "index": 8208, "step-1": "<mask token>\n\n\ndef cumprod(arr, MOD):\n L = len(arr)\n Lsq = int(L ** 0.5 + 1)\n arr = np.resize(arr, Lsq ** 2).reshape(Lsq, Lsq)\n for n in range(1, Lsq):\n arr[:, n] *= arr[:, n - 1]\n arr[:, n] %= MO...
[ 3, 4, 5, 6, 7 ]
from wrapper import SeleniumWrapper from selenium.webdriver.common.by import By class PageDetector: def __init__(self, driver): self.selenium = SeleniumWrapper(driver) def detect(self): if self.selenium.wait_for_presence(locator=(By.ID, "teams-app-bar"), timeout=30): if sel...
normal
{ "blob_id": "603d7df0639def2b620cca2299077674e35a74b2", "index": 5980, "step-1": "<mask token>\n\n\nclass PageDetector:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass PageDetector:\n\n def __init__(self, driver):\n self.selenium = SeleniumWrapper(driver)\n <mask token>\...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def postfix(expression): operators, stack = '+-*/', [] for item in expression.split(): if item not in operators: stack.append(item) else: operand_1, operand_2 = stack.pop(), stack.pop() stack.append(...
flexible
{ "blob_id": "3ae0149af78216d6cc85313ebaa6f7cd99185c05", "index": 531, "step-1": "<mask token>\n", "step-2": "def postfix(expression):\n operators, stack = '+-*/', []\n for item in expression.split():\n if item not in operators:\n stack.append(item)\n else:\n operand_1,...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sns.set() get_ipython().magic('matplotlib inline') <|reserved_special_token_0|> if header_included: header = 0 <|reserved_special_token_0|> for item in combinations: index = ax[i] x_vis = X[:, [features[item[0]], featu...
flexible
{ "blob_id": "f2786e445bdf66cf6bb66f4cde4c7b2bf819d8aa", "index": 3299, "step-1": "<mask token>\n", "step-2": "<mask token>\nsns.set()\nget_ipython().magic('matplotlib inline')\n<mask token>\nif header_included:\n header = 0\n<mask token>\nfor item in combinations:\n index = ax[i]\n x_vis = X[:, [featu...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%Y-%m-%d 00:00:00')) <|reserved_special_token_1|> from datetime import datetime, time, timedelta print(datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%Y-%m-%d 00:...
flexible
{ "blob_id": "4dac8e7e695c473cb73ceaf3887373bcc0a08aff", "index": 5940, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(datetime.strptime('2013-1-25', '%Y-%m-%d').strftime('%Y-%m-%d 00:00:00'))\n", "step-3": "from datetime import datetime, time, timedelta\nprint(datetime.strptime('2013-1-25', '%Y-%...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def new_w(w, d): """ Multi-period commitments in the next epoch. Args: d: Defender's actions m: Number of non multi-period commitments. (i.e. The first m defender's actions are not multi-period) s = [q, r, w]: Current State tau: An array denotin...
flexible
{ "blob_id": "87f3885b4357d66a745932f3c79804e6c15a57fa", "index": 3162, "step-1": "<mask token>\n\n\ndef new_w(w, d):\n \"\"\"\n Multi-period commitments in the next epoch.\n Args:\n d: Defender's actions\n m: Number of non multi-period commitments. (i.e. The first m defender's actions are ...
[ 3, 4, 5, 6, 7 ]
from PyQt5 import QtCore from PyQt5.QtWidgets import QTableWidgetItem, QDialog from QT_view.PassportAdd import PassportAddDialog from QT_view.PassportWin import Ui_Dialog from Repository.Rep_Passport import PassportRepository class PassportQt(QDialog): def __init__(self): super(PassportQt, self...
normal
{ "blob_id": "3f1715763a066fb337b3ff3d03e3736d0fb36b3f", "index": 7325, "step-1": "<mask token>\n\n\nclass PassportQt(QDialog):\n\n def __init__(self):\n super(PassportQt, self).__init__()\n self.passport_rep = PassportRepository()\n self.initUI()\n <mask token>\n\n def click_add(sel...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> list.sort(table) print(table[num - 1] - table[0]) <|reserved_special_token_1|> num = int(input()) str = input().split() table = [int(i) for i in str] list.sort(table) print(table[num - 1] - table[0]) <|reserved_special_token_...
flexible
{ "blob_id": "d853964d424e628d6331b27123ad045f8d945dc0", "index": 4026, "step-1": "<mask token>\n", "step-2": "<mask token>\nlist.sort(table)\nprint(table[num - 1] - table[0])\n", "step-3": "num = int(input())\nstr = input().split()\ntable = [int(i) for i in str]\nlist.sort(table)\nprint(table[num - 1] - tabl...
[ 0, 1, 2, 3 ]
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' #app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True; #db = SQLAlchemy(app) # MONGODB CREATION #Creating a pymongo client client = MongoClient('localhost', 27017) #Getting the database instance db = client['mydb'] print("Database created........") #Verif...
normal
{ "blob_id": "5b7567129d447ae2b75f4a8f9c26127f8b7553ec", "index": 7818, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Database created........')\nprint('List of databases after creating new one')\nprint(client.list_database_names())\n<mask token>\nmeta.create_all(engine)\n", "step-3": "client = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def cv_diff_value(prevalue, postvalue): return postvalue - prevalue def cv_diff_rate(prevalue, postvalue): return (postvalue - prevalue) / prevalue * 100 def cv_maN_value(cv, N): str_replay = 'N의 값을 다시 입력해주세요' if 3 <= N <= 5: return cv.rolling(window=N).mean() ...
flexible
{ "blob_id": "a967b97f090a71f28e33c5ca54cb64db3967aea3", "index": 7002, "step-1": "<mask token>\n\n\ndef cv_diff_value(prevalue, postvalue):\n return postvalue - prevalue\n\n\ndef cv_diff_rate(prevalue, postvalue):\n return (postvalue - prevalue) / prevalue * 100\n\n\ndef cv_maN_value(cv, N):\n str_repla...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class ClientCreator(object): <|reserved_special_token_0|> def __init__(self, loader, endpoint_creator): self._loader = loader self._endpoint_creator = endpoint_creator def create_client(self, service_name, region_name, is_secure=True, endpoint_url=Non...
flexible
{ "blob_id": "829c833866198307d7d19c4a0cbe40299ee14eb9", "index": 5288, "step-1": "<mask token>\n\n\nclass ClientCreator(object):\n <mask token>\n\n def __init__(self, loader, endpoint_creator):\n self._loader = loader\n self._endpoint_creator = endpoint_creator\n\n def create_client(self, ...
[ 6, 8, 15, 16, 18 ]
from abc import ABC # This is base class class Vehicle(ABC): pass # GroundVehicle inherits from Vehicle class GroundVehicle(Vehicle): pass # Car inherits from GroundVehicle class Car(GroundVehicle): pass # Motorcycle inherits from GroundVehicle class Motorcycle(GroundVehicle): pass # FlightVehicle ...
normal
{ "blob_id": "d7db617131bf6e72c7aa808030f7286ddb609cc2", "index": 4579, "step-1": "<mask token>\n\n\nclass Motorcycle(GroundVehicle):\n pass\n\n\nclass FlightVehicle(Vehicle):\n pass\n\n\nclass Starship(FlightVehicle):\n pass\n\n\nclass Airplane(FlightVehicle):\n pass\n", "step-2": "<mask token>\n\n...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class VigenereCipher(object): def __init__(self, key): print('Vigenere Cipher Encription') self.key = key def encode(self, text): key = self.key ans = '' for index, i in enumerate(text): if ord('!') <= ord(i) <= ord('~'): ...
flexible
{ "blob_id": "38906a31ab96e05a9e55a51260632538872ed463", "index": 6889, "step-1": "<mask token>\n\n\nclass VigenereCipher(object):\n\n def __init__(self, key):\n print('Vigenere Cipher Encription')\n self.key = key\n\n def encode(self, text):\n key = self.key\n ans = ''\n ...
[ 8, 9, 11, 12, 13 ]
# coding: utf-8 # In[1]: #coding:utf8 import matplotlib import os if 'DISPLAY' not in os.environ: matplotlib.use('Agg') else: pass import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim from matplotlib import pyplot as plt import seaborn as sns from tqdm import tq...
normal
{ "blob_id": "3022cade3bfa36925bcbda8023e5cd98ed33d093", "index": 9901, "step-1": "<mask token>\n\n\ndef get_accuracy(model, kb):\n results = []\n for clause in kb.clauses:\n o1, o2 = model.forward(clause)\n if o2.data.numpy()[0][0] > 0.9:\n results.append(1.0)\n else:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class ghetto(GridLayout): <|reserved_special_token_0|> def biyoCallback(self, a): webbrowser.open_new( 'https://us04web.zoom.us/j/8651192984?pwd=cFV0bUNPTXRUOGVPZWw4dEhDQm0vUT09' ) def edebCallback(self, a): webbrowser.open_new( ...
flexible
{ "blob_id": "39affe139eec4cf6877646188839d79ed575235c", "index": 8952, "step-1": "<mask token>\n\n\nclass ghetto(GridLayout):\n <mask token>\n\n def biyoCallback(self, a):\n webbrowser.open_new(\n 'https://us04web.zoom.us/j/8651192984?pwd=cFV0bUNPTXRUOGVPZWw4dEhDQm0vUT09'\n )\n...
[ 11, 12, 15, 17, 18 ]
#!/usr/bin/env python # coding: utf-8 import sys,pysrt import urllib2,urllib,json import re from urlparse import urlparse import os from mtranslate import translate from argparse import ArgumentParser reload(sys) sys.setdefaultencoding('utf8') #------------------------------------------------------------------------...
normal
{ "blob_id": "e51c57f4487a3225936d073142f1f770815c0d47", "index": 7589, "step-1": "#!/usr/bin/env python\n# coding: utf-8\nimport sys,pysrt\nimport urllib2,urllib,json\nimport re\nfrom urlparse import urlparse\nimport os\nfrom mtranslate import translate\nfrom argparse import ArgumentParser\nreload(sys) \nsys.se...
[ 0 ]
""" Function of main.py: config loader hprams loader feature extraction Call model training and validation Model Save and Load Call model validation 载入训练参数 载入指定模型超参数 调用特征提取 调用模型训练和验证 模型保存与载入 调用模型验证 """ """A very simple MNIST classifier. See extensive documentation at https://www.tensorflow.org/get_started/mnist/beg...
normal
{ "blob_id": "c6174fae929366cabb8da3d810df705b19895c1c", "index": 2763, "step-1": "\"\"\"\nFunction of main.py:\n\nconfig loader\nhprams loader\nfeature extraction\nCall model training and validation\nModel Save and Load\nCall model validation\n\n载入训练参数\n载入指定模型超参数\n调用特征提取\n调用模型训练和验证\n模型保存与载入\n调用模型验证\n\"\"\"\n\n\...
[ 0 ]
"""autogenerated by genpy from arm_navigation_msgs/GetPlanningSceneRequest.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct import arm_navigation_msgs.msg import geometry_msgs.msg import std_msgs.msg import genpy import sensor_msgs.msg class GetPlanni...
normal
{ "blob_id": "b8e18877af990c533c642d4937354198a4676419", "index": 5194, "step-1": "<mask token>\n\n\nclass GetPlanningSceneResponse(genpy.Message):\n _md5sum = '285525c9abe002fbafa99af84a14b4cb'\n _type = 'arm_navigation_msgs/GetPlanningSceneResponse'\n _has_header = False\n _full_text = \"\"\"\n\nPla...
[ 10, 14, 18, 20, 21 ]
<|reserved_special_token_0|> class Zaojiaopage(Crazy): <|reserved_special_token_0|> <|reserved_special_token_0|> def click_zao(self): self.click(self.zao_btn_loc) <|reserved_special_token_0|> <|reserved_special_token_0|> def click_find(self): self.click(self.find_loc) <|r...
flexible
{ "blob_id": "1980fb4d6e7d3c6fe51f4a242610b5489e553859", "index": 128, "step-1": "<mask token>\n\n\nclass Zaojiaopage(Crazy):\n <mask token>\n <mask token>\n\n def click_zao(self):\n self.click(self.zao_btn_loc)\n <mask token>\n <mask token>\n\n def click_find(self):\n self.click(s...
[ 73, 89, 121, 148, 152 ]
from django.shortcuts import render from rest_framework import status from rest_framework.decorators import api_view, renderer_classes from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer from rest_framework.response import Response from feedback.models import Feedback from feedback.serializers impor...
normal
{ "blob_id": "bd6c72c3215265a349c5f47573063a9288f64198", "index": 5227, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET', 'POST'])\n@renderer_classes([JSONRenderer, BrowsableAPIRenderer])\ndef feedback_list(request, format=None):\n \"\"\"\n List all feedback or create a new feedba...
[ 0, 1, 2, 3 ]
from framework import * from pebble_game import * from constructive_pebble_game import * from nose.tools import ok_ import numpy as np # initialise the seed for reproducibility np.random.seed(102) fw_2d = create_framework([0,1,2,3], [(0,1), (0,3), (1,2), (1,3), (2,3)], [(2,3), (4,4), (5,2), (1,1)]) # a 3d fw constric...
normal
{ "blob_id": "4e31619efcaf6eeab3b32116b21e71de8202aee2", "index": 8646, "step-1": "<mask token>\n", "step-2": "<mask token>\nok_(is_inf_rigid(fw_2d, 2))\nok_(not is_inf_rigid(fw_3d, 3))\nok_(is_inf_rigid(fw_1d, 1))\n<mask token>\nprint(len(rand_fw.nodes))\ndraw_framework(rand_fw)\n<mask token>\nprint(R)\nprint(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def infer(sample): return {'mean': np.mean(sample), 'std': np.std(sample)} <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def simulate_one_realisation(): return np.random.normal(1, 2, size=n_points) def infer(sample): return {'m...
flexible
{ "blob_id": "6e8ef901fc614ecbba25df01f84a43c429f25cf6", "index": 4919, "step-1": "<mask token>\n\n\ndef infer(sample):\n return {'mean': np.mean(sample), 'std': np.std(sample)}\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef simulate_one_realisation():\n return np.random.normal(1, 2, size=n_points...
[ 1, 3, 4, 5, 6 ]
#!/usr/bin/python3 """takes in a URL and an email address, sends a POST request to the passed URL with the email as a parameter, and finally displays the body of the response. """ import requests import sys if __name__ == "__main__": url_arg = sys.argv[1] email = sys.argv[2] params = {'email': email} ...
normal
{ "blob_id": "0d9c50e55df5aa5614bd5a9679729cf7fa69c5df", "index": 1461, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n url_arg = sys.argv[1]\n email = sys.argv[2]\n params = {'email': email}\n response = requests.post(url_arg, data=params)\n print(response.text)...
[ 0, 1, 2, 3 ]
############################################################################### # Programming Essentials B8IT102 Assessment # # Student: Barry Sheppard ID: 10387786 # # Problem 1 # ...
normal
{ "blob_id": "77e985d94d3b47539f046a3a46cb1a197cef86f4", "index": 3409, "step-1": "<mask token>\n\n\ndef CheckNumber(userInput):\n \"\"\" This function returns True if userInput can be converted to a number and\n returns False if it cannot. \"\"\"\n try:\n float(userInput)\n return True\n ...
[ 2, 3, 4, 5, 6 ]
''' Created on 27 Mar 2015 @author: Jon ''' import matplotlib.pyplot as plt from numerical_functions import Timer import numerical_functions.numba_funcs.indexing as indexing import numpy as np import unittest class Test(unittest.TestCase): def test_take(self): x = np.linspace( 0, 100 ) ...
normal
{ "blob_id": "ee80169afd4741854eff8619822a857bbf757575", "index": 291, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def test_take_comparison(self):\n x = np.arange(1000000.0)\n idx = np.random.random_integers(0, 100000.0, 1000000.0)\n indexing.take(x, i...
[ 5, 7, 8, 11, 12 ]
import pygame from pygame.locals import * pygame.init() ttt = pygame.display.set_mode((300,325)) #loome mänguakna pygame.display.set_caption = ("Trips-Traps-Trull") võitja = None def init_tabel(ttt): taust = pygame.Surface(ttt.get_size()) taust = taust.convert() taust.fill((250,250,250)) #tõm...
normal
{ "blob_id": "a667c4cb0a30ee67fe982bb96ece6bb75f25f110", "index": 7084, "step-1": "<mask token>\n\n\ndef näita_tabelit(ttt, tabel):\n hetkeseis(tabel)\n ttt.blit(tabel, (0, 0))\n pygame.display.flip()\n\n\ndef hiire_positsioon_tabelis(Xkoordinaat, Ykoordinaat):\n if Ykoordinaat < 100:\n rida = ...
[ 6, 7, 9, 10, 11 ]
import sys if __name__ == '__main__': cases = sys.stdin.readline() for i in range(int(cases)): sys.stdin.readline() lineas, columnas = sys.stdin.readline().strip().split(" ") lineas = int(lineas) columnas = int(columnas) list_lines = [] for linea in range(linea...
normal
{ "blob_id": "22909e41e4f9ad0280c22ec11ecfbccff87efae1", "index": 1402, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n cases = sys.stdin.readline()\n for i in range(int(cases)):\n sys.stdin.readline()\n lineas, columnas = sys.stdin.readline().strip().split(...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> @routes.route('/signin', name='signin') class SigninEndpoint(PoolHTTPEndpoint): <|reserved_special_token_0|> <|reserved_special_token_0|> @back_to.setter def back_to(self, value: typing.Optional[str]): self.request.session['back_to'] = value def render_templa...
flexible
{ "blob_id": "6e01e36170f3f08f2030dbd4dd91019936fb9f5c", "index": 849, "step-1": "<mask token>\n\n\n@routes.route('/signin', name='signin')\nclass SigninEndpoint(PoolHTTPEndpoint):\n <mask token>\n <mask token>\n\n @back_to.setter\n def back_to(self, value: typing.Optional[str]):\n self.request...
[ 9, 13, 14, 19, 20 ]
<|reserved_special_token_0|> class LoginForm(forms.Form): username = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'})) password = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'})) <|reserved_special_token_1|> <|reserved_special_token_0|> c...
flexible
{ "blob_id": "7644dcd956e1ad179f42e44870864386744c6cdf", "index": 2553, "step-1": "<mask token>\n\n\nclass LoginForm(forms.Form):\n username = forms.CharField(widget=forms.TextInput(attrs={'class':\n 'form-control'}))\n password = forms.CharField(widget=forms.PasswordInput(attrs={'class':\n 'f...
[ 2, 3, 4, 5 ]
import csv import json from urllib import request from urllib.error import HTTPError from urllib.parse import urljoin, urlparse, quote_plus from optparse import OptionParser HEADER = ["id", "module", "channel", "type", "value", "datetime"] def parse_options(): parser = OptionParser() parser.add_option("-H", "...
normal
{ "blob_id": "b47f15a79f7a82304c2be6af00a5854ff0f6ad3e", "index": 6987, "step-1": "<mask token>\n\n\ndef write_csv(url, recursive=False, writer=None, token=''):\n response = fetch(url)\n if recursive:\n write_rows(writer, response)\n cursor = next_cursor(response)\n if cursor is not Non...
[ 3, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class InviteAdmin(admin.ModelAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class InviteAdmin(admin.ModelAdmin): list_display = ('invitee', 'inviter', 'created_on', 'approved', 'rejected', ...
flexible
{ "blob_id": "fcb13b087b9c967ab16b64885411cc4aae98583c", "index": 2130, "step-1": "<mask token>\n\n\nclass InviteAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass InviteAdmin(admin.ModelAdmin):\n list_display = ('invitee', 'inviter', 'created_on', 'approved',...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='isc-dhcpd-parser', version='0.1', description= 'Parser for isc-dhcp config files (dhcpd.conf)', author= 'Pavel Podkorytov', author_email='pod.pavel@gmail.com', classifiers=[ 'Development Status :: 3 - Alpha...
flexible
{ "blob_id": "79141679bb2839de9d4a25b6c6c285905dddbb0d", "index": 6460, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='isc-dhcpd-parser', version='0.1', description=\n 'Parser for isc-dhcp config files (dhcpd.conf)', author=\n 'Pavel Podkorytov', author_email='pod.pavel@gmail.com', class...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class hrsalaryRule(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class hrsalaryRule(models.Model): _inherit = 'hr.salary.rule'...
flexible
{ "blob_id": "097a87f7f1346e5db1599e59680232912348aef7", "index": 311, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass hrsalaryRule(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass hrsalaryRule(models.Model):\n _inherit = 'hr.salary.rule'\n is_tax_...
[ 0, 1, 2, 3, 4 ]
from django import forms class PasswordChangeForm(forms.Form): password = forms.CharField(min_length=8, label="New Password*", strip=False, widget=forms.PasswordInput( attrs={'autocomple...
normal
{ "blob_id": "85fff1f6e1f69dd0e2e9b5acc90db31d27329c7c", "index": 3352, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass PasswordChangeForm(forms.Form):\n password = forms.CharField(min_length=8, label='N...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name='twqq', version=twqq.__version__, description= 'An asynchronous webqq client library based on tornado', long_description=open('README.rst').read(), author='cold', author_email ='wh_linux@126.com', url='http:...
flexible
{ "blob_id": "9492142a569da1d21b1927e79d97f9cf6276efdc", "index": 2800, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='twqq', version=twqq.__version__, description=\n 'An asynchronous webqq client library based on tornado',\n long_description=open('README.rst').read(), author='cold', aut...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 # 2019/11/27 @ tongshiwei import pytest def test_api(env): assert set(env.parameters.keys()) == {"knowledge_structure", "action_space", "learning_item_base"} @pytest.mark.parametrize("n_step", [True, False]) def test_env(env, tmp_path, n_step): from EduSim.Envs.KSS import kss_train_eval, KS...
normal
{ "blob_id": "b1ae3abb6decf4d70bc2372e70cf4f5b868e805d", "index": 8756, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_api(env):\n assert set(env.parameters.keys()) == {'knowledge_structure',\n 'action_space', 'learning_item_base'}\n\n\n<mask token>\n", "step-3": "<mask token>\n\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class EntryCreateView(CreateView): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class EntryUpdateView(UpdateView): model = Entry fields = ['title', 'content'] def get_success_url(self): return reverse_lazy('entry...
flexible
{ "blob_id": "37c03732ae52171fc24aec85c940848b02d76dc1", "index": 1176, "step-1": "<mask token>\n\n\nclass EntryCreateView(CreateView):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass EntryUpdateView(UpdateView):\n model = Entry\n fields = ['title', 'content']\n\n def get_success_url(sel...
[ 6, 7, 10, 11, 13 ]
from matplotlib import pyplot as plt from read_and_calculate_speed import get_info_from_mongodb plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['font.family'] = 'sans-serif' def mat_line(speed_time_info, interface, direction, last_time): # 调节图形大小,宽,高 fig = plt.figure(figsize=(6, 6)) # 一共一行,每行一图...
normal
{ "blob_id": "0aa419b0045914b066fbec457c918d83276f2583", "index": 3556, "step-1": "<mask token>\n\n\ndef mat_line(speed_time_info, interface, direction, last_time):\n fig = plt.figure(figsize=(6, 6))\n ax = fig.add_subplot(111)\n import matplotlib.dates as mdate\n ax.xaxis.set_major_formatter(mdate.Da...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class LinkedinSearch: <|reserved_special_token_0|> <|reserved_special_token_0|> def db_fetch(self, query): self.collection.create_index([('name', 'text')]) lst = [] cursor = self.collection.find({'$text': {'$search': query}}, { 'score': {'$...
flexible
{ "blob_id": "3e8860c22ff3092304df57aa7f5dbcb6ccda7dd8", "index": 5249, "step-1": "<mask token>\n\n\nclass LinkedinSearch:\n <mask token>\n <mask token>\n\n def db_fetch(self, query):\n self.collection.create_index([('name', 'text')])\n lst = []\n cursor = self.collection.find({'$tex...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: net = Net.FeedForwardNet(input_count=784, layers=[100, 10], activation_function=Net.FeedForwardNet.leaky_relu) try: epoch_num = int(input('Epoch_num:')) batch_size = int(input('Batch_siz...
flexible
{ "blob_id": "49005500b299ca276f663fe8431bb955e5585bbd", "index": 335, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n net = Net.FeedForwardNet(input_count=784, layers=[100, 10],\n activation_function=Net.FeedForwardNet.leaky_relu)\n try:\n epoch_num = int(input('Epoch_num...
[ 0, 1, 2, 3, 4 ]
from helper import * tree_type = TREE_TYPE_SPLIT file_name = '' file_path = '' split_scalars = {} visited = {} adjacency = {} pairs = {} index_map = {} postorder_map = {} preorder_map = {} birth = {} death = {} string = '' class Tree(object): def __init__(self): self.index = None self.children = [] self.p...
normal
{ "blob_id": "4daab8b8db1e394e3132ab5550fe0236b67074d8", "index": 5527, "step-1": "from helper import *\n\ntree_type = TREE_TYPE_SPLIT\n\nfile_name = ''\nfile_path = ''\n\nsplit_scalars = {}\nvisited = {}\nadjacency = {}\npairs = {}\n\nindex_map = {}\npostorder_map = {}\npreorder_map = {}\n\nbirth = {}\ndeath = {...
[ 0 ]
DEBUG = True SQLALCHEMY_DATABASE_URI = "postgresql://username:password@IPOrDomain/databasename" SQLALCHEMY_TRACK_MODIFICATIONS = True DATABASE_CONNECT_OPTIONS = {} THREADS_PER_PAGE = 2
normal
{ "blob_id": "a1b0e72b62abc89d5292f199ec5b6193b544e271", "index": 7813, "step-1": "<mask token>\n", "step-2": "DEBUG = True\nSQLALCHEMY_DATABASE_URI = (\n 'postgresql://username:password@IPOrDomain/databasename')\nSQLALCHEMY_TRACK_MODIFICATIONS = True\nDATABASE_CONNECT_OPTIONS = {}\nTHREADS_PER_PAGE = 2\n", ...
[ 0, 1, 2 ]
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-# # PROJECT : RegCEl - Registro para el Consumo Eléctrico # # VERSION : 1.2 ...
normal
{ "blob_id": "7da8a074704b1851ac352477ef72a4c11cea1a0b", "index": 6737, "step-1": "<mask token>\n\n\nclass NumericKeyboard(Bubble):\n\n def on_touch_up(self, touch):\n app = App.get_running_app()\n if not self.collide_point(*touch.pos\n ) and not self.parent.collide_point(*touch.pos):\...
[ 5, 9, 10, 11, 16 ]
import torch import torch_scatter import torchgraphs as tg import textwrap from . import autograd_tricks as lrp def patch(): torch.add = lrp.add torch.cat = lrp.cat torch.index_select = lrp.index_select tg.utils.repeat_tensor = lrp.repeat_tensor torch_scatter.scatter_add = lrp.scatter_add torc...
normal
{ "blob_id": "faafc7cfd900d3f6fd6df30af5580f71eecfb279", "index": 8298, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef computational_graph(op):\n if op is None:\n return 'None'\n res = f'{op.__class__.__name__} at {hex(id(op))}:'\n if op.__class__.__name__ == 'AccumulateGrad':\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Controller: <|reserved_special_token_0|> <|reserved_special_token_0|> class RandomController(Controller): def __init__(self, env): """ YOUR CODE HERE """ pass def get_action(self, state): """ YOUR CODE HERE """ """ Your code should...
flexible
{ "blob_id": "7112eb52aea9be6f8e682b4dacc6b615365c8cea", "index": 7510, "step-1": "<mask token>\n\n\nclass Controller:\n <mask token>\n <mask token>\n\n\nclass RandomController(Controller):\n\n def __init__(self, env):\n \"\"\" YOUR CODE HERE \"\"\"\n pass\n\n def get_action(self, state)...
[ 8, 9, 10, 11, 12 ]
# Generated by Django 3.0.5 on 2020-05-12 13:26 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='idcard', fields=[ ('id', models.AutoField(a...
normal
{ "blob_id": "422873f89468b1faabed96f72f463b6294b85276", "index": 5314, "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|> def gen_function(b=[0]): a = 0 global carry_on while (a < 100) & carry_on: yield a a = a + 1 <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('in.txt', newline='') as raster: dataset = csv.reader(raster, ...
flexible
{ "blob_id": "4ea266d4f4c18efbba4204d7301652f8966c18a5", "index": 9724, "step-1": "<mask token>\n\n\ndef gen_function(b=[0]):\n a = 0\n global carry_on\n while (a < 100) & carry_on:\n yield a\n a = a + 1\n\n\n<mask token>\n", "step-2": "<mask token>\nwith open('in.txt', newline='') as ras...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> @pytest.fixture def families_fixture(): ped_content = io.StringIO(convert_to_tab_separated( """ familyId personId dadId momId sex status role f1 mom1 0 0 2 1 mom f1 dad1 0 0 1 1 dad ...
flexible
{ "blob_id": "6c8f690e1b43d459535238e24cccc8aa118e2d57", "index": 3038, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef families_fixture():\n ped_content = io.StringIO(convert_to_tab_separated(\n \"\"\"\n familyId personId dadId\t momId\tsex status role\n f1 mom1 0 ...
[ 7, 8, 10, 11, 13 ]
#!/usr/bin/env python import pathlib from blastsight.view.viewer import Viewer """ In this demo, we'll show how you can create a basic animation. An animation is interpreted as changing the state of the viewer one frame at the time. That means we'll define a function that makes a change in one single frame. The fun...
normal
{ "blob_id": "00be3d813ce4335ff9ea02ed9f1884d3210f3d5a", "index": 3101, "step-1": "<mask token>\n\n\ndef autorotate(angle):\n v.set_rotation_angle([0.0, -angle, 0.0])\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef autorotate(angle):\n v.set_rotation_angle([0.0, -angle, 0.0])\n\n\n<mask token>\nv.a...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-17 14:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('votes', '0003_choice_votes'), ] operations = [ migrations.CreateModel( ...
normal
{ "blob_id": "781cb59fb9b6d22547fd4acf895457868342e125", "index": 8290, "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 = [('votes', '00...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def contact(request): form_class = ContactForm if request.method == 'POST': form = form_class(data=request.POST) if form.is_valid(): contact_name = request.POST.get('contact_name', '') contact_email = request.POST.get('contact_email', '') ...
flexible
{ "blob_id": "26bb5dc2679a4375d0950667ed02369df10857a8", "index": 8410, "step-1": "<mask token>\n\n\ndef contact(request):\n form_class = ContactForm\n if request.method == 'POST':\n form = form_class(data=request.POST)\n if form.is_valid():\n contact_name = request.POST.get('contac...
[ 7, 9, 11, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def index_get(request, user_id, user, pto): schedules = Schedule.to_calendar(Schedule.objects.filter(pto=pto)) context = pto.__dict__ context.update({'schedules': schedules, 'current_user': user}) return render(r...
flexible
{ "blob_id": "7245d4db6440d38b9302907a6203c1507c373112", "index": 6970, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index_get(request, user_id, user, pto):\n schedules = Schedule.to_calendar(Schedule.objects.filter(pto=pto))\n context = pto.__dict__\n context.update({'schedules': sched...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('hello world') print('lol') print('new changes in vis') <|reserved_special_token_1|> print("hello world") print("lol") print("new changes in vis")
flexible
{ "blob_id": "6c88e55a76cbd84cee0ebd6c51d930cc2da100d2", "index": 2945, "step-1": "<mask token>\n", "step-2": "print('hello world')\nprint('lol')\nprint('new changes in vis')\n", "step-3": "print(\"hello world\")\nprint(\"lol\")\nprint(\"new changes in vis\")", "step-4": null, "step-5": null, "step-ids"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class LLKEventsBot(Bot): <|reserved_special_token_0|> async def on_ready(self): if not os.path.exists('db'): os.makedirs('db') if not os.path.exists('logs'): os.makedirs('logs') print('\nLoading extensions...') for extension...
flexible
{ "blob_id": "849343561dd9bdcfc1da66c604e1bfa4aa10ddf3", "index": 5359, "step-1": "<mask token>\n\n\nclass LLKEventsBot(Bot):\n <mask token>\n\n async def on_ready(self):\n if not os.path.exists('db'):\n os.makedirs('db')\n if not os.path.exists('logs'):\n os.makedirs('lo...
[ 1, 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.maximize_window() driver.get('http://zero.webappsecurity.com/') <|reserved_special_token_0|> driver.find_element_by_xpath("(//a[contains(text(),'privacy')])[1]").click() <|reserved_special_token_0|> for window in windows: ...
flexible
{ "blob_id": "223413918ba2a49cd13a34026d39b17fb5944572", "index": 5849, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.maximize_window()\ndriver.get('http://zero.webappsecurity.com/')\n<mask token>\ndriver.find_element_by_xpath(\"(//a[contains(text(),'privacy')])[1]\").click()\n<mask token>\nfor wi...
[ 0, 1, 2, 3, 4 ]
import os import pathlib from global_settings import * def get_bits(x): return np.where(x < 0, 0, 1) def check_wrong_bits(bits, bits_estimated): return len(np.argwhere(bits != bits_estimated)) def mkdir(file_path): folder = os.path.dirname(file_path) if not os.path.exists(folder): os.make...
normal
{ "blob_id": "74ffbd55867c4b2c6ccbef7d94e0c65aef139057", "index": 7602, "step-1": "<mask token>\n\n\ndef get_bits(x):\n return np.where(x < 0, 0, 1)\n\n\n<mask token>\n\n\ndef mkdir(file_path):\n folder = os.path.dirname(file_path)\n if not os.path.exists(folder):\n os.makedirs(folder)\n\n\n<mask ...
[ 7, 9, 11, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def flask_adapter(request: any, api_route: Type[Route]) ->any: """Adapter pattern for Flask :param - Flask Request :api_route: Composite Routes """ try: query_string_params = request.args.to_dict() ...
flexible
{ "blob_id": "3212bb7df990ad7d075b8ca49a99e1072eab2a90", "index": 595, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef flask_adapter(request: any, api_route: Type[Route]) ->any:\n \"\"\"Adapter pattern for Flask\n :param - Flask Request\n :api_route: Composite Routes\n \"\"\"\n try:\...
[ 0, 1, 2, 3 ]
""" WINRM Module to connect to windows host """ from winrm.protocol import Protocol from lib import logger class WINRM(object): """ WINRM Module to connect to windows host """ def __init__(self, host_ip, usr, pwd): """ - **parameters**, **types**, **return** and **return t...
normal
{ "blob_id": "96ac9088650490a7da00c7a20f634b76e673ca2d", "index": 1174, "step-1": "<mask token>\n\n\nclass WINRM(object):\n <mask token>\n <mask token>\n\n def connect(self):\n \"\"\"\n Method to connect to a Windows machine.\n \"\"\"\n try:\n self.host_win_ip =...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> racine.title('listPhoto') <|reserved_special_token_0|> for index in range(0, len(dirImage)): img = ImageCoord(cheminDossier + '\\' + dirImage[index]) if img.has_coord(): listImage.append(img) listImage.sort() <|r...
flexible
{ "blob_id": "f5b8d8c291d18c6f320704a89985acbcae97ca2f", "index": 2954, "step-1": "<mask token>\n", "step-2": "<mask token>\nracine.title('listPhoto')\n<mask token>\nfor index in range(0, len(dirImage)):\n img = ImageCoord(cheminDossier + '\\\\' + dirImage[index])\n if img.has_coord():\n listImage....
[ 0, 1, 2, 3, 4 ]
import math import pandas as pd from matplotlib import pyplot as plt tests = [ { "task": "listsort", "prompt": "examples", "length": 5, "shots": 0, "accuracy": 0.28, "trials": 50}, { "task": "listsort", "prompt": "examples", "length": 5, "shots": 1, "accuracy": 0.40, "trials": 50}, { "task": "listsort", "...
normal
{ "blob_id": "6b6397fd18848ffa2ae9c0ec1443d20f2cbeb8b0", "index": 3637, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor d in tests:\n d['code'] = d['prompt'] == 'code'\n d['correct'] = d['accuracy'] * d['trials']\n p = d['accuracy']\n d['err'] = 0.842 * math.sqrt(p * (1 - p) / d['trials'])\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Animation: def __init__(self): self.next_frame = pygame.time.get_ticks() self.frame = 0 self.frame_time = 1000 // ANIMATION_RATE <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "0b36bf9ac7887101be5503a0edce19e1111e5ca0", "index": 6607, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Animation:\n\n def __init__(self):\n self.next_frame = pygame.time.get_ticks()\n self.frame = 0\n self.frame_time = 1000 // ANIMATION_RATE\n <mask tok...
[ 0, 2, 3, 4, 5 ]